• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Broken magic in 1.24

Status
Not open for further replies.
Level 9
Joined
Apr 28, 2006
Messages
187
Hey fellas, seems 1.24 breaks spells that rely on GUI game caches, despite reading some hashtable tutorials and understanding the basic principles, problem is the recoding of the jass that already exists, any help on this?

In custom script:
JASS:
function Cache takes nothing returns gamecache
   if (udg_cache==null) then
      set udg_cache=InitGameCache("cache")
   endif
      return udg_cache
endfunction

function HandToInt takes handle h returns integer
   return h
   return 0
endfunction

function StoreHandle takes handle m_key, handle stored, string key returns nothing
   call StoreInteger(Cache(),I2S(HandToInt( m_key )),key,HandToInt(stored))
endfunction

function RetrieveUnit takes handle m_key,string key returns unit
   return GetStoredInteger(Cache(),I2S(HandToInt( m_key )),key)
   return null
endfunction

function RetrieveInt takes handle m_key,string key returns integer
   return GetStoredInteger(Cache(),I2S(HandToInt( m_key )),key)
endfunction

function RetrieveGroup takes handle m_key,string key returns group
   return GetStoredInteger(Cache(),I2S(HandToInt( m_key )),key)
   return null
endfunction

function Flush takes handle m_key returns nothing
   call FlushStoredMission(Cache(),I2S(HandToInt( m_key )))
endfunction
***

Spell 1:

***
JASS:
function RawPSSJ takes nothing returns integer
    return 'A07G' //Raw code for Pounce
endfunction

//=================================================================================
//Configuration

function ss_pounceconstant takes nothing returns real
    return 7.00 //Set this real number higher to get faster speed, and lower to get slower speed
endfunction

//=================================================================================

function Trig_Pounce_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == RawPSSJ()
endfunction

function PounceSS takes nothing returns nothing
    local unit spell_pouncecaster = RetrieveUnit(GetExpiredTimer(), "spell_pouncecaster")
    local real spell_pouncess_const = GetStoredReal(Cache(),I2S(HandToInt(GetExpiredTimer())),"spell_pouncess_const")
    local real spell_pouncefaceangle = GetStoredReal(Cache(),I2S(HandToInt(GetExpiredTimer())),"spell_pouncefaceangle")
    local location pouncecastloc = GetUnitLoc(spell_pouncecaster)
    local location pouncepolarproj = PolarProjectionBJ(pouncecastloc, ( spell_pouncess_const * 5.00 ), ( spell_pouncefaceangle + 180.00 )) //else goes backwards
    local effect spell_pouncedusteffect 

    call SetUnitPositionLocFacingBJ( spell_pouncecaster, pouncepolarproj, ( spell_pouncefaceangle - 180.00 ) )
    set spell_pouncedusteffect = AddSpecialEffectTarget("Abilities\\Weapons\\AncientProtectorMissile\\AncientProtectorMissile.mdl",spell_pouncecaster,"origin")
    call DestroyEffectBJ( spell_pouncedusteffect )
    call RemoveLocation(pouncecastloc)
    call RemoveLocation(pouncepolarproj)
    set spell_pouncecaster = null
    set pouncecastloc = null
    set pouncepolarproj = null
    set spell_pouncedusteffect = null 
endfunction

function Trig_Pounce_Actions takes nothing returns nothing
    local real spell_pouncess_const = ss_pounceconstant()
    local unit spell_pouncecaster = GetTriggerUnit()
    local location pouncecastloc = GetUnitLoc(spell_pouncecaster)
    local location spell_pouncetarget = GetUnitLoc(GetSpellTargetUnit())
    local real spell_pouncefaceangle = AngleBetweenPoints(pouncecastloc, spell_pouncetarget) + 180.00 
    local real spell_distancepounce = DistanceBetweenPoints(pouncecastloc, spell_pouncetarget)
    local timer spell_pouncetimer = CreateTimer()    

    if ( spell_distancepounce > 500 ) then
        set spell_distancepounce = 500
    endif
