Making this trigger MUI

Super.Gnome

New Member
Reaction score
0
I have this trigger that I'd like to reuse roughly 20 more times to spawn different unit types, using the same variable.

Trigger:
  • Archer wave Light
    • Events
      • Unit - A unit enters Mainbase light <gen>
    • Conditions
      • (Unit-type of (Entering unit)) Equal to Hire Archer Reinforcement
    • Actions
      • Set WPoints[0] = (Position of (Triggering unit))
      • Unit - Remove (Triggering unit) from the game
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Set WPoints[1] = (Random point in Light Wave Spawn <gen>)
          • Set WPoints[2] = (Random point in Light Wave Spawn <gen>)
          • Unit - Create 3 Archer for Player 10 (Light Blue) at WPoints[1] facing WPoints[0]
          • Unit - Create 3 Archer for Player 10 (Light Blue) at WPoints[2] facing WPoints[0]
          • Custom script: call RemoveLocation (udg_WPoints[1])
          • Custom script: call RemoveLocation (udg_WPoints[2])
          • Custom script: call TriggerSleepAction( 5. )
      • Custom script: call RemoveLocation (udg_WPoints[0])


Is there anyway to format this trigger, and the others, so that I can reuse the variable on multiple unit spawns that may be happening simultaneously? I'm under the impression I can't as is because of the sleep action.
 

kaboo

New Member
Reaction score
45
is this what are you looking for?
Code:
events - unit enters mainbase
conditions -
actions 
- set wpoints as u want
- remove entering unit
- if then else do
        -conditions - unit type of entering unit equal to archer hire
        -then actions - create archers
- if then elso do
        -conditions - unit type of entering unit equal to footman hire
        -then actions - create footmans
.................

btw what does the sleep action trigger do?
 

Super.Gnome

New Member
Reaction score
0
is this what are you looking for?
Code:
events - unit enters mainbase
conditions -
actions 
- set wpoints as u want
- remove entering unit
- if then else do
        -conditions - unit type of entering unit equal to archer hire
        -then actions - create archers
- if then elso do
        -conditions - unit type of entering unit equal to footman hire
        -then actions - create footmans
.................

btw what does the sleep action trigger do?

It essentially is 5 second wait between loops. So that I get 6 "waves" of 6 archers, instead of 1 wave of 36 archers. Im doing it this way instead of just one massive wave for aesthetic and technical reason. One wave of 36 looks funny, and causes some lag upon being created.
 

kaboo

New Member
Reaction score
45
then use this
Code:
events - unit enters mainbase
conditions - unit type of entering unit equal to archer hire
actions 
- set wpoints as u want
- for each integer 1 to 6 do
   - if then else do
        -conditions - 
        -then actions - create archers
                           - remove entering unit
                           - wait 5 seconds
 

LoveTD's

New Member
Reaction score
34
custom script: local NameOfYourVariable

custom script: set NameOfYourVariable = .....

ow oops I did that wrong XD I think :p sec....

hmm seems like would be ok:

custom script: local integer i = 0
custom script: set i = i+1

if u get what I mean ;)
 

Super.Gnome

New Member
Reaction score
0
custom script: local NameOfYourVariable

custom script: set NameOfYourVariable = .....

ow oops I did that wrong XD I think :p sec....

hmm seems like would be ok:

custom script: local integer i = 0
custom script: set i = i+1

if u get what I mean ;)

No I don't know what you mean. I don't know how to set a local point variable to the spot I want. The whole local variable thing is foreign to me.

On second thought, is this even required? It seems that the only non-mui part of the trigger is "WPoints[0]" as the other two variables are cleared between each wait. So if I switch it so facing "default building degrees" I have fixed my problem correct?

This trigger here seems leakless, and as though I can reuse the variables in other "wave" triggers without issue:

Trigger:
  • Archer wave Light Copy
    • Events
      • Unit - A unit enters Mainbase light <gen>
    • Conditions
      • (Unit-type of (Entering unit)) Equal to Hire Archer Reinforcement
    • Actions
      • Unit - Remove (Triggering unit) from the game
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Set WPoints[1] = (Random point in Light Wave Spawn <gen>)
          • Set WPoints[2] = (Random point in Light Wave Spawn <gen>)
          • Unit - Create 3 Archer for Player 10 (Light Blue) at WPoints[1] facing Default building facing degrees
          • Unit - Create 3 Archer for Player 10 (Light Blue) at WPoints[2] facing Default building facing degrees
          • Custom script: call RemoveLocation (udg_WPoints[1])
          • Custom script: call RemoveLocation (udg_WPoints[2])
          • Custom script: call TriggerSleepAction( 5. )


Am I correct in that?
 

the Immortal

I know, I know...
Reaction score
51
Yep, MUI now it is.

For making it the other way (makin 'dem units face a point) you can either
1) use locals but since shadowing is not allowed either use NewGen or do all lines using the locals in JASS
2) use some imba GUI indexing system / algorithm
3) use arrays of [12] (15?) and make it MPI

Ask and you'll be answered as someone smartie said.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top