• 🏆 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] trigger that leaks

Status
Not open for further replies.
Level 13
Joined
Jul 3, 2008
Messages
1,098
ok i have got this trigger:
  • spawn
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • Set X = (Random real number between 1.00 and 3.00)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • X Equal to 1.00
        • Then - Actions
          • Unit - Create 1 Bodyless soul for Player 1 (Red) at (Center of Region 004 <gen>) facing Default building facing degrees
          • Unit - Create 1 Bodyless soul for Player 2 (Blue) at (Center of Region 003 <gen>) facing Default building facing degrees
          • Unit - Create 1 Bodyless soul for Player 3 (Teal) at (Center of Region 005 <gen>) facing Default building facing degrees
          • Unit - Create 1 Bodyless soul for Player 4 (Purple) at (Center of Region 007 <gen>) facing Default building facing degrees
          • Unit - Create 1 Bodyless soul for Player 5 (Yellow) at (Center of Region 008 <gen>) facing Default building facing degrees
          • Unit - Create 1 Bodyless soul for Player 6 (Orange) at (Center of Region 002 <gen>) facing Default building facing degrees
          • Unit - Create 1 Soulless body for Player 7 (Green) at (Center of Region 011 <gen>) facing Default building facing degrees
          • Unit - Create 1 Soulless body for Player 8 (Pink) at (Center of Region 009 <gen>) facing Default building facing degrees
          • Unit - Create 1 Soulless body for Player 9 (Gray) at (Center of Region 001 <gen>) facing Default building facing degrees
          • Unit - Create 1 Soulless body for Player 10 (Light Blue) at (Center of Region 000 <gen>) facing Default building facing degrees
          • Unit - Create 1 Soulless body for Player 11 (Dark Green) at (Center of Region 012 <gen>) facing Default building facing degrees
          • Unit - Create 1 Soulless body for Player 12 (Brown) at (Center of Region 010 <gen>) facing Default building facing degrees
          • Quest - Display to (All players) the Quest Update message: funguje
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • X Equal to 2.00
        • Then - Actions
          • Unit - Create 1 Soulless body for Player 11 (Dark Green) at (Center of Region 010 <gen>) facing Default building facing degrees
          • Unit - Create 1 Soulless body for Player 10 (Light Blue) at (Center of Region 000 <gen>) facing Default building facing degrees
          • Unit - Create 1 Soulless body for Player 12 (Brown) at (Center of Region 004 <gen>) facing Default building facing degrees
          • Unit - Create 1 Soulless body for Player 9 (Gray) at (Center of Region 003 <gen>) facing Default building facing degrees
          • Unit - Create 1 Soulless body for Player 8 (Pink) at (Center of Region 006 <gen>) facing Default building facing degrees
          • Unit - Create 1 Soulless body for Player 7 (Green) at (Center of Region 005 <gen>) facing Default building facing degrees
          • Unit - Create 1 Bodyless soul for Player 1 (Red) at (Center of Region 002 <gen>) facing Default building facing degrees
          • Unit - Create 1 Bodyless soul for Player 2 (Blue) at (Center of Region 008 <gen>) facing Default building facing degrees
          • Unit - Create 1 Bodyless soul for Player 4 (Purple) at (Center of Region 011 <gen>) facing Default building facing degrees
          • Unit - Create 1 Bodyless soul for Player 3 (Teal) at (Center of Region 009 <gen>) facing Default building facing degrees
          • Unit - Create 1 Bodyless soul for Player 6 (Orange) at (Center of Region 001 <gen>) facing Default building facing degrees
          • Unit - Create 1 Bodyless soul for Player 5 (Yellow) at (Center of Region 007 <gen>) facing Default building facing degrees
          • Quest - Display to (All players) the Quest Update message: funguje
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • X Equal to 3.00
        • Then - Actions
          • Unit - Create 1 Soulless body for Player 11 (Dark Green) at (Center of Region 005 <gen>) facing Default building facing degrees
          • Unit - Create 1 Soulless body for Player 10 (Light Blue) at (Center of Region 009 <gen>) facing Default building facing degrees
          • Unit - Create 1 Soulless body for Player 12 (Brown) at (Center of Region 011 <gen>) facing Default building facing degrees
          • Unit - Create 1 Soulless body for Player 9 (Gray) at (Center of Region 001 <gen>) facing Default building facing degrees
          • Unit - Create 1 Soulless body for Player 8 (Pink) at (Center of Region 007 <gen>) facing Default building facing degrees
          • Unit - Create 1 Soulless body for Player 7 (Green) at (Center of Region 006 <gen>) facing Default building facing degrees
          • Unit - Create 1 Bodyless soul for Player 2 (Blue) at (Center of Region 000 <gen>) facing Default building facing degrees
          • Unit - Create 1 Bodyless soul for Player 1 (Red) at (Center of Region 010 <gen>) facing Default building facing degrees
          • Unit - Create 1 Bodyless soul for Player 4 (Purple) at (Center of Region 008 <gen>) facing Default building facing degrees
          • Unit - Create 1 Bodyless soul for Player 3 (Teal) at (Center of Region 004 <gen>) facing Default building facing degrees
          • Unit - Create 1 Bodyless soul for Player 6 (Orange) at (Center of Region 003 <gen>) facing Default building facing degrees
          • Unit - Create 1 Bodyless soul for Player 5 (Yellow) at (Center of Region 012 <gen>) facing Default building facing degrees
          • Quest - Display to (All players) the Quest Update message: funguje
        • Else - Actions