//    call SetUnitPathing( spell_pouncecaster, false ) //collision off
//    call UnitAddAbility(spell_pouncecaster, RawEvade())
    call SetUnitAnimation( spell_pouncecaster, "ready" )
    call StoreHandle(spell_pouncetimer, spell_pouncecaster, "spell_pouncecaster")
    call StoreReal(Cache(),I2S(HandToInt( spell_pouncetimer )),"spell_pouncess_const",spell_pouncess_const)
    call StoreReal(Cache(),I2S(HandToInt( spell_pouncetimer )),"spell_pouncefaceangle",spell_pouncefaceangle) 
    call TimerStart(spell_pouncetimer, 0.03, true, function PounceSS)
 
    call TriggerSleepAction( ( spell_distancepounce / ( spell_pouncess_const * 200.00 ) ) )

//    call UnitRemoveAbility( spell_pouncecaster, RawEvade())
    call ResetUnitAnimation( spell_pouncecaster )
//    call SetUnitPathing( spell_pouncecaster, true ) //collision on
    call Flush(spell_pouncetimer)
    call DestroyTimer(spell_pouncetimer)
    call RemoveLocation(pouncecastloc)
    call RemoveLocation(spell_pouncetarget)
    set pouncecastloc = null
    set spell_pouncetarget = null
    set spell_pouncecaster = null
    set spell_pouncetimer = null

endfunction

//===========================================================================
function InitTrig_Pounce_JASS takes nothing returns nothing
    set gg_trg_Pounce_JASS = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Pounce_JASS, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Pounce_JASS, Condition( function Trig_Pounce_Conditions ) )
    call TriggerAddAction( gg_trg_Pounce_JASS, function Trig_Pounce_Actions )
endfunction
***

Spell 2:
***
JASS:
//---------------------------------------------------------------------------------------

function getOmniDrain_Abilcode takes nothing returns integer
    return 'A01A'   //The ability code for the Omni Drain spell.
endfunction

function getOmniDrain_caster takes nothing returns integer
    return 'h00H'   //The unit code for the dummy caster.
endfunction

function getOmniDrain_buff takes nothing returns integer
    return 'B00N'   //The buff code for the buff Drain Life (target - no fx).
endfunction

function getOmniDrain_DummyLightningFX_Abilcode takes nothing returns integer
    return 'A01B'   //The ability code for the dummy Multi Drain (lightning fx) spell
endfunction 

function getOmniDrain_DummyCheck_Abilcode takes nothing returns integer
    return 'A01C'   //The ability code for the dummy Multi Drain (forked check) spell
endfunction

function getOmniDrain_CapTargets takes nothing returns integer
    return 2+GetUnitAbilityLevelSwapped(getOmniDrain_Abilcode(), GetTriggerUnit())
                    //Formula for maximum # of targets per level
endfunction            

function GetOmniDrain_dmgReturnFactor takes nothing returns real
    return 0.5      //Damage return as a factor of the life drained
endfunction

//---------------------------------------------------------------------------------------

function CastAbility takes integer abil, integer level, string order, unit caster, unit target, location loc, real h returns nothing
    call CreateNUnitsAtLoc(1,getOmniDrain_caster(), GetOwningPlayer(caster), loc,bj_UNIT_FACING)
    call SetUnitPathing( GetLastCreatedUnit(), false )
    call SetUnitPositionLoc( GetLastCreatedUnit(), loc )
    if h > 20 then 
    call SetUnitFlyHeightBJ( GetLastCreatedUnit(), h, 10000.00 )
    endif
    call UnitAddAbilityBJ( abil, GetLastCreatedUnit() )
    call SetUnitAbilityLevelSwapped( abil, GetLastCreatedUnit(), level )
    call UnitApplyTimedLifeBJ( 1.00, 'BTLF', GetLastCreatedUnit() )
    call IssueTargetOrderBJ( GetLastCreatedUnit(), order, target )
endfunction

function GameCache2Trigger takes gamecache g returns trigger
    return g
    return null
endfunction

function H2I takes handle h returns integer
    return h
    return 0
endfunction

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

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

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

function Trig_MultiDrain_InitConditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == getOmniDrain_Abilcode() ) ) then
        return false
    endif
    return true
endfunction

function GetMultiDrainGameCache takes nothing returns gamecache
    return gg_trg_MultiDrain
    return null
endfunction

function Trig_MultiDrain_RemoveCasters takes nothing returns nothing
    call RemoveUnit(GetEnumUnit())
endfunction

