Random Spawn Point Issue

Incognito

Member
Reaction score
1
This is a really strange one and I have been trying to fix it for a fair while.
The issue is that no matter what the unit will always spawn in the same spot even though the TempPoint is set at random point in playable map area, as shown below:

Spawn Trigger
Events
Time - Every 4.00 seconds of game time
Conditions
Actions
-------- - --------
-------- - --------
-------- Set Temps --------
Set TempRegionI = (Playable map area)
-------- - --------
-------- - --------
Set RanUseIntType1 = (Random integer number between 1 and 2)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
RanUseIntType1 Equal to 1
(Number of living Thing units owned by Player 1 (Red)) Less than 35
Then - Actions
Set TempPointI = (Random point in (Playable map area))
Unit - Create 1 Thing for Player 1 (Red) at TempPointI facing (Random angle) degrees
Set TempPointII = TempPointI
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Or - Any (Conditions) are true
Conditions
(Terrain pathing at TempPointII of type Floatability is off) Equal to False
(Terrain pathing at TempPointII of type Walkability is off) Equal to True
Then - Actions
Unit - Remove (Last created unit) from the game
Else - Actions
Unit - Create 1 Animation Heal for Neutral Passive at TempPointII facing Default building facing degrees
Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
Else - Actions
-------- - --------
-------- - --------
-------- Temp Kill --------
Custom script: call RemoveLocation (udg_TempPointI)
Custom script: call RemoveLocation (udg_TempPointII)
Custom script: call RemoveRect (udg_TempRegionI)
-------- - --------
-------- - --------
 

Incognito

Member
Reaction score
1
This is a really strange one and I have been trying to fix it for a fair while.
The issue is that no matter what the unit will always spawn in the same spot even though the TempPoint is set at random point in playable map area, as shown below:

lol yea in that piece of script TempPointII does nothing, just ignore, I was a bit lazy and couldn’t be bothered to take it out before I posted it here.
Regardless I don’t see how this would cause them to spawn in at the same point over and over again, furthermore this point has no significance whatsoever, its not within any region or at the point of any object or ever referred to for that matter.
Seriously I am stumped.
 

Gummi_Bears

New Member
Reaction score
5
Whats the point of setting TempRegion if when you set TempPoint to refer to playable area again :p. Maybe replace it to TempPoint = Random point in TempRegion. Probably won't work though, but worth a try. Nothing looks wrong in your trigger O_O. Right-click the trigger and click 'Copy as text' then use the trigger tags, (the yellow lower-case a) makes it easier for me to read :D
 

Moridin

Snow Leopard
Reaction score
144
This is because the world editor uses a fixed random seed for testing (Meaning all random values will be fixed in testing).

There are two ways to overcome this "problem":

1) Go and open up warcraft and play your map. Don't use the Test map button.
2) Goto the editor preferences (File -> Preferences) and uncheck "Use fixed random seed"

---------
On a side note:

1) You can display your triggers in a nicer format, to allow people to read them better, by posting them in WC3 tags. You need to type this:

[noparse]
Trigger:
  • <Post your trigger text here>
[/noparse]

2) You have set/destroyed at least 2 variables that you don't need :p. Refer to Gummi Bears' posts.
 

Incognito

Member
Reaction score
1
Good firkin God I swear if your right… im going to go check now…

Edit... sadly no it didnt help

Trigger:
  • Spawn Thing
    • Events
      • Time - Every 4.00 seconds of game time
    • Conditions
    • Actions
      • -------- - --------
      • -------- - --------
      • -------- Set Temps --------
      • Set TempRegionI = (Playable map area)
      • -------- - --------
      • -------- - --------
      • Set RanUseIntType1 = (Random integer number between 1 and 2)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RanUseIntType1 Equal to 1
          • (Number of living Thing units owned by Player 7 (Green)) Less than 35
        • Then - Actions
          • Set TempPointI = (Random point in (Playable map area))
          • Unit - Create 1 Thing for Player 7 (Green) at TempPointI facing (Random angle) degrees
          • Set TempPointII = TempPointI
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Terrain pathing at TempPointII of type Floatability is off) Equal to False
                  • (Terrain pathing at TempPointII of type Walkability is off) Equal to True
            • Then - Actions
              • Unit - Remove (Last created unit) from the game
            • Else - Actions
              • Unit - Create 1 Animation Heal for Neutral Passive at TempPointII facing Default building facing degrees
              • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
        • Else - Actions
      • -------- - --------
      • -------- - --------
      • -------- Temp Kill --------
      • Custom script: call RemoveLocation (udg_TempPointI)
      • Custom script: call RemoveLocation (udg_TempPointII)
      • Custom script: call RemoveRect (udg_TempRegionI)
      • -------- - --------
      • -------- - --------
 

