• 🏆 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!

[Trigger] MUI with Timers

Status
Not open for further replies.
Level 5
Joined
May 21, 2006
Messages
174
What do you suggest I do to make this MUI?

Trigger:
  • Blazing Charge
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Serpent Ward
    • Actions
      • Custom script: local unit u
      • Custom script: local integer i
      • Set tempUnit = (Casting unit)
      • Custom script: set u=udg_tempUnit
      • Set tempPoint = (Position of (Casting unit))
      • Set tempPoint2 = (Target point of ability being cast)
      • Set tempInteger = ((Integer((Distance between tempPoint and tempPoint2))) / 25)
      • -------- ---------------------------------------------------------------------------------------------------- --------
      • Unit - Make tempUnit Invulnerable
      • Unit - Turn collision for tempUnit Off
      • Unit - Pause tempUnit
      • -------- ---------------------------------------------------------------------------------------------------- --------
      • Countdown Timer - Start tempTimer as a Repeating timer that will expire in 0.05 seconds
      • Wait ((Real(tempInteger)) x 0.05) seconds
      • Countdown Timer - Pause tempTimer
      • Custom script: set udg_tempUnit=u
      • -------- ---------------------------------------------------------------------------------------------------- --------
      • Unit - Unpause tempUnit
      • Unit - Turn collision for tempUnit On
      • Unit - Make tempUnit Vulnerable
      • Selection - Add tempUnit to selection for (Owner of tempUnit)
      • -------- ---------------------------------------------------------------------------------------------------- --------
      • Custom script: set u=null
      • Custom script: set udg_tempUnit=null
      • Custom script: set udg_tempInteger=0
      • Custom script: set udg_tempInteger2=0
      • Custom script: call RemoveLocation( udg_tempPoint )
      • Custom script: call RemoveLocation( udg_tempPoint2 )
      • Custom script: call RemoveLocation( udg_tempPoint3 )
Timer:
  • Blazing Charge Move
    • Events
      • Time - tempTimer expires
    • Conditions
    • Actions
      • Custom script: local effect e
      • Set tempInteger2 = (tempInteger2 + 25)
      • Set tempPoint3 = (tempPoint offset by (Real(tempInteger2)) towards (Facing of tempUnit) degrees)
      • Special Effect - Create a special effect at tempPoint3 using Abilities\Spells\Orc\MirrorImage\MirrorImageCaster.mdl
      • Custom script: set e=GetLastCreatedEffectBJ()
      • Custom script: set udg_tempEffect=e
      • Unit - Move tempUnit instantly to tempPoint3
      • Special Effect - Destroy tempEffect
      • Custom script: set e=null
 
MUI means Multiple Unit Integer.. which means more than one units owned by each player can use it at the exact same time.. so you need to set it so it flawlessly does the effect on the unit thats chosen.. try adding some arrays like the tempunit.. make it an array and set it like this

  • Actions
    • Set tempUnit[(Player number of (Owner of (Casting Unit)))] = (Casting Unit)
Do that sort of thing for the rest of the variables.. specify them based on the unit casting the ability and the player owning the unit.. etc.. i know that sounds confusing even to myself but meh..
 
Level 5
Joined
May 21, 2006
Messages
174
Uhmm..
neither you should use a variable, nor Casting Unit, just set it to (Triggering Unit) and be fine.
How will it be fine? (Triggering Unit) won't be transfered to the timer trigger.

try adding some arrays like the tempunit.. make it an array and set it like this

  • Actions
    • Set tempUnit[(Player number of (Owner of (Casting Unit)))] = (Casting Unit)
I'm sure there must be a better / cleaner way to do this.
Also it's not MUI if you have several units with this ability owned by the same player.
 
Level 6
Joined
Sep 5, 2007
Messages
264
MUI means Multiple Unit Integer.. which means more than one units owned by each player can use it at the exact same time.. so you need to set it so it flawlessly does the effect on the unit thats chosen.. try adding some arrays like the tempunit.. make it an array and set it like this

  • Actions
    • Set tempUnit[(Player number of (Owner of (Casting Unit)))] = (Casting Unit)
Do that sort of thing for the rest of the variables.. specify them based on the unit casting the ability and the player owning the unit.. etc.. i know that sounds confusing even to myself but meh..

That way is MPI... Multiple-Player-Instancable, only 1 instance of it per player, not per unit (MUI).

I don't use GUI too much anymore, I use JASS. But, there should be someone around here who knows how to do it. I think that it'd be much easier to do in JASS or even vJASS, but that's just me.
 
Level 9
Joined
Apr 3, 2008
Messages
700
Correct me if I am wrong, but don't local variables have issues with GUI if there are more than one of them?

Why? GUI triggers with several local variables works in my map.

@PatruX If each player in your map have one unit/hero, you can just make arrays and you don't need local variable at all.
If you have more that one unit, transfer the value of variable between local and global after wait action.
 
Status
Not open for further replies.
Top