XGM Forum
Сайт - Статьи - Проекты - Ресурсы - Блоги

Форуме в режиме ТОЛЬКО ЧТЕНИЕ. Вы можете задать вопросы в Q/A на сайте, либо создать свой проект или ресурс.
Вернуться   XGM Forum > Warcraft> Академия: форум для вопросов> Jass
Ник
Пароль
Войти через VK в один клик
Сайт использует только имя.

Ответ
 
sleepw

offline
Опыт: 8,449
Активность:
Джас(Скил) ошибка
Кароче скачал скил написанный на джасе.. я в нём 0,но скил нужен позарез.
итак вот
» скил
Код:
scope MysticNet
  globals
    private constant integer SpellId='A00G'
    private constant string LightningType="LEAS"
    private constant integer BuffSpellId='A00H'
    private constant string BuffOrder="berserk"
    private rect MaxArea=null
    private constant real MissileFlyHeight=60.00
    private constant real MaxMissileDistance=750.00
    private constant real MissileSpeed=20.00
    private constant real TargetSpeed=15.00
    private constant real Periodic=0.03
    private constant real MissileCollision=90.00
    private constant real StopTargetRange=120.00
    private constant real lightningZ=45.00
    private constant real DeformationRange=200.00
    private constant string Code="MysticNet_SaveCodeString"
    private constant integer DummyId='e000'
    private constant string MissileGFXPath="Abilities\\Weapons\\LordofFlameMissile\\LordofFlameMissile.mdl"
    private constant string MissileGFXAttach="origin"
    private constant string MissGFXPath="Abilities\\Spells\\Orc\\Disenchant\\DisenchantSpecialArt.mdl"
    private constant string MissGFXAttach="origin"
    private constant string HitGFXPath="Abilities\\Spells\\Human\\AerialShackles\\AerialShacklesTarget.mdl"
    private constant string HitGFXAttach="origin"
    private constant string GroundHitGFXPath="Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl"
    private constant string GroundNetGFXPath="Abilities\\Weapons\\DemolisherFireMissile\\DemolisherFireMissile.mdl"
    private constant string ReactHitGFXPath="Abilities\\Spells\\NightElf\\BattleRoar\\RoarCaster.mdl"
    private constant string ReactHitGFXAttach="origin"
    private constant string ReactMissGFXPath="Abilities\\Spells\\NightElf\\Taunt\\TauntCaster.mdl"
    private constant string ReactMissGFXAttach="origin"
    private constant real maxHigh=500.00
  endglobals

  private constant function MaxFlyHeight takes real distance returns real
    return distance*1.1
  endfunction

  private constant function DamagePerLevel takes real lvl returns real
     return 20+60*lvl
  endfunction

  function Trig_Mystic_Net_Conditions takes nothing returns boolean
    return GetSpellAbilityId()==SpellId
  endfunction

  private struct MNdat_Throw
    real x
    real y
    real z
    real ux
    real uy
    real endh
    real temptime
    real distance
    real angle
    unit caster
    unit target
    unit GFXdummy
    effect GFX
    boolean hit
    lightning rope
  endstruct

  private function MysticNet_Hit takes nothing returns nothing
    local timer t             =GetExpiredTimer()
    local MNdat_Throw datas   =GetStoredInteger(GC(),HS(t),"datas")
    local real x              =GetUnitX(datas.target)
    local real y              =GetUnitY(datas.target)
    local real cx
    local real cy
    local real angle
    local real time           =datas.distance/TargetSpeed*Periodic
    local real curv

    if time>=datas.temptime and GetUnitState(datas.caster,UNIT_STATE_LIFE)>0.00 then
         set cx=GetUnitX(datas.caster)
         set cy=GetUnitY(datas.caster)
         set angle=A2PXY(x,y,cx,cy)
         set curv=GetFlyParabelEx(datas.x,datas.y,GetUnitDefaultFlyHeight(datas.target),time,  datas.temptime,datas.endh,TargetSpeed,x,y,datas.ux,datas.uy)
         set datas.temptime=datas.temptime+Periodic
         set x=x+TargetSpeed*Cos(angle*3.14159/180)
         set y=y+TargetSpeed*Sin(angle*3.14159/180)

         call MoveLightningEx(datas.rope,true,cx,cy,MissileFlyHeight+CreateZ(x,y),x,y,curv+lig  htningZ+CreateZ(x,y))
         call SetUnitPosition(datas.target,x,y)
         call BugUse_AddFlyAbility(datas.target)
         call SetUnitFlyHeight(datas.target,curv,0)

         call TimerStart(t,Periodic,false,function MysticNet_Hit)
         set t=null
       else
         call UnitDamageTarget(datas.caster,datas.target,DamagePerLevel(I2R(GetUnitAbilityLeve  l(datas.caster,SpellId))),true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,WEAPO  N_TYPE_WHOKNOWS)
         call UnitAddAbility(datas.target,BuffSpellId)
         call IssueImmediateOrder(datas.target,BuffOrder)
         call UnitRemoveAbility(datas.target,BuffSpellId)
         call TerrainDeformationRippleXY(1,false,x,y,0,DeformationRange,90,0.5,200)
         call DestroyEffect(AddSpecialEffect(GroundHitGFXPath,x,y))
         call DestroyEffect(AddSpecialEffect(GroundNetGFXPath,x,y))
         call BugUse_AddFlyAbility(datas.target)
         call SetUnitFlyHeight(datas.target,GetUnitDefaultFlyHeight(datas.target),300)
         call DestroyEffect(datas.GFX)
         call DestroyLightning(datas.rope)
         call MNdat_Throw.destroy(datas)
         call FlushStoredMission(GC(),HS(t))
         call AB_DestroyTimer(t)
    endif
  endfunction

  private function MysticNet_Miss takes nothing returns nothing
    local timer t             =GetExpiredTimer()
    local MNdat_Throw datas   =GetStoredInteger(GC(),HS(t),"datas")

    if datas.distance>0 then
        set datas.ux=datas.ux+MissileSpeed*Cos(datas.angle*3.14159/180)
        set datas.uy=datas.uy+MissileSpeed*Sin(datas.angle*3.14159/180)
        set datas.distance=datas.distance-MissileSpeed
        call MoveLightningEx(datas.rope,true,datas.ux,datas.uy,datas.z,datas.x,datas.y,datas.  z)
        call DestroyEffect(datas.GFX)
        set datas.GFX=AddSpecialEffectTarget(MissGFXPath,datas.GFXdummy,MissGFXAttach)

        call TimerStart(t,Periodic,false,function MysticNet_Miss)
        set t=null
       else
        call DestroyEffect(datas.GFX)
        call RemoveUnit(datas.GFXdummy)
        call DestroyLightning(datas.rope)
        call MNdat_Throw.destroy(datas)
        call FlushStoredMission(GC(),HS(t))
        call AB_DestroyTimer(t)
    endif
  endfunction

  private function MysticNet_Collision takes nothing returns nothing
    local MNdat_Throw datas   =GetStoredInteger(GC(),Code,"datas")
    local unit u              =GetEnumUnit()
    if IsUnitNotImmun(datas.caster,u) then
       set datas.target=GetEnumUnit()
       set datas.hit=true
    endif
    set u=null
  endfunction

  private function MysticNet_MissileMotion takes nothing returns nothing
    local timer t             =GetExpiredTimer()
    local MNdat_Throw datas   =GetStoredInteger(GC(),HS(t),"datas")
    local real x              =GetUnitX(datas.caster)
    local real y              =GetUnitY(datas.caster)
    local real angle          =A2PXY(x,y,datas.ux,datas.uy)
    local real z
    local group g

    set datas.x=datas.x+MissileSpeed*Cos(angle*3.14159/180)
    set datas.y=datas.y+MissileSpeed*Sin(angle*3.14159/180)
    set datas.distance=D2PXY(datas.x,datas.y,x,y)
    set z=CreateZ(datas.x,datas.y)
    call MoveLightningEx(datas.rope,true,x,y,datas.z,datas.x,datas.y,datas.z)
    call BugUse_AddFlyAbility(datas.GFXdummy)
    call SetUnitFlyHeight(datas.GFXdummy,datas.z-z,0)
    call SetUnitX(datas.GFXdummy,datas.x)
    call SetUnitY(datas.GFXdummy,datas.y)
    call SetUnitFacing(datas.GFXdummy,angle)

    set g=GetUnitsInRange(MissileCollision,datas.x,datas.y,null,true)
    call StoreInteger(GC(),Code,"datas",datas)
    call ForGroup(g,function MysticNet_Collision)
    call FlushStoredMission(GC(),Code)
    call AB_DestroyGroup(g)

    if z>=datas.z or datas.distance>=MaxMissileDistance or not RectContainsCoords(MaxArea,datas.x,datas.y) or GetUnitState(datas.caster,UNIT_STATE_LIFE)<=0.00 or CountDestructableInRangeOfXY(datas.x,datas.y,MissileCollision)>0 then

         //Miss Init
         call DestroyEffect(datas.GFX)

         set datas.ux=x
         set datas.uy=y
         set datas.angle=A2PXY(x,y,datas.x,datas.y)
         set datas.GFX=AddSpecialEffectTarget(MissGFXPath,datas.GFXdummy,MissGFXAttach)

         call DestroyEffect(AddSpecialEffectTarget(ReactMissGFXPath,datas.caster,ReactMissGFXA  ttach))
         call BugUse_AddFlyAbility(datas.GFXdummy)
         call SetUnitFlyHeight(datas.GFXdummy,datas.z-z,0)
         call SetUnitX(datas.GFXdummy,datas.x)
         call SetUnitY(datas.GFXdummy,datas.y)

         call TimerStart(t,Periodic,false,function MysticNet_Miss)
       else
         if datas.hit then
           //Hit Init
           call RemoveUnit(datas.GFXdummy)
           call DestroyEffect(datas.GFX)

           set datas.temptime=0
           set datas.x=GetUnitX(datas.target)
           set datas.y=GetUnitY(datas.target)
           set datas.ux=x+StopTargetRange*Cos(angle*3.14159/180)
           set datas.uy=y+StopTargetRange*Sin(angle*3.14159/180)
           set datas.distance=D2PXY(datas.x,datas.y,datas.ux,datas.uy)
           set datas.endh=MaxFlyHeight(datas.distance)
           set datas.GFX=AddSpecialEffectTarget(HitGFXPath,datas.target,HitGFXAttach)

           call DestroyEffect(AddSpecialEffectTarget(ReactHitGFXPath,datas.caster,ReactHitGFXAtt  ach))
           call SetUnitPathing(datas.target,false)
           call TimerStart(t,0,false,function MysticNet_Hit)
         else
         //loop
           call TimerStart(t,Periodic,false,function MysticNet_MissileMotion)
         endif
    endif
    set t=null   
  endfunction

  private function Trig_Mystic_Net_Actions takes nothing returns nothing
    local timer t             =CreateTimer()
    local unit caster         =GetTriggerUnit()
    local real x              =GetUnitX(caster)
    local real y              =GetUnitY(caster)
    local location loc        =GetSpellTargetLoc()
    local real lx             =GetLocationX(loc)
    local real ly             =GetLocationY(loc)
    local MNdat_Throw datas   =MNdat_Throw.create()
    local real z              =CreateZ(x,y)
    
    set datas.hit=false
    set datas.x=x
    set datas.y=y
    set datas.ux=lx
    set datas.uy=ly
    set datas.z=MissileFlyHeight+CreateZ(x,y)
    set datas.distance=0
    set datas.caster=caster
    set datas.target=null
    set datas.rope=AddLightningEx(LightningType,true,x,y,datas.z,x,y,datas.z)
    set datas.GFXdummy=CreateUnit(Player(14),DummyId,x,y,A2PXY(x,y,lx,ly))
    set datas.GFX=AddSpecialEffectTarget(MissileGFXPath,datas.GFXdummy,MissileGFXAttach)  
    call BugUse_AddFlyAbility(datas.GFXdummy)
    call SetUnitFlyHeight(datas.GFXdummy,datas.z-z,0)
    call SetUnitX(datas.GFXdummy,x)
    call SetUnitY(datas.GFXdummy,y)

    call TimerStart(t,0,false,function MysticNet_MissileMotion)
    call StoreInteger(GC(),HS(t),"datas",datas)

    call RemoveLocation(loc)
    set t=null  
  endfunction