function Trig_MultiDrain_TargetDmgCondition takes nothing returns boolean
    local gamecache g    = GetMultiDrainGameCache()
    local unit dummy = I2U(GetStoredInteger(g, "dummy", I2S(H2I(GetTriggeringTrigger()))))
    return ( GetEventDamageSource() == dummy )
endfunction

function Trig_MultiDrain_TargetDmgActions takes nothing returns nothing
    local gamecache g = GetMultiDrainGameCache()
    local unit caster = I2U(GetStoredInteger(g, "caster", I2S(H2I(GetTriggeringTrigger()))))
    call SetUnitLifeBJ( caster, ( GetUnitStateSwap(UNIT_STATE_LIFE, caster) + GetEventDamage()*GetOmniDrain_dmgReturnFactor() ) )
endfunction

function Trig_MultiDrain_DmgEvent_Child takes nothing returns nothing
    local gamecache g = GetMultiDrainGameCache()
    local unit caster = GetTriggerUnit()
    local trigger t = I2T(GetStoredInteger(g,"t",I2S(H2I(caster))))
    local trigger u = CreateTrigger()
    local real dmg = GetStoredReal(g,"dmg",I2S(H2I(t)))
    local integer spell = GetStoredInteger(g,"spell",I2S(H2I(t)))
    local location loc = GetUnitLoc(caster)
    local group dummycasters = I2G(GetStoredInteger(g, "dummycasters", I2S(H2I(t))))
    local unit target = GetEnumUnit()
    local unit dummy
    
    call CreateNUnitsAtLoc(1,getOmniDrain_caster(), GetOwningPlayer(caster), loc,bj_UNIT_FACING)
    call UnitAddAbilityBJ( getOmniDrain_DummyLightningFX_Abilcode(), GetLastCreatedUnit() )
    call SetUnitAbilityLevelSwapped(getOmniDrain_DummyLightningFX_Abilcode(),GetLastCreatedUnit(),GetUnitAbilityLevelSwapped(getOmniDrain_Abilcode(),caster))
    call UnitApplyTimedLifeBJ( 10.00, 'BTLF', GetLastCreatedUnit() )
    call SetUnitPathing( GetLastCreatedUnit(), false )
    call SetUnitPositionLoc( GetLastCreatedUnit(), loc )
    call IssueTargetOrderBJ( GetLastCreatedUnit(), "drain", target )
    set dummy = GetLastCreatedUnit()
    call StoreIntegerBJ( H2I(dummy), I2S(H2I(u)), "dummy", g )
    call StoreIntegerBJ( H2I(caster), I2S(H2I(u)), "caster", g )
    call GroupAddUnitSimple(dummy,dummycasters)
    call TriggerRegisterUnitEvent( u, target, EVENT_UNIT_DAMAGED )
    call TriggerAddCondition( u, Condition(function Trig_MultiDrain_TargetDmgCondition) )
    call TriggerAddAction( u, function Trig_MultiDrain_TargetDmgActions )
    call PolledWait(0.5)
    
    loop
    call TriggerSleepAction( 0.1 )
    exitwhen UnitHasBuffBJ( dummy, getOmniDrain_buff() ) == false
       
    endloop
    call GroupRemoveUnitSimple(dummy,dummycasters)
    call FlushStoredInteger(g,"dummy", I2S(H2I(u)))
    call FlushStoredInteger(g,"caster", I2S(H2I(u)))
    call DestroyTrigger(u)
    call RemoveLocation(loc)
    set loc = null
endfunction

function Trig_MultiDrain_DmgEvent takes nothing returns nothing
    call ExecuteFunc("Trig_MultiDrain_DmgEvent_Child")
endfunction

function Trig_MultiDrain_AddEvent takes nothing returns nothing
    local gamecache g = GetMultiDrainGameCache()
    local trigger t = I2T(GetStoredInteger(g,"t",I2S(H2I(GetTriggerUnit()))))
    call TriggerRegisterUnitEvent( t, GetEnumUnit(), EVENT_UNIT_DAMAGED )
endfunction

function Trig_MultiDrain_AddGroupCondition takes nothing returns boolean
    local gamecache g    = GetMultiDrainGameCache()
    local unit dummycaster = I2U(GetStoredInteger(g, "dummycaster", I2S(H2I(GetTriggeringTrigger()))))
    return ( GetEventDamageSource() == dummycaster )
    //set g = null
