How to clean up this trigger

Super.Gnome

New Member
Reaction score
0
I started my map when I was really bad at GUI. And I made this trigger:

Trigger:
  • Archer wave Light
    • Events
      • Unit - A unit enters Mainbase light <gen>
    • Conditions
      • (Unit-type of (Entering unit)) Equal to Hire Archer Reinforcement
    • Actions
      • Unit - Kill (Entering unit)
      • Unit - Create 3 Archer for Player 10 (Light Blue) at (Random point in Light Wave Spawn <gen>) facing (Position of (Triggering unit))
      • Unit - Create 3 Archer for Player 10 (Light Blue) at (Random point in Light Wave Spawn <gen>) facing (Position of (Triggering unit))
      • Wait 5.00 seconds
      • Unit - Create 3 Archer for Player 10 (Light Blue) at (Random point in Light Wave Spawn <gen>) facing (Position of (Triggering unit))
      • Unit - Create 3 Archer for Player 10 (Light Blue) at (Random point in Light Wave Spawn <gen>) facing (Position of (Triggering unit))
      • Wait 5.00 seconds
      • Unit - Create 3 Archer for Player 10 (Light Blue) at (Random point in Light Wave Spawn <gen>) facing (Position of (Triggering unit))
      • Unit - Create 3 Archer for Player 10 (Light Blue) at (Random point in Light Wave Spawn <gen>) facing (Position of (Triggering unit))
      • Wait 5.00 seconds
      • Unit - Create 3 Archer for Player 10 (Light Blue) at (Random point in Light Wave Spawn <gen>) facing (Position of (Triggering unit))
      • Unit - Create 3 Archer for Player 10 (Light Blue) at (Random point in Light Wave Spawn <gen>) facing (Position of (Triggering unit))
      • Wait 5.00 seconds
      • Unit - Create 3 Archer for Player 10 (Light Blue) at (Random point in Light Wave Spawn <gen>) facing (Position of (Triggering unit))
      • Unit - Create 3 Archer for Player 10 (Light Blue) at (Random point in Light Wave Spawn <gen>) facing (Position of (Triggering unit))
      • Wait 5.00 seconds
      • Unit - Create 3 Archer for Player 10 (Light Blue) at (Random point in Light Wave Spawn <gen>) facing (Position of (Triggering unit))
      • Unit - Create 3 Archer for Player 10 (Light Blue) at (Random point in Light Wave Spawn <gen>) facing (Position of (Triggering unit))
      • Wait 5.00 seconds
      • Unit - Create 3 Archer for Player 10 (Light Blue) at (Random point in Light Wave Spawn <gen>) facing (Position of (Triggering unit))
      • Unit - Create 3 Archer for Player 10 (Light Blue) at (Random point in Light Wave Spawn <gen>) facing (Position of (Triggering unit))


As far as I know, at the moment, this is inefficient and leaks like mad. I should be able to accomplish the same effect, but without the waits. That way I can use a variable to clear the points I use.

Anyone know of a better way to trigger this? I'm tempted to set and clear my variables between waits, but I'm not even sure that would work.
 

kurtisebear

New Member
Reaction score
0
If you plan for no other reinforcements until all the archers are created, you could set a trigger with a one-shot timer to repeat itself until a counter reaches 5 (or whatever number).
 

Super.Gnome

New Member
Reaction score
0
What if I want it to be able to have more reinforcements to be able to be sent? They would be of a different unit type, but would be spawning from an identical trigger.

Does it hurt anything to just set and clear a "temppoint" variable between each wait? Because that seems like the easiest way to do it.
 

Icyculyr

I'm a Mac
Reaction score
68
I'd do:
Variables->
Point Array pPoints Index of 2

Trigger:
  • Unit - Kill (Triggering unit)
    • For Each Integer A From 0 To 6
      • Loop
        • Set pPoints[0] = Random point in Light Wave Spawn <gen>
        • Set pPoints[1] = Random point in Light Wave Spawn <gen>
        • Set pPoints[2] = Position of Triggering Unit
        • Unit - Create 3 Archer for Player 10 (Light Blue) at pPoints[0] facing pPoints[2])
        • Unit - Create 3 Archer for Player 10 (Light Blue) at pPoints[1] facing pPoints[2]
        • Custom Script - call RemoveLocation(udg_pPoints[0])
        • Custom Script - call RemoveLocation(udg_pPoints[1])
        • Custom Script - call RemoveLocation(udg_pPoints[2])
        • Wait 5.00 seconds


That looks good to me, careful with the custom script, it's CAPS sensitive, and one wrong character will stop the map from compiling.

The action is General - Custom Script
 

Executor

I see you
Reaction score
57
Trigger:
  • Actions:
    • Set pPoints[2] = Position of Triggering Unit
    • Unit - Kill (Triggering unit)
    • For Each Integer A From 0 To 6
      • Loop
        • Set pPoints[0] = Random point in Light Wave Spawn <gen>
        • Set pPoints[1] = Random point in Light Wave Spawn <gen>
        • Unit - Create 3 Archer for Player 10 (Light Blue) at pPoints[0] facing pPoints[2])
        • Unit - Create 3 Archer for Player 10 (Light Blue) at pPoints[1] facing pPoints[2]
        • Custom Script - call RemoveLocation(udg_pPoints[0])
        • Custom Script - call RemoveLocation(udg_pPoints[1])
        • Custom Script - call TriggerSleepAction( 5. )
    • Custom Script - call RemoveLocation(udg_pPoints[2])
 

Super.Gnome

New Member
Reaction score
0
Here is what I did:

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
      • 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])


As I understand this. This will repeat 6 times, at 5 second intervals. And it's "MUI" so that if multiple waves are being sent at once, we wont have a bug.

Am I correct in my understanding?
 

Icyculyr

I'm a Mac
Reaction score
68
Yes that's what call TriggerSleepAction() does, what's the difference between Wait 5 seconds though?

Code:
Unit - Create 3 Archer for Player 10 (Light Blue) at (Random point in Light Wave Spawn <gen>) facing [COLOR="Red"](Position of (Triggering unit)[/COLOR])

You were accessing it in your code, that's why we set that variable.
pPoints[2] is set to the pos, and then it is changed to "facing pPoints[2]".

See?
 

Super.Gnome

New Member
Reaction score
0
Yes that's what call TriggerSleepAction() does, what's the difference between Wait 5 seconds though?

Code:
Unit - Create 3 Archer for Player 10 (Light Blue) at (Random point in Light Wave Spawn <gen>) facing [COLOR="Red"](Position of (Triggering unit)[/COLOR])

You were accessing it in your code, that's why we set that variable.
pPoints[2] is set to the pos, and then it is changed to "facing pPoints[2]".

See?

I edited my post above, after I realized what was happening but I forgot to check for replies -- oops. That's my question, isnt call TriggerSleepAction() the same as a Wait? In which case I have to use a new variable array for each separate trigger (I have 16 that do this same thing with different unit types)?
 

Icyculyr

I'm a Mac
Reaction score
68
Hey,
As I understand this. This will repeat 6 times, at 5 second intervals. And it's "MUI" so that if multiple waves are being sent at once, we wont have a bug.

Am I correct in my understanding?

I don't believe it's MUI, since there will be a wait involved, the points will be adjusted and different waves may end up appearing at the wrong locations.

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



That should work just fine, however you need to clean those leaks, I can't think of an efficient way to clean the leaks, maybe you can?

Kind Regards
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1

      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