//===========================================================================
function InitTrig_Mystic_Net takes nothing returns nothing
    set gg_trg_Mystic_Net = CreateTrigger(  )
    set MaxArea=bj_mapInitialPlayableArea
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Mystic_Net, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Mystic_Net, Condition( function Trig_Mystic_Net_Conditions ) )
    call TriggerAddAction( gg_trg_Mystic_Net, function Trig_Mystic_Net_Actions )
endfunction
endscope

а вот штука которую автор сказал вставить в самый верхний триггер (нестандартный код)
» код
Код:
function H2I takes handle h returns integer
return h
return 0
endfunction

function I2T takes integer i returns trigger
return i
return null
endfunction

function I2F takes integer i returns fogmodifier
return i
return null
endfunction

function I2Bo takes integer i returns boolexpr
return i
return null
endfunction

function I2G takes integer i returns group
return i
return null
endfunction

function I2Tx takes integer i returns texttag
return i
return null
endfunction

function I2U takes integer i returns unit
return i
return null
endfunction

function I2E takes integer i returns effect
    return i
    return null
endfunction

function I2L takes integer i returns location
    return i
    return null
endfunction

function I2It takes integer i returns item
    return i
    return null
endfunction

function I2Li takes integer i returns lightning
return i
return null
endfunction