Gummi_Bears

New Member
Reaction score
5
So all of our suggestions failed...lol. You mean my fail suggestion or Moridin's or both?
Edit: Wow...what the. I remade a trigger similiar to yours and guess what - they always spawn at the same spot?!?!? I already disabled 'use random seed' when testing. Could this be one of the epic holes of World Editor?

Theres my trigger:

Trigger:
  • Random Spawn
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Set TempRegion = (Playable map area)
      • Set TempPoint = (Random point in TempRegion)
      • Set RndInt = (Random integer number between 1 and 100)
      • Game - Display to (All players) the text: (String(RndInt))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RndInt Less than or equal to 50
        • Then - Actions
          • Unit - Create 1 Footman for Player 1 (Red) at TempPoint facing Default building facing degrees
        • Else - Actions
      • Custom script: call RemoveLocation (udg_TempPoint)
      • Custom script: call RemoveRect (udg_TempRegion)


The first spawn is always random, it works. But the second spawn and the third and the fourth, so on, just spawns in the middle always. :O
 

Incognito

Member
Reaction score
1
Sadly both, thx tho guys.

However i remade the trigger (Its seriously basicly the same)

Trigger:
  • Spawn Thing new
    • Events
      • Time - Every 4.00 seconds of game time
    • Conditions
    • Actions
      • -------- - --------
      • Set RanUseIntType1 = (Random integer number between 1 and 2)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RanUseIntType1 Equal to 1
        • Then - Actions
          • Set TempPointI = (Random point in (Playable map area))
          • Unit - Create 1 Thing for Player 7 (Green) at TempPointI facing Default building facing degrees
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Terrain pathing at TempPointI of type Walkability is off) Equal to True
                  • (Terrain pathing at TempPointI of type Floatability is off) Equal to False
            • Then - Actions
              • Unit - Remove (Last created unit) from the game
            • Else - Actions
              • Unit - Create 1 Animation Heal for Neutral Passive at TempPointI facing Default building facing degrees
              • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
          • -------- - --------
          • Custom script: call RemoveLocation (udg_TempPointI)
        • Else - Actions
      • -------- - --------




But if you guys could find the diffrence between the two, or help in some way it would really help, since id really rather not remake like 30 other trigger that are doing the same thing.




Btw thx for the tip about the trigger posting ^^
 

Moridin

Snow Leopard
Reaction score
144
Well it works for me :S. What exactly are you doing?

I used this trigger:
Trigger:
  • Spawn
    • Events
      • Player - Player 1 (Red) Presses the Left Arrow key
    • Conditions
    • Actions
      • Set Temp_Point = (Random point in (Playable map area))
      • Unit - Create 1 Footman for Player 1 (Red) at Temp_Point facing Default building facing degrees
      • Custom script: call RemoveLocation (udg_Temp_Point)


...and after testing and spamming the left arrow key for a bit, I got footmen in this arrangement:

randomunits.jpg


Edit: Btw, the middle units are my base because i didn't turn off the melee triggers.
Edit: I also notice that you have lots of comment tags. I dunno if this will help at all (prob not), but try deleting them.
 

Incognito

Member
Reaction score
1
Ah my bad for not mentioning, after I remade to the above, it worked perfectly fine, I don’t see what was wrong with the old one...

I guess its really less work to remake the 30-40 triggers that are doing the same thing (They all worked fine, I altered them recently to kill some leaks I didn’t know existed, something I did caused this)
 

Incognito

Member
Reaction score
1
lol I think u just cant set Temp regions



Edit: seems no responses in a bit, did we give up on these poor triggers?
 

Moridin

Snow Leopard
Reaction score
144
I think when you destroy the temp region you destroy the playable map area? :p I'm really not sure though.

Incognito, does it work finally or not? :S
 

Incognito

Member
Reaction score
1
Sorry for slow response
Yea I guess ill give up on what’s wrong and remake all the triggers, thx for all the help though guys
as always +rep all who contributed.


Edit: Ah seems i cant rep u again yet Moridin, soon enough tho.
 

chukky-jr

Member
Reaction score
15
call me an asshole or whatever for necroing this thread, but this might help

I think when you destroy the temp region you destroy the playable map area? :p I'm really not sure though.

Incognito, does it work finally or not? :S

i approve of this..

destroying TempRegion=(playable map area) actually cause the (playable map area) itself destroyed, causing any (random point in playable map area) is set to 0,0
 
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