small question

Kuberr24

Well-Known Member
Reaction score
28
When I have a trigger, and inside the trigger I have the functions Trig_Conditions, Trig_RandomFunction and Trig_Actions. I know actions and conditions can use things like GetSpellAbilityUnit() or GetTriggeringingTrigger(), but I can also those in the RandomFunction? and will it give the correct result?

For example:

JASS:
function BeetleFrenzyConditions takes nothing returns boolean
    return(GetSpellAbilityId()=='A00C')
endfunction

function RandomFunction takes nothing returns nothing
    local unit Caster = GetSpellAbilityUnit()
   //
   //WILL CASTER BE CORRECT???
   //
endfunction

function BeetleFrenzyActions takes nothing returns nothing
    local unit Caster = GetSpellAbilityUnit()
    local integer Level = GetUnitAbilityLevel(Caster,'A00C')
    local timer T
    call AddUnitAnimationProperties(Caster,"alternate",true)
    //
   //...
   //
endfunction

function InitTrig_BeetleFrenzy takes nothing returns nothing
    set gg_trg_BeetleFrenzy = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_BeetleFrenzy,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(gg_trg_BeetleFrenzy,Condition(function BeetleFrenzyConditions))
    call TriggerAddAction(gg_trg_BeetleFrenzy,function BeetleFrenzyActions)
endfunction
 

Komaqtion

You can change this now in User CP.
Reaction score
469
No, that unit variable "Caster" will not be set correctly...

I'd suggest you use a global variable (If you're not using wait somewhere...) which you set in the "BeetleFrenzyActions" function ;)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top