function I2B takes integer i returns button
    return i
    return null
endfunction

function I2Ti takes integer i returns timer
    return i
    return null
endfunction

globals
     gamecache cache=InitGameCache("cache")
     unit tu=null
     unit tc=null
     unit tm=null
     unit tv=null
endglobals

//================================================================================  ========================
//Main Functions

function GC takes nothing returns gamecache
    return cache
endfunction

function CalculateMaxMotionTime takes real distance,real speed,real periodictime returns real
    return distance/speed*periodictime
endfunction

function HS takes handle i returns string
    return I2S(H2I(i))
endfunction

function AB_DestroyTrigger takes trigger trig returns nothing
  if trig!=null then
    call TriggerClearActions(trig)
    call TriggerClearConditions(trig)
    call DestroyTrigger(trig)
  endif
endfunction

function AB_DestroyTimer takes timer t returns nothing
  if t!=null then
     call PauseTimer(t)
     call DestroyTimer(t)
  endif
endfunction

function AB_DestroyGroup takes group g returns nothing
  if g!=null then
     call GroupClear(g)
     call DestroyGroup(g)
  endif
endfunction

function AB_DialogDestroy takes dialog log returns nothing
  if log!=null then
     call DialogClear(log)
     call DialogDestroy(log)
  endif
endfunction

