• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] How to make this simply GUI MUI

Status
Not open for further replies.
Event: A unit starts casting an ability
Condition: Abilty being cast equal to Plagued Brain
Action:
-----Do some action with target unit of ability being cast-----
wait 5 seconds
-----Do some action with target unit of ability being cast-----

Because of the target unit of ability being cast is null after 5 seconds, it does not work corretly. Can anyone help me please?
 
Level 21
Joined
Aug 9, 2006
Messages
2,384
Well, you cannot do that without a variable of any kind, best way is a unit variable, set the variable to the target unit of ability being cast and do the stuff, set the wait in, do the other stuff and set the unit var to no unit(to prevent leaks)


you need to create the variable in the variable editor. Yes.
 
  • Custom script: local unit udg_Tmp_Unit = GetSpellTargetUnit()
  • Custom script: local integer udg_Tmp_Integer = ( 5 + GetUnitAbilityLevelSwapped('A00O', GetTriggerUnit()) )
    • For each (Integer A) from 1 to Tmp_Integer, do (Actions)
      • Loop - Actions
        • Wait 1.00 game-time seconds
        • Unit - Cause (Triggering unit) to damage Tmp_Unit, dealing (12.50 + ((Real((Level of Weakening Epidemic for (Triggering unit)))) x 2.50)) damage of attack type spells and damage type magic
        • Set Tmp_Loc = (Position of Tmp_Unit)
        • Specialeffect - Create a special effect at Tmp_Loc using Abilities\Spells\Other\Volcano\VolcanoMissile.mdl
        • Custom script: call RemoveLocation(udg_Tmp_Loc)
        • Set Tmp_Effect = (Last created special effect)
        • Specialeffect - Destroy Tmp_Effect
    • Custom script: set udg_Tmp_Unit = null
    • Custom script: set udg_Tmp_Integer = 0
And whats wrong with this?
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Your trigger has no problems.

It could be coded better though.

You do not need to use the Special Effect variable. Simply create and destroy it in the following line (last created special effect).
You do not need to set the integer to 0 as it is a local.

A local variable loses its value when its function ends.
 
Status
Not open for further replies.
Top