Something gone wrong with my trigger

smileyguyx

Member
Reaction score
1
Trigger:
  • Events
    • Time - Every 0.50 seconds of game time
    • Conditions
      • Level Equal to 1
    • Actions
      • For each (Integer A) from 1 to 15, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Red Slime for Player 12 (Brown) at (Center of Spawn <gen>) facing Default building facing degrees
          • Wait 0.75 seconds
      • Trigger - Turn on Level 2 <gen>
      • Trigger - Turn off (This trigger)

When i test i get this extremely large amount of slimes spawning(idk how many but its not 15)
 

Dirac

22710180
Reaction score
147
Try turning off the trigger before spawning the slimes, otherwis it will wait until all 15 were spawned to turn it off
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
Every 0.5 seconds, you run this trigger once. So 1 slime is created. 0.5 seconds later, one slime is created due to another instance of the trigger running. 0.25 seconds later, the wait is over and a slime is spawned.

You get my drift.
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
I might be wrong since I've been gone for a while.. But shouldn't there be no waits in loops?
Simply put, if the trigger is run once, it will spawn 15 slimes over a period of 11+ seconds. However, you're running the trigger once every 0.50 seconds, So by the end of 11 seconds you would've ran the trigger 22 times. If it stops there, you'll probably have 330 slimes already.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
ur right sky, if you wait in a loop it will just not work
 

Grags_1977

Ultra Cool Member
Reaction score
32
Trigger:
  • Trigger
    • Events
      • Time - Every 0.75 seconds of game time
    • Conditions
    • Actions
      • Set Integer_Spawn = (Integer_Spawn + 1)
      • Set TempPoint = (Center of Spawn <gen>)
      • Unit - Create 1 Red Slime for Player 12 (Brown) at TempPoint facing Default building facing degrees
      • Custom script: call RemoveLocation (udg_TempPoint)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer_Spawn Equal to 15
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
why have a periodic event if the trigger is turned off the first time it is run and it is an instant ability
 

Grags_1977

Ultra Cool Member
Reaction score
32
My trigger was just an explanation on how to deal with the 0.75 Wait in that For To Loop.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
i was asking him, not u lol, i understood why u did it
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
The question is what effect the op intended this trigger to have.
 

smileyguyx

Member
Reaction score
1
Ye i read somewhere that waits in loops can ruin it or rather but i didn't know any other ways to get my men into nice single files
Grags example works but what should i do if i wanted to spawn a different amount of say a Blue Slime with the same or different time between each spawn? And what if i wanted to have more creeps?
I could try to create a extra temp point and extra integer spawn but then i would be limited by how much time has passed for any one of the temps
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
create a repeating timer that creates the units... like this:

Trigger:
  • Spawn lvl 1
    • Events
      • Time elapsed == 30.00 seconds?
    • Conditions
    • Actions
      • Countdown Timer - Create Spawn_Timer (timer variable) as a repeating timer that expires in 0.75 seconds
      • Set Unit_Type (unit type variable) = Unit type of the unit you want to spawn


Trigger:
  • Spawn Units
    • Events
      • A timer expires
    • Conditions
      • Expiring timer is Spawn_Timer is equal to true
    • Actions
      • Set Temp_Point = center of Spawn_Region (Region variable or selected region)
      • Unit - Create 1 Unit_Type at temp_point facing (whatever degrees u want)
      • Unit - Order Last created unit to (whatever u want from here on)
      • Comment - \/ This is needed at the end so that the trigger doesnt leak
      • Custom Script: Callremovelocation(UDG_Temp_Point)
 

smileyguyx

Member
Reaction score
1
Can i use the same Timer variable if i wanted two different units or do i need to make another so they won't interfere
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
you can make a boolean variable, where if its true set it to false and make the first unit... then if its true set it to false and make the other
 

keychup

Active Member
Reaction score
34
If you want 15 slimes per second try making only 1 slime every 0.06 seconds without "for each integer"
If you want 3 slimes per second try making only 1 slime every 0.33 seconds without "for each integer"
 

neo34rd

New Member
Reaction score
3
Then make some definitions using an integer or a string (whichever you fancy) and make the switch case respond to that definition.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
if you wanted 3 units instead of using a boolean variable and just set it to itself +1 for every option, then if its 3 set it to 1 all over again
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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