function AB_DestroyMultiboard takes multiboard lb returns nothing
  if lb!=null then
     call MultiboardClear(lb)
     call DestroyMultiboard(lb)
  endif
endfunction

function U2Death takes nothing returns nothing
local timer t = GetExpiredTimer()
call RemoveUnit(I2U(GetStoredInteger(GC(),I2S(H2I(t)),"u")))
call FlushStoredMission(GC(),I2S(H2I(t)))
call AB_DestroyTimer(t)
endfunction

function U2Null takes unit u,real duration returns nothing
local timer t = CreateTimer()
call TimerStart(t,duration,false,function U2Death)
call StoreInteger(GC(),I2S(H2I(t)),"u",H2I(u))
set t = null
endfunction

function T2Death takes nothing returns nothing
local timer t = GetExpiredTimer()
if I2T(GetStoredInteger(GC(),I2S(H2I(t)),"t"))!=null then
call DestroyTrigger(I2T(GetStoredInteger(GC(),I2S(H2I(t)),"t")))
endif
call FlushStoredMission(GC(),I2S(H2I(t)))
call AB_DestroyTimer(t)
endfunction

function T2Null takes trigger tt,real duration returns nothing
local timer t = CreateTimer()
call TimerStart(t,duration,false,function T2Death)
call StoreInteger(GC(),I2S(H2I(t)),"t",H2I(tt))
set t = null
endfunction

function E2Death takes nothing returns nothing
local timer t = GetExpiredTimer()
call DestroyEffect(I2E(GetStoredInteger(GC(),I2S(H2I(t)),"e")))
call FlushStoredMission(GC(),I2S(H2I(t)))
call AB_DestroyTimer(t)
endfunction

function E2Null takes effect e,real duration returns nothing
local timer t = CreateTimer()
call TimerStart(t,duration,false,function E2Death)
call StoreInteger(GC(),I2S(H2I(t)),"e",H2I(e))
set t = null
endfunction

function L2Death takes nothing returns nothing
local timer t = GetExpiredTimer()
call DestroyLightning(I2Li(GetStoredInteger(GC(),I2S(H2I(t)),"l")))
call FlushStoredMission(GC(),I2S(H2I(t)))
call AB_DestroyTimer(t)
endfunction

function L2Null takes lightning l,real duration returns nothing
local timer t = CreateTimer()
call TimerStart(t,duration,false,function L2Death)
call StoreInteger(GC(),I2S(H2I(t)),"l",H2I(l))
set t = null
endfunction

function TT2Death takes nothing returns nothing
local timer t = GetExpiredTimer()
call DestroyTextTag(I2Tx(GetStoredInteger(GC(),I2S(H2I(t)),"tt")))
call FlushStoredMission(GC(),I2S(H2I(t)))
call AB_DestroyTimer(t)
endfunction

function TT2Null takes texttag tt,real duration returns nothing
local timer t = CreateTimer()
call TimerStart(t,duration,false,function L2Death)
call StoreInteger(GC(),I2S(H2I(t)),"tt",H2I(tt))
set t = null
endfunction

function VUnitPolarXY takes unit u,real distance,real angle returns nothing
    local real x=GetUnitX(u)+distance*Cos(angle*3.14159/180)
    local real y=GetUnitY(u)+distance*Sin(angle*3.14159/180)
    if RectContainsCoords(bj_mapInitialPlayableArea,x,y) then
    call SetUnitX(u,x)
    call SetUnitY(u,y)
    endif