endfunction

function Trig_MultiDrain_AddGroupActions takes nothing returns nothing
    local gamecache g    = GetMultiDrainGameCache()
    local group targets = I2G(GetStoredInteger(g, "targets", I2S(H2I(GetTriggeringTrigger()))))
    call GroupAddUnitSimple(GetTriggerUnit(), targets)
endfunction

function Trig_MultiDrain_InitActions takes nothing returns nothing
    local gamecache g = GetMultiDrainGameCache()
    local unit caster = GetSpellAbilityUnit()
    local unit target = GetSpellTargetUnit()
    local unit dummycaster
    local location loc = GetUnitLoc(caster)
    local location targetloc = GetUnitLoc(target)
    local group targets = CreateGroup()
    local group tempgroup
    local group dummycasters = CreateGroup()
    local trigger t = CreateTrigger()
    local integer spell = GetSpellAbilityId()
    local trigger endcast = CreateTrigger()
    local boolean isendcast = false
    local effect fx = AddSpecialEffectTargetUnitBJ( "weapon", caster, "Abilities\\Spells\\Other\\Drain\\DrainCaster.mdl" )
       
    call CastAbility(getOmniDrain_DummyCheck_Abilcode(),1,"forkedlightning",caster,target,loc,0)
    set dummycaster = GetLastCreatedUnit()
    
    set targets = GetUnitsInRangeOfLocAll(1500.00, loc)
    call StoreIntegerBJ( H2I(t), I2S(H2I(GetTriggerUnit())), "t", g )
    call ForGroupBJ( targets, function Trig_MultiDrain_AddEvent )
    
    call GroupClear(targets)
    call TriggerAddCondition( t, Condition(function Trig_MultiDrain_AddGroupCondition) )
    call TriggerAddAction( t, function Trig_MultiDrain_AddGroupActions )
    call TriggerRegisterUnitEvent(endcast, caster, EVENT_UNIT_SPELL_ENDCAST)
    
    
    call StoreIntegerBJ( H2I(caster), I2S(H2I(t)), "caster", g )
    call StoreIntegerBJ( H2I(target), I2S(H2I(t)), "target", g )
    call StoreIntegerBJ( H2I(dummycaster), I2S(H2I(t)), "dummycaster", g )
    call StoreIntegerBJ( H2I(targets), I2S(H2I(t)), "targets", g )
    call StoreIntegerBJ( H2I(dummycasters), I2S(H2I(t)), "dummycasters", g )
    call StoreIntegerBJ( spell, I2S(H2I(t)), "spell", g )
    call StoreBooleanBJ(isendcast, I2S(H2I(t)), "endcast", g)
        
    call PolledWait(0.4)
    call GroupRemoveUnitSimple( target, targets )
    set tempgroup = GetRandomSubGroup(getOmniDrain_CapTargets()-1, targets)
    call DestroyGroup(targets)
    set targets = tempgroup
    call GroupAddUnitSimple( target, targets )
    call ForGroupBJ( targets, function Trig_MultiDrain_DmgEvent )
    loop
    call TriggerSleepAction(0.1)
    exitwhen GetTriggerEvalCount(endcast)>0 or CountUnitsInGroup(dummycasters) == 0 or GetUnitCurrentOrder(caster) != String2OrderIdBJ("drain")
    endloop
    call PauseUnitBJ( true, caster )
    call PauseUnitBJ( false, caster )
    call ForGroupBJ( dummycasters, function Trig_MultiDrain_RemoveCasters )
    call RemoveLocation(loc)
    call RemoveLocation(targetloc)
    call DestroyEffect(fx)
    call PolledWait(0.1)
    call FlushStoredInteger(g,"caster", I2S(H2I(t)))
    call FlushStoredInteger(g,"t", I2S(H2I(caster)))
    call FlushStoredInteger(g,"target", I2S(H2I(t)))
    call FlushStoredInteger(g,"spell", I2S(H2I(t)))
    call FlushStoredInteger(g,"targets", I2S(H2I(t)))
    call FlushStoredBoolean(g,"endcast", I2S(H2I(t)))
    call FlushStoredInteger(g,"dummycaster", I2S(H2I(t)))
    call FlushStoredInteger(g,"dummycasters", I2S(H2I(t)))
    call DestroyTrigger(t)
    call DestroyTrigger(endcast)
    call GroupClear(targets)
    call DestroyGroup(targets)
    call DestroyGroup(tempgroup)
    call DestroyGroup(dummycasters)
    
    set t = null
    set endcast = null
    set targets = null
    set dummycasters = null
    set loc = null