but dunno why it is not working
 
Level 9
Joined
Jan 23, 2008
Messages
384
Well i think the trigger is impossible to work because real numbers between 1 and 3 are infinite and from a infinity of numbers to pick exact 3 numbers is something beyond may imagination
If you want to make it work set X between 10 and 30 and :

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • X Less than or equal to 10
    • Then - Actions
    • Unit - Create 1 Bodyless soul for Player 1 (Red) at (Center of Region 004 <gen>) facing Default building facing degrees
  • Unit - Create 1 Bodyless soul for Player 2 (Blue) at (Center of Region 003 <gen>) facing Default building facing degrees
  • Unit - Create 1 Bodyless soul for Player 3 (Teal) at (Center of Region 005 <gen>) facing Default building facing degrees
  • Unit - Create 1 Bodyless soul for Player 4 (Purple) at (Center of Region 007 <gen>) facing Default building facing degrees
  • Unit - Create 1 Bodyless soul for Player 5 (Yellow) at (Center of Region 008 <gen>) facing Default building facing degrees
  • Unit - Create 1 Bodyless soul for Player 6 (Orange) at (Center of Region 002 <gen>) facing Default building facing degrees
  • Unit - Create 1 Soulless body for Player 7 (Green) at (Center of Region 011 <gen>) facing Default building facing degrees
  • Unit - Create 1 Soulless body for Player 8 (Pink) at (Center of Region 009 <gen>) facing Default building facing degrees
  • Unit - Create 1 Soulless body for Player 9 (Gray) at (Center of Region 001 <gen>) facing Default building facing degrees
  • Unit - Create 1 Soulless body for Player 10 (Light Blue) at (Center of Region 000 <gen>) facing Default building facing degrees
  • Unit - Create 1 Soulless body for Player 11 (Dark Green) at (Center of Region 012 <gen>) facing Default building facing degrees
  • Unit - Create 1 Soulless body for Player 12 (Brown) at (Center of Region 010 <gen>) facing Default building facing degrees
  • Quest - Display to (All players) the Quest Update message: funguje
    • Else - Actions

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • X Greater than or equal to 20
    • Then - Actions
  • Unit - Create 1 Soulless body for Player 11 (Dark Green) at (Center of Region 005 <gen>) facing Default building facing degrees
  • Unit - Create 1 Soulless body for Player 10 (Light Blue) at (Center of Region 009 <gen>) facing Default building facing degrees
  • Unit - Create 1 Soulless body for Player 12 (Brown) at (Center of Region 011 <gen>) facing Default building facing degrees
  • Unit - Create 1 Soulless body for Player 9 (Gray) at (Center of Region 001 <gen>) facing Default building facing degrees
  • Unit - Create 1 Soulless body for Player 8 (Pink) at (Center of Region 007 <gen>) facing Default building facing degrees
  • Unit - Create 1 Soulless body for Player 7 (Green) at (Center of Region 006 <gen>) facing Default building facing degrees
  • Unit - Create 1 Bodyless soul for Player 2 (Blue) at (Center of Region 000 <gen>) facing Default building facing degrees
  • Unit - Create 1 Bodyless soul for Player 1 (Red) at (Center of Region 010 <gen>) facing Default building facing degrees
  • Unit - Create 1 Bodyless soul for Player 4 (Purple) at (Center of Region 008 <gen>) facing Default building facing degrees
  • Unit - Create 1 Bodyless soul for Player 3 (Teal) at (Center of Region 004 <gen>) facing Default building facing degrees
  • Unit - Create 1 Bodyless soul for Player 6 (Orange) at (Center of Region 003 <gen>) facing Default building facing degrees
  • Unit - Create 1 Bodyless soul for Player 5 (Yellow) at (Center of Region 012 <gen>) facing Default building facing degrees
    • Else - Actions
 