endfunction

function SUnitPolarXY takes unit u,real distance,real angle returns nothing
    local real x=GetUnitX(u)+distance*Cos(angle*3.14159/180)
    local real y=GetUnitY(u)+distance*Sin(angle*3.14159/180)
    if RectContainsCoords(bj_mapInitialPlayableArea,x,y) then
    call SetUnitPosition(u,x,y)
    endif
endfunction

function GetUnitPolX takes unit u,real distance,real angle returns real
    local real x=GetUnitX(u)+distance*Cos(angle*3.14159/180)
    return x
endfunction

function GetPolX takes real x,real distance,real angle returns real
    return x+distance*Cos(angle*3.14159/180)
endfunction

function GetUnitPolY takes unit u,real distance,real angle returns real
    local real y=GetUnitY(u)+distance*Sin(angle*3.14159/180)
    return y
endfunction

function GetPolY takes real y,real distance,real angle returns real
    return y+distance*Sin(angle*3.14159/180)
endfunction

function GetTime2Distance takes real distance,real speed,real periodictime returns real
    return distance/speed*periodictime
endfunction

function D2PXY takes real xA,real yA,real xB,real yB returns real
    local real dx = xB - xA
    local real dy = yB - yA
    return SquareRoot(dx * dx + dy * dy)
endfunction

function TerrainDeformationRippleXY takes real duration, boolean limitNeg, real x,real y, real startRadius, real endRadius, real depth, real wavePeriod, real waveWidth returns terraindeformation
    local real spaceWave
    local real timeWave
    local real radiusRatio

    if (endRadius <= 0 or waveWidth <= 0 or wavePeriod <= 0) then
        return null
    endif

    set timeWave = 2.0 * duration / wavePeriod
    set spaceWave = 2.0 * endRadius / waveWidth
    set radiusRatio = startRadius / endRadius

    set bj_lastCreatedTerrainDeformation = TerrainDeformRipple(x,y, endRadius, depth, R2I(duration * 1000), 1, spaceWave, timeWave, radiusRatio, limitNeg)
    return bj_lastCreatedTerrainDeformation
endfunction

function GetFlyParabelEx takes real x1,real y1,real z,real maxtime,real temptime,real maxheight,real speed,real x2,real y2,real x3,real y3 returns real
    local real tdist = D2PXY(x1,y1,x2,y2) / maxtime * speed
    local location l1 = Location(x1,y1)
    local real z1
    local real z2
    local real zxy
    set z1 = GetLocationZ(l1)+z
    call MoveLocation(l1,x2,y2)
    set z2 = GetLocationZ(l1)
    call MoveLocation(l1,x3,y3)
    set zxy = (GetLocationZ(l1)-z1) / D2PXY(x1,y1,x3,y3)
    call RemoveLocation(l1)
    return maxheight - maxheight / maxtime / maxtime * 4 * (temptime-maxtime/2) * (temptime-maxtime/2) + temptime / speed * tdist * zxy + z1 - z2
endfunction

function CreateTextTagXY takes string s,real x,real y,real zOffset,real size,real red,real green,real blue,real transparency returns texttag
    set bj_lastCreatedTextTag=CreateTextTag()
    call SetTextTagText(bj_lastCreatedTextTag,s,size*0.023/10)
    call SetTextTagPos(bj_lastCreatedTextTag,x,y,zOffset)
    call SetTextTagColor(bj_lastCreatedTextTag,PercentTo255(red), PercentTo255(green), PercentTo255(blue), PercentTo255(100.0-transparency))
    return bj_lastCreatedTextTag
endfunction

function CreateZ takes real x,real y returns real
  local location o = Location(x,y)
  local real z = GetLocationZ(o)
  call RemoveLocation(o)
  return z
endfunction

function GetUnitsInRange takes real radius,real x,real y,boolexpr filter,boolean wantdestroy returns group
    local group g = CreateGroup()
    call GroupEnumUnitsInRange(g,x,y,radius,filter)
    if wantdestroy then
    call DestroyBoolExpr(filter)
    endif
    set filter=null
    return g
endfunction

function A2PXY takes real xA,real yA,real xB,real yB returns real
    return bj_RADTODEG * Atan2(yB - yA, xB - xA)
endfunction