endfunction

//===========================================================================
function InitTrig_MultiDrain takes nothing returns nothing
    local trigger m = CreateTrigger()
    set gg_trg_MultiDrain = GameCache2Trigger(InitGameCache( "MultiDrain.w3v" ))
    call TriggerRegisterAnyUnitEventBJ( m, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition( m, Condition( function Trig_MultiDrain_InitConditions ) )
    call TriggerAddAction( m, function Trig_MultiDrain_InitActions )
    
endfunction
***

Thanks!
 
Last edited:
Level 12
Joined
Aug 7, 2004
Messages
875
JASS:
function GameCache2Trigger takes gamecache g returns trigger
return g
return null
endfunction

function H2I takes handle h returns integer
return h
return 0
endfunction

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

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

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

function HandToInt takes handle h returns integer
return h
return 0
endfunction

function StoreHandle takes handle m_key, handle stored, string key returns nothing
call StoreInteger(Cache(),I2S(HandToInt( m_key )),key,HandToInt(stored))
endfunction

function RetrieveUnit takes handle m_key,string key returns unit
return GetStoredInteger(Cache(),I2S(HandToInt( m_key )),key)
return null
endfunction

function RetrieveInt takes handle m_key,string key returns integer
return GetStoredInteger(Cache(),I2S(HandToInt( m_key )),key)
endfunction

function RetrieveGroup takes handle m_key,string key returns group
return GetStoredInteger(Cache(),I2S(HandToInt( m_key )),key)
return null
endfunction

function Flush takes handle m_key returns nothing
call FlushStoredMission(Cache(),I2S(HandToInt( m_key )))
endfunction

Those needs to be removed or changed, download Tables or timerutils and revise your spell using that system instead.

Eh basically in 1.24 the return bugs don't work anymore.

return bug is

return g
return 0
 
Level 14
Joined
Nov 18, 2007
Messages
816
First of all: Jass tags, please. If you feel generous, even hidden tags.

Second. Go over to WC3C and search for Faux Handle Vars. That should turn up something you might be searching for.

Off-Topic: I'm seeing one upside of this patch: It lets those coders that abused the return bug (for upcasting) burn in hell. It punishes them for not coding correctly.
 
Level 12
Joined
Aug 7, 2004
Messages
875
First of all: Jass tags, please. If you feel generous, even hidden tags.

Second. Go over to WC3C and search for Faux Handle Vars. That should turn up something you might be searching for.

Off-Topic: I'm seeing one upside of this patch: It lets those coders that abused the return bug (for upcasting) burn in hell. It punishes them for not coding correctly.

Off-tpic, your boomerang spell doesn't work in 1.24, don't know why, even though you didn't use any return bugs.
 
Level 9
Joined
Apr 28, 2006
Messages
187
In case you guys didn't know one of the spells is simply the one hereby Leopard:
http://www.hiveworkshop.com/forums/spells-569/dash-102844/?prev=search=dash&d=list&r=20


The other one is the execellent Omni drain By Arcanister:
http://www.hiveworkshop.com/forums/...102689/?prev=search=multi%20drain&d=list&r=20

These are the basis for two great spells so it'd be great if we coudl get them working again for the community at least.

I just renamed the vars for useage in my map, but i did'nt write either.
 
Level 9
Joined
Apr 28, 2006
Messages
187
Okay... well ive had a go at re-writing the "Pounce" power, it seems to function just like the old one but I'd thought i'd show you the differnece between the code to see if you can see anything ive missed, (Leaking for example)

PRE 1.24 Code:

JASS:
function RawPSSJ takes nothing returns integer
    return 'A07G' //Raw code for Pounce
endfunction

//=================================================================================
//Configuration

function ss_pounceconstant takes nothing returns real
    return 7.00 //Set this real number higher to get faster speed, and lower to get slower speed
endfunction

//=================================================================================

function Trig_Pounce_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == RawPSSJ()
endfunction

function PounceSS takes nothing returns nothing
    local unit spell_pouncecaster = RetrieveUnit(GetExpiredTimer(), "spell_pouncecaster")
    local real spell_pouncess_const = GetStoredReal(Cache(),I2S(HandToInt(GetExpiredTimer())),"spell_pouncess_const")
    local real spell_pouncefaceangle = GetStoredReal(Cache(),I2S(HandToInt(GetExpiredTimer())),"spell_pouncefaceangle")
    local location pouncecastloc = GetUnitLoc(spell_pouncecaster)
    local location pouncepolarproj = PolarProjectionBJ(pouncecastloc, ( spell_pouncess_const * 5.00 ), ( spell_pouncefaceangle + 180.00 )) //else goes backwards
    local effect spell_pouncedusteffect 

    call SetUnitPositionLocFacingBJ( spell_pouncecaster, pouncepolarproj, ( spell_pouncefaceangle - 180.00 ) )
    set spell_pouncedusteffect = AddSpecialEffectTarget("Abilities\\Weapons\\AncientProtectorMissile\\AncientProtectorMissile.mdl",spell_pouncecaster,"origin")
    call DestroyEffectBJ( spell_pouncedusteffect )
    call RemoveLocation(pouncecastloc)
    call RemoveLocation(pouncepolarproj)
    set spell_pouncecaster = null
    set pouncecastloc = null
    set pouncepolarproj = null
    set spell_pouncedusteffect = null 
endfunction

function Trig_Pounce_Actions takes nothing returns nothing
    local real spell_pouncess_const = ss_pounceconstant()
    local unit spell_pouncecaster = GetTriggerUnit()
    local location pouncecastloc = GetUnitLoc(spell_pouncecaster)
    local location spell_pouncetarget = GetUnitLoc(GetSpellTargetUnit())
    local real spell_pouncefaceangle = AngleBetweenPoints(pouncecastloc, spell_pouncetarget) + 180.00 
    local real spell_distancepounce = DistanceBetweenPoints(pouncecastloc, spell_pouncetarget)
    local timer spell_pouncetimer = CreateTimer()    

    if ( spell_distancepounce > 500 ) then
        set spell_distancepounce = 500
    endif
//    call SetUnitPathing( spell_pouncecaster, false ) //collision off
//    call UnitAddAbility(spell_pouncecaster, RawEvade())
    call SetUnitAnimation( spell_pouncecaster, "ready" )
    call StoreHandle(spell_pouncetimer, spell_pouncecaster, "spell_pouncecaster")
    call StoreReal(Cache(),I2S(HandToInt( spell_pouncetimer )),"spell_pouncess_const",spell_pouncess_const)
    call StoreReal(Cache(),I2S(HandToInt( spell_pouncetimer )),"spell_pouncefaceangle",spell_pouncefaceangle) 
    call TimerStart(spell_pouncetimer, 0.03, true, function PounceSS)
 
    call TriggerSleepAction( ( spell_distancepounce / ( spell_pouncess_const * 200.00 ) ) )

//    call UnitRemoveAbility( spell_pouncecaster, RawEvade())
    call ResetUnitAnimation( spell_pouncecaster )
//    call SetUnitPathing( spell_pouncecaster, true ) //collision on
    call Flush(spell_pouncetimer)
    call DestroyTimer(spell_pouncetimer)
    call RemoveLocation(pouncecastloc)
    call RemoveLocation(spell_pouncetarget)
    set pouncecastloc = null
    set spell_pouncetarget = null
    set spell_pouncecaster = null
    set spell_pouncetimer = null

endfunction

//===========================================================================
function InitTrig_Pounce_JASS takes nothing returns nothing
    set gg_trg_Pounce_JASS = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Pounce_JASS, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Pounce_JASS, Condition( function Trig_Pounce_Conditions ) )
    call TriggerAddAction( gg_trg_Pounce_JASS, function Trig_Pounce_Actions )