Level 28
Joined
Mar 25, 2008
Messages
2,955
Uhh.. set a pointvariable (most likely as an array) for every 'Center of region x' to get rid of the leaks..
like:
  • Set spawnpoint[0] = Center of Region 004 <gen>
  • Unit - Create Unit - Create 1 Soulless body for Player 11 (Dark Green) at spawnpoint[0 facing Default building facing degrees
  • Custom script: call RemoveLocation(udg_spawnpoint[0])
 
Level 12
Joined
Mar 16, 2006
Messages
992
I was walking down an alley to meet me wench, when me trigger started to leak!

Me pants ruined and me crew laughing! I bear no will to leak at all, yet it leaks as it pleases! me doctor says I need be finding a Mr Pen Cillin, but he is no where to be found on this cursed land!
 
Level 28
Joined
Mar 25, 2008
Messages
2,955
Put it like this -
  • Set temppoint[0] = Center of region 1
  • Set temppoint[1] = Center of region 2
  • Set temppoint[2] = Center of region 3
  • and so on...
  • Unit - Create 1 Bodyless soul for Player 1 (Red) at temppoint[0] facing Default building facing degrees
  • Unit - Create 1 Bodyless soul for Player 1 (Red) at temppoint[1] facing Default building facing degrees
  • Unit - Create 1 Bodyless soul for Player 1 (Red) at temppoint[2] facing Default building facing degrees
  • and so on...
  • For each Integer A from 0 to x do: call RemoveLocation(udg_temppoint[forLoopAIndex])
while x is the maximum number of the array you've assigned.
I'm not sure about the call removeloc so if anyone knows better, correct me ^.^
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
First of all this is a one shot trigger.
Even if he has 500 leaks it ain't that big of a thing ;) ( and he has significantly less than 500).
What other people have suggested:
Set X = (Random integer number between 1 and 3)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
X Equal to 1
blah
blah
If - Conditions
X Equal to 2
and so on

If you want to get random spawn points, you can do it way easier and with more variations:
*note that in all examples, I use "(Center of (Playable map area))" which you should substitute with center of region #blah# *
  • Example spawn trigger 1
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • Set locations[0] = (Center of (Playable map area))
      • Set locations[1] = (Center of (Playable map area))
      • Set locations[2] = (Center of (Playable map area))
      • Set locations[3] = (Center of (Playable map area))
      • Set locations[4] = (Center of (Playable map area))
      • Set locations[5] = (Center of (Playable map area))
      • Set locations[6] = (Center of (Playable map area))
      • Set locations[7] = (Center of (Playable map area))
      • Set locations[8] = (Center of (Playable map area))
      • Set locations[9] = (Center of (Playable map area))
      • Set locations[10] = (Center of (Playable map area))
      • Set locations[11] = (Center of (Playable map area))
      • Set locations[12] = (Center of (Playable map area))
      • Set x = (Random integer number between 1 and 12)
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Footman for (Picked player) at locations[x] facing Default building facing (270.0) degrees
          • Set x = ((x + 1) mod 12)
        • Do Multiple ActionsFor each (Integer A) from 0 to 12, do (Actions)
          • Loop - Actions
            • Custom script: call RemoveLocation(udg_locations[bj_forLoopAIndex])
            • Custom script: set udg_locations[bj_forLoopAIndex]=null
This way you will have 11 different variations in only a fraction of the code you have above. Though that way there will always be a specific spawn sequence.
To avoid it a little complication would be necessary:
  • Spawn trigger example 2
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • Set locations[0] = (Center of (Playable map area))
      • Set locations[1] = (Center of (Playable map area))
      • Set locations[2] = (Center of (Playable map area))
      • Set locations[3] = (Center of (Playable map area))
      • Set locations[4] = (Center of (Playable map area))
      • Set locations[5] = (Center of (Playable map area))
      • Set locations[6] = (Center of (Playable map area))
      • Set locations[7] = (Center of (Playable map area))
      • Set locations[8] = (Center of (Playable map area))
      • Set locations[9] = (Center of (Playable map area))
      • Set locations[10] = (Center of (Playable map area))
      • Set locations[11] = (Center of (Playable map area))
      • Set locations[12] = (Center of (Playable map area))
        • Do Multiple ActionsFor each (Integer A) from 0 to 12, do (Actions)
          • Loop - Actions
            • Set locs[(Integer A)] = (Integer A)
      • Set x = 0
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Set y = (Random integer number between 0 and (12 - x))
          • Unit - Create 1 Footman for (Picked player) at locations[locs[y]] facing Default building facing (270.0) degrees
          • Set locs[y] = locs[(12 - x)]
          • Set x = (x + 1)
        • Do Multiple ActionsFor each (Integer A) from 0 to 12-x, do (Actions)
          • Loop - Actions
            • Custom script: call RemoveLocation(udg_locations[bj_forLoopAIndex])
            • Custom script: set udg_locations[bj_forLoopAIndex]=null
Well, actually it can be done easier:
  • Spawn Trigger Example 3
  • Untitled Trigger 001
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • Set locations[0] = (Center of (Playable map area))
      • Set locations[1] = (Center of (Playable map area))
      • Set locations[2] = (Center of (Playable map area))
      • Set locations[3] = (Center of (Playable map area))
      • Set locations[4] = (Center of (Playable map area))
      • Set locations[5] = (Center of (Playable map area))
      • Set locations[6] = (Center of (Playable map area))
      • Set locations[7] = (Center of (Playable map area))
      • Set locations[8] = (Center of (Playable map area))
      • Set locations[9] = (Center of (Playable map area))
      • Set locations[10] = (Center of (Playable map area))
      • Set locations[11] = (Center of (Playable map area))
      • Set locations[12] = (Center of (Playable map area))
      • Set x = 0
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Set y = (Random integer number between 0 and (12 - x))
          • Unit - Create 1 Footman for (Picked player) at locations[y] facing Default building facing (270.0) degrees
          • Custom script: call RemoveLocation(udg_locations[udg_y])
          • Set locations[y] = locations[(12 - x)]
          • Custom script: set udg_locations[12-udg_x]=null
          • Set x = (x + 1)
      • Do Multiple ActionsFor each (Integer A) from 0 to 12-x, do (Actions)
        • Loop - Actions
          • Custom script: call RemoveLocation(udg_locations[bj_forLoopAIndex])
          • Custom script: set udg_locations[bj_forLoopAIndex]=null
Ah, I may have some errors, here it is 3 AM and this is not worth testing.
 
Last edited:
Level 12
Joined
Apr 27, 2008
Messages
1,228
Well it is not difficult at all.
For instance the last example I gave:
All it does is spawn a unit at a random location and then gets rid of that location in order for no other units to get spawned at that spot.
And all the Custom script: call RemoveLocation(udg_locations[#])
Custom script: set udg_locations[#]=null are there just to take care of leaks.
Updated 2nd example so it is a wii bit more efficient.
I ain't sure whether All Players counts computers or not, but if I assume it takes only playing players, then all 3 triggers would work the same for 1 or for 12 players.
Either ways, it ain't so difficult to just reproduce the trigger in your WE ;)
P.s. 2 and 3 example do exactly that, spawn units on random predetermined spots(no more than one at a spot).
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
I am even lazier than you and I did not save the trigger.
Besides what is the point in just copying it without understanding it.
 
Status
Not open for further replies.
Top