scope CountDestructable
  globals
     private rect dat_prove=null
  endglobals

  private function CountDestructableInRange_Rect takes nothing returns rect
    if dat_prove==null then
        set dat_prove=Rect(0,0,0,0)
    endif
  return dat_prove
  endfunction

  private function EnumCountDestructables takes nothing returns nothing
    if GetDestructableLife(GetEnumDestructable())>0 then
        set bj_forLoopAIndex=bj_forLoopAIndex+1
    endif
  endfunction

  function CountDestructableInRangeOfXY takes real x,real y,real range returns integer
    call SetRect(CountDestructableInRange_Rect(),x-range,y-range,x+range,y+range)
    set bj_forLoopAIndex=0
    call EnumDestructablesInRect(CountDestructableInRange_Rect(),null,function EnumCountDestructables)
    return bj_forLoopAIndex
  endfunction
endscope

function IsUnitNotImmun takes unit c,unit u returns boolean
    if c!=u and not IsUnitType(u,UNIT_TYPE_STRUCTURE) and not IsUnitType(u,UNIT_TYPE_MAGIC_IMMUNE) and IsUnitEnemy(u, GetOwningPlayer(c)) and GetUnitState(u,UNIT_STATE_LIFE) > 0.00 then
        return true
    endif
return false
endfunction

constant function BugUse_FlyAbility takes nothing returns integer
    return 'Amrf'
endfunction

function BugUse_AddFlyAbility takes unit u returns nothing
    call UnitAddAbility(u,BugUse_FlyAbility())
    call UnitRemoveAbility(u,BugUse_FlyAbility())
endfunction

//================================================================================  ================
//Passiv - Damage Skill
//================================================================================  ================
scope DamageSkill
private struct DSDat
    trigger GetDamage
    trigger GetOrder
    unit attacker
    timer t
endstruct

private function DamageTrig_Conds takes nothing returns boolean
    local DSDat datas        =GetStoredInteger(GC(),HS(GetTriggeringTrigger()),"datas")
    return GetEventDamageSource()==datas.attacker
endfunction

function DestroyDamageTrig_Vars takes trigger tt returns nothing
    local DSDat datas       =GetStoredInteger(GC(),HS(tt),"datas")

    call FlushStoredMission(GC(),HS(datas.GetDamage))
    call FlushStoredMission(GC(),HS(datas.GetOrder))
    call FlushStoredMission(GC(),HS(datas.t))

    call AB_DestroyTrigger(datas.GetDamage)
    call AB_DestroyTrigger(datas.GetOrder)
    call AB_DestroyTimer(datas.t)

    call DSDat.destroy(datas)
endfunction

private function TimerDestroy_DamageTrigger takes nothing returns nothing
    local DSDat datas       =GetStoredInteger(GC(),HS(GetExpiredTimer()),"datas")

    call FlushStoredMission(GC(),HS(datas.GetDamage))
    call FlushStoredMission(GC(),HS(datas.GetOrder))
    call FlushStoredMission(GC(),HS(datas.t))

    call AB_DestroyTrigger(datas.GetDamage)
    call AB_DestroyTrigger(datas.GetOrder)
    call AB_DestroyTimer(datas.t)

    call DSDat.destroy(datas)
endfunction

private function TriggerDestroy_DamageTrigger takes nothing returns nothing
    local DSDat datas       =GetStoredInteger(GC(),HS(GetTriggeringTrigger()),"datas")

    call FlushStoredMission(GC(),HS(datas.GetDamage))
    call FlushStoredMission(GC(),HS(datas.GetOrder))
    call FlushStoredMission(GC(),HS(datas.t))

    call AB_DestroyTrigger(datas.GetDamage)
    call AB_DestroyTrigger(datas.GetOrder)
    call AB_DestroyTimer(datas.t)

    call DSDat.destroy(datas)
endfunction

function Add_DamageTrigger takes unit attacked,real duration,unit attacker,code func returns nothing
    local DSDat datas        =DSDat.create()

    //Init
    set datas.GetDamage=CreateTrigger()
    set datas.GetOrder=CreateTrigger()
    set datas.t=CreateTimer()
    set datas.attacker=attacker

    //Storing
    call StoreInteger(GC(),HS(datas.GetDamage),"datas",datas)
    call StoreInteger(GC(),HS(datas.GetOrder),"datas",datas)
    call StoreInteger(GC(),HS(datas.t),"datas",datas)

    //Trigger Settings
    call TriggerAddAction(datas.GetDamage,func)
    call TriggerAddCondition(datas.GetDamage,Condition(function DamageTrig_Conds))
    call TriggerRegisterUnitEvent(datas.GetDamage,attacked,EVENT_UNIT_DAMAGED)

    call TriggerAddAction(datas.GetOrder,function TriggerDestroy_DamageTrigger)
    call TriggerRegisterUnitEvent(datas.GetOrder,attacker, EVENT_UNIT_ISSUED_ORDER )

    //Timer Start
    call TimerStart(datas.t,duration,false,function TimerDestroy_DamageTrigger)
endfunction
endscope

//Motion System
scope MotionSystem
globals
   trigger motionsystem=null
   group motiongroup=null
   private constant string code="EnumAddTo_CollisionMissileGroup"
   private constant real MinChaseRange=10.00
   private constant real MovementPerOfMissile=0.03
endglobals

private struct MotionDatas
   real x1
   real y1
   real x3
   real y3
   real endh
   real begh
   real speed
   real tt
   real h
   real range
   real Zrate
   
   unit target
   unit attacker
   
   string endfunc
   integer mode
endstruct

private function EnumAddTo_CollisionMissileGroup takes nothing returns nothing
    local unit caster=tc
    local unit u=GetEnumUnit()
    local group g    =I2G(GetStoredInteger(GC(),code,"group"))
      if IsUnitNotImmun(caster,u) and tu!=u then
         call GroupAddUnit(g,u)
      endif
    set g=null
    set caster=null
    set u=null
endfunction

function RemoveUnitFromMissileGroup takes unit u returns nothing
    if IsUnitInGroup(u,motiongroup) then
     call GroupRemoveUnit(motiongroup,u)
       if CountUnitsInGroup(motiongroup)<=0 then
        call AB_DestroyGroup(motiongroup)
        call AB_DestroyTrigger(motionsystem)
        set motionsystem=null
       endif
    endif
endfunction

function EnumObjects_Motion takes nothing returns nothing
    local unit u          =GetEnumUnit()
    local MotionDatas MD  =GetStoredInteger(GC(),"MD"+HS(u),"MotionDatas")
    local real distance   =D2PXY(MD.x1,MD.y1,MD.x3,MD.y3)
    local real angle      =A2PXY(MD.x1,MD.y1,MD.x3,MD.y3)
    local real curv
    local group coll
    
    set MD.tt=MD.tt+MovementPerOfMissile
    
    if MD.mode==1 then
        if MD.tt<distance/MD.speed*MovementPerOfMissile then
            call VUnitPolarXY(u,MD.speed,angle)
              if MD.begh!=MD.endh then
                set curv=GetFlyParabelEx(MD.x1,MD.y1,MD.begh,distance/MD.speed*MovementPerOfMissile,MD.tt,MD.endh,MD.speed,GetUnitX(u),GetUnitY(u),MD.  x3,MD.y3)
              else
                set curv=MD.begh
              endif
        call BugUse_AddFlyAbility(u)
        call SetUnitFlyHeight(u,curv,0)
       else
        call RemoveUnitFromMissileGroup(u)
        call MotionDatas.destroy(MD)
        call FlushStoredMission(GC(),"MD"+HS(u))
       endif
    endif

    if MD.mode==2 then
        set distance=D2PXY(GetUnitX(u),GetUnitY(u),GetUnitX(MD.target),GetUnitY(MD.target))
        
        if distance>MinChaseRange and GetUnitState(u,UNIT_STATE_LIFE) > 0.00 then
           set angle   =A2PXY(GetUnitX(u),GetUnitY(u),GetUnitX(MD.target),GetUnitY(MD.target))
           call VUnitPolarXY(u,MD.speed,angle)
           call BugUse_AddFlyAbility(u)
           call SetUnitFlyHeight(u,MD.h,MD.Zrate)
        else
         call FlushStoredMission(GC(),"MD"+HS(u))
          if MD.endfunc!="" then
              set tv=MD.target
              set tm=u
              set tc=MD.attacker
              call ExecuteFunc(MD.endfunc)
          endif
         call RemoveUnitFromMissileGroup(u)
        call MotionDatas.destroy(MD)
       endif
    endif

    if MD.mode==3 then
         set tu=GetEnumUnit()
         call StoreInteger(GC(),code,"group",H2I(CreateGroup()))
         set tc=MD.attacker
         set coll=GetUnitsInRange(MD.range,GetUnitX(u),GetUnitY(u),null,true)
         call ForGroup(coll,function EnumAddTo_CollisionMissileGroup)
         call AB_DestroyGroup(coll)
         set coll=I2G(GetStoredInteger(GC(),code,"group"))
         call FlushStoredMission(GC(),code)
             if MD.tt<distance/MD.speed*MovementPerOfMissile and CountUnitsInGroup(coll)<=0 then
                 call VUnitPolarXY(u,MD.speed,angle)
                 call BugUse_AddFlyAbility(u)
                 call SetUnitFlyHeight(u,MD.h,0)
             else
               call FlushStoredMission(GC(),"MD"+HS(u))
                 if MD.endfunc!="" then
                     set tm=GetEnumUnit()
                     set tc=MD.attacker
                     call ExecuteFunc(MD.endfunc)
                 endif
               call RemoveUnitFromMissileGroup(u) 
               call MotionDatas.destroy(MD)
             endif
          call AB_DestroyGroup(coll)
     endif

  set u=null
endfunction

function MotionSystem takes nothing returns nothing
   if CountUnitsInGroup(motiongroup)>0 then
    call ForGroup(motiongroup,function EnumObjects_Motion)
   endif
endfunction

function AddUnitToMissileGroup takes unit u returns nothing
    if not IsUnitInGroup(u,motiongroup) then
         if motionsystem==null then
           set motiongroup=CreateGroup()
           set motionsystem=CreateTrigger()
           call TriggerRegisterTimerEventPeriodic( motionsystem, MovementPerOfMissile )
           call TriggerAddAction( motionsystem, function MotionSystem )
     endif
     call GroupAddUnit(motiongroup,u)
    endif    
endfunction

function LaunchMissileAtPointEx takes unit u,real x1,real y1,real begh,real endh,real x3,real y3,real speed returns nothing
    local MotionDatas MD  =MotionDatas.create()
    
    set MD.tt        =0
    set MD.begh      =begh
    set MD.endh      =endh
    set MD.x1        =x1
    set MD.y1        =y1
    set MD.x3        =x3
    set MD.y3        =y3
    set MD.speed     =speed
    set MD.mode      =1
    
    call SetUnitPosition(u,x1,y1)
    call AddUnitToMissileGroup(u)
    call StoreInteger(GC(),"MD"+HS(u),"MotionDatas",MD)
endfunction

function LaunchNormalChaseMissileAtPointEx takes unit attacker,unit missile,real x1,real y1,real h,unit victim,real speed,real Zrate,string colfunc returns nothing
    local MotionDatas MD  =MotionDatas.create()
    
    set MD.tt        =0
    set MD.h         =h
    set MD.attacker  =attacker
    set MD.target    =victim
    set MD.speed     =speed
    set MD.endfunc   =colfunc
    set MD.mode      =2
    set MD.Zrate      =Zrate
    
    call SetUnitPosition(missile,x1,y1)
    call AddUnitToMissileGroup(missile)
    call StoreInteger(GC(),"MD"+HS(missile),"MotionDatas",MD)
endfunction

function LaunchNormalCollisionMissileAtPointEx takes unit attacker,unit missile,real x1,real y1,real h,real x3,real y3,real speed,real range,string colfunc returns nothing
    local MotionDatas MD  =MotionDatas.create()
    
    set MD.tt         =0
    set MD.attacker   =attacker
    set MD.h          =h
    set MD.x1         =x1
    set MD.y1         =y1
    set MD.x3         =x3
    set MD.y3         =y3
    set MD.range      =range
    set MD.speed      =speed
    set MD.endfunc    =colfunc
    set MD.mode       =3
    
    call SetUnitPosition(missile,x1,y1)
    call AddUnitToMissileGroup(missile)
    call StoreInteger(GC(),"MD"+HS(missile),"MotionDatas",MD)
endfunction
endscope


вот при использовании этих скриптов в мапе при игноре проверки синтаксиса ВЕ
мапа просто напросто ломается.. её нельзя запустить невозможно выбрать игроков и т.д...

как решить?

sleepw добавил:
при сохранении тех же скриптов в скачаной мапе такая же история.. сохраняю через NewGen WE с настройками Grimoire - Disable We syntax cheker

зы. рабочая мапа скачаная весит 91кб.. при сохранении мною она весит 87кб.. я так понял там шото пропадает.. но что?:(

Отредактировано sleepw, 27.12.2007 в 20:35.
Старый 27.12.2007, 20:30
df Hunter
Нападатель
offline
Опыт: 5,749
Активность:
в теме рядом я тебе писал ответ )
Старый 27.12.2007, 20:30
sleepw

offline
Опыт: 8,449
Активность:
ну так вот.. тогда просто нехотело сохранять изза синтаксиса.. а теперь просто пропускает синтаксис и ломает мапу.

sleepw добавил:
омг сори мну за тупость...
решилось после того как я поставил галочку возле Enable Jasshelper..=\
Старый 27.12.2007, 20:43
Ответ

Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск

Ваши права в разделе
Вы не можете создавать темы
Вы не можете отвечать на сообщения
Вы не можете прикреплять файлы
Вы можете скачивать файлы

BB-коды Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход



Часовой пояс GMT +3, время: 21:38.