endfunction

post 1.24 spell:

  • function Trig_Pounce_GUI_2_Conditions takes nothing returns boolean
    • if ( not ( GetSpellAbilityId() == 'A07G' ) ) then
      • return false
    • endif
    • return true
  • endfunction
  • function Trig_Pounce_GUI_2_Func007C takes nothing returns boolean
    • if ( not ( udg_Spell_PounceDistance > 500.00 ) ) then
      • return false
    • endif
    • return true
  • endfunction
  • function Trig_Pounce_GUI_2_Actions takes nothing returns nothing
    • set udg_Spell_PounceSS_Const = 7.00
    • set udg_Spell_PounceCaster = GetTriggerUnit()
    • set udg_PounceCastLoc = GetUnitLoc(udg_Spell_PounceCaster)
    • set udg_Spell_PounceTarget = GetUnitLoc(GetSpellTargetUnit())
    • set udg_Spell_PounceFaceAngle = ( AngleBetweenPoints(udg_PounceCastLoc, udg_Spell_PounceTarget) + 180.00 )
    • set udg_Spell_PounceDistance = DistanceBetweenPoints(udg_PounceCastLoc, udg_Spell_PounceTarget)
    • if ( Trig_Pounce_GUI_2_Func007C() ) then
      • set udg_Spell_PounceDistance = 500.00
    • else
      • call DoNothing( )
    • endif
    • call SetUnitAnimation( udg_Spell_PounceCaster, "ready" )
    • call StartTimerBJ( udg_Spell_PounceTimer, true, 0.03 )
    • set udg_Spell_PounceTimer = GetLastCreatedTimerBJ()
    • call TriggerSleepAction( ( udg_Spell_PounceDistance / ( udg_Spell_PounceSS_Const * 200.00 ) ) )
    • call ResetUnitAnimation( udg_Spell_PounceCaster )
    • call PauseTimerBJ( true, udg_Spell_PounceTimer )
    • call RemoveLocation(udg_PounceCastLoc)
    • call RemoveLocation(udg_PouncePolarProj)
    • call RemoveLocation(udg_Spell_PounceTarget)
    • set udg_Spell_PounceCaster = null
  • endfunction
  • //===========================================================================
  • function InitTrig_Pounce_GUI_2 takes nothing returns nothing
    • set gg_trg_Pounce_GUI_2 = CreateTrigger( )
    • call TriggerRegisterAnyUnitEventBJ( gg_trg_Pounce_GUI_2, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    • call TriggerAddCondition( gg_trg_Pounce_GUI_2, Condition( function Trig_Pounce_GUI_2_Conditions ) )
    • call TriggerAddAction( gg_trg_Pounce_GUI_2, function Trig_Pounce_GUI_2_Actions )
  • endfunction
  • function Trig_Pounce_GUI_Movement_2_Actions takes nothing returns nothing
    • // this is why it refers to the cache as unit and stuff is store din another trigger, not here
    • set udg_PounceCastLoc = GetUnitLoc(udg_Spell_PounceCaster)
    • set udg_PouncePolarProj = PolarProjectionBJ(udg_PounceCastLoc, ( udg_Spell_PounceSS_Const * 5.00 ), ( udg_Spell_PounceFaceAngle + 180.00 ))
    • call AddSpecialEffectTargetUnitBJ( "origin", udg_Spell_PounceCaster, "Abilities\\Weapons\\AncientProtectorMissile\\AncientProtectorMissile.mdl" )
    • set udg_Spell_PounceDustEffect = GetLastCreatedEffectBJ()
    • call DestroyEffectBJ( udg_Spell_PounceDustEffect )
    • call SetUnitPositionLocFacingBJ( udg_Spell_PounceCaster, udg_PouncePolarProj, ( udg_Spell_PounceFaceAngle - 180.00 ) )
    • call RemoveLocation(udg_PounceCastLoc)
    • call RemoveLocation(udg_PouncePolarProj)
  • endfunction
  • //===========================================================================
  • function InitTrig_Pounce_GUI_Movement_2 takes nothing returns nothing
    • set gg_trg_Pounce_GUI_Movement_2 = CreateTrigger( )
    • call TriggerRegisterTimerExpireEventBJ( gg_trg_Pounce_GUI_Movement_2, udg_Spell_PounceTimer )
    • call TriggerAddAction( gg_trg_Pounce_GUI_Movement_2, function Trig_Pounce_GUI_Movement_2_Actions )
  • endfunction
 
Status
Not open for further replies.
Top