Trigger with Moving units to random regions.

DoomedDude

New Member
Reaction score
1
Hey
I am having problems with this trigger, I'm just trying to get it to work before entering the real regions I'm going to use ~~

Event
Time - Round expires
Actions
Set NumberRed = (Random real number between 1.00 and 8.00)
Wait 0.05 game-time seconds
If (NumberRed Equal to 1.00) then do (Unit Group - Pick every unit in (Units in Red Respawn <gen>) and do (Unit - Move (Picked unit) instantly to (Center of Green Respawn <gen>))) else do (Do nothing)
If (NumberRed Equal to 2.00) then do (Unit Group - Pick every unit in (Units in Red Respawn <gen>) and do (Unit - Move (Picked unit) instantly to (Center of Blue Respawn <gen>))) else do (Do nothing)
...
If (NumberRed Equal to 8.00) then do (Unit Group - Pick every unit in (Units in Red Respawn <gen>) and do (Unit - Move (Picked unit) instantly to (Center of (Playable map area)))) else do (Do nothing)

So, it does not work. Tried with other actions it's not about the event.
What is wrong o_O
Is it about the random real number, does it make numbers like 1,24 or 6,39 etc..? If it's that how can I make "whole" numbers with just 1.0 2.0 etc
 

Executor

I see you
Reaction score
57
Integer = [...,-5,-4,-3,-2,-1,0,1,2,3,4,5,...]
Real = [...,-6.3,-5.2,-4.1,-3.2,-2.7,-1.4,0,1.2,2.7,...]

set RedNumber = RandomReal between 1 and 8 will only very seldom be exactlye 1.00 or 2.00 or 3.00.

You have to use the type integer for actions like that..
 

DoomedDude

New Member
Reaction score
1
Ok, now another problem.
First two unit groups work fine, third makes it lag, and fourth makes it crash. Memory error or something...
So:
Event
Unit - A unit enters Battle <gen>
Condition
(Owner of (Triggering unit)) Equal to Player 2 (Blue)
Actions
Set NumberRed = (Real((Random integer number between 1 and 8)))
Wait for 1.00 game-time seconds.
If ((NumberRed Equal to 1.00) and ((Number of units in (Units in Battle11 <gen>)) Equal to 0)) then do (Unit Group - Pick every unit in (Units in Teal Respawn <gen>) and do (Unit - Move (Picked unit) instantly to (Center of Battle11 <gen>))) else do (Trigger - Run (This trigger) (ignoring conditions))
If ((NumberRed Equal to 2.00) and ((Number of units in (Units in Battle12 <gen>)) Equal to 0)) then do (Unit Group - Pick every unit in (Units in Teal Respawn <gen>) and do (Unit - Move (Picked unit) instantly to (Center of Battle12 <gen>))) else do (Trigger - Run (This trigger) (ignoring conditions))
If ((NumberRed Equal to 3.00) and ((Number of units in (Units in Battle21 <gen>)) Equal to 0)) then do (Unit Group - Pick every unit in (Units in Teal Respawn <gen>) and do (Unit - Move (Picked unit) instantly to (Center of Battle21 <gen>))) else do (Trigger - Run (This trigger) (ignoring conditions))
like this for all 8 numbers.
Tried different variable for every team but it will still crash.
How could I lessen the amount of memory needed with this trigger?

EDIT: And as TheTempest mentioned, if it's memory leak, how to fix that?
 

DoomedDude

New Member
Reaction score
1
This trigger doesn't like me :banghead:
Now the problem is this:
I have the trigger, it sometimes works fine, sometimes throws the unit in center of the map... I've not double checked it, i have checked it like 10 times.
Battle regions are
battle 11, 12, 21, 22, 31, 32, 41 and 42 and just battle, which includes all others in it.
There's something wrong beyond my knowledge

Trigger:
  • Set NumberRed = (Real((Random integer number between 1 and 8)))
    • Set TempGroup = (Units in Yellow Respawn &lt;gen&gt;)
    • Wait 0.05 seconds
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • NumberRed Equal to 1.00
      • Then - Actions
        • Set TempReg = Battle11 &lt;gen&gt;
        • If ((Number of units in (Units in TempReg)) Equal to 0) then do (Unit Group - Pick every unit in TempGroup and do (Unit - Move (Picked unit) instantly to (Random point in TempReg))) else do (Do nothing)
        • Wait 0.05 seconds
        • Custom script: call RemoveRect (udg_TempReg)
      • Else - Actions
        • Do nothing
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Number of units in (Units in Yellow Respawn &lt;gen&gt;)) Equal to 0
      • Then - Actions
        • Custom script: call DestroyGroup (udg_TempGroup)
        • Skip remaining actions
      • Else - Actions
        • Do nothing
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • NumberRed Equal to 2.00
      • Then - Actions
        • Set TempReg = Battle12 &lt;gen&gt;
        • If ((Number of units in (Units in TempReg)) Equal to 0) then do (Unit Group - Pick every unit in TempGroup and do (Unit - Move (Picked unit) instantly to (Random point in TempReg))) else do (Do nothing)
        • Wait 0.05 seconds
        • Custom script: call RemoveRect (udg_TempReg)
      • Else - Actions
        • Do nothing
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Number of units in (Units in Yellow Respawn &lt;gen&gt;)) Equal to 0
      • Then - Actions
        • Custom script: call DestroyGroup (udg_TempGroup)
        • Skip remaining actions
      • Else - Actions
        • Do nothing

...
this continues for every value 1-8
...
Trigger:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • NumberRed Equal to 8.00
    • Then - Actions
      • Set TempReg = Battle42 &lt;gen&gt;
      • If ((Number of units in (Units in TempReg)) Equal to 0) then do (Unit Group - Pick every unit in TempGroup and do (Unit - Move (Picked unit) instantly to (Random point in TempReg))) else do (Do nothing)
      • Wait 0.05 seconds
      • Custom script: call RemoveRect (udg_TempReg)
    • Else - Actions
      • Do nothing
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Number of units in (Units in Green Respawn &lt;gen&gt;)) Equal to 0
      • Then - Actions
        • Custom script: call DestroyGroup (udg_TempGroup)
        • Skip remaining actions
      • Else - Actions
        • Trigger - Run (This trigger) (ignoring conditions)


There's a lot of code, and I can't figure where's the failure...
 

Joccaren

You can change this now in User CP.
Reaction score
54
Could you please put it in WC3 tags so its easier to read?
 

DoomedDude

New Member
Reaction score
1
No one sees anything wrong with this?
Tried to fix it again for half an hour.. can't find what makes them tele to the middle..
 

DoomedDude

New Member
Reaction score
1
Uploaded the map with the trigger, removed some crap.
If someone could check and try to fix this, I'd appreciate.
Thanks~~
 

Attachments

  • Help with randomizer.w3x
    113.2 KB · Views: 135

Happy

Well-Known Member
Reaction score
71
3 things...

1. delete these waits...they are useless.
2. delete the "do nothing" 's....sometimes they cause bugs.
3. you set a real meansits not 1,2,3,4,5,6,7 or 8 its most of the time something like 1,23 or 5,49....set number red = random integer between 1 and 8.
 

DoomedDude

New Member
Reaction score
1
1: if you DLed the map, there are no waits.
2: It has not do nothings anymore
3: It is random integer *Set NumberRed = (Real((Random integer number between 1 and 8)))*
 

DoomedDude

New Member
Reaction score
1
Argh.... Wasted another 4 hours trying to make this work.
Used 4 different ways with totally different code.
Everytime few units went to middle of the map.
If someone could make me a randomizer that picks those 8 groups and puts them into 8 different places, I'd be really, really happy. I'm giving up on this...

EDIT: I know what's wrong, but I can't figure how to fix it: Even if the condition is false, it will still trigger the *then - actions*
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top