Unit Spawning Problem

Xebarsis

New Member
Reaction score
7
In my map, every time you die you respawn on a random point in the playable map area. However, there are four regions I NEVER want a unit to respawn in.

I have some conditions that are supposed to prevent this, but units are still occasionally spawning in the regions and I'm not sure why:

Trigger:
  • Spawner
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
    • Set ThePoint = (Random point in (Playable map area))
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Or - Any (Conditions) are true
          • Conditions
            • (EastCOP <gen> contains ThePoint) Equal to True
            • (WestCOP <gen> contains ThePoint) Equal to True
            • (NorthCOP <gen> contains ThePoint) Equal to True
            • (SouthCOP <gen> contains ThePoint) Equal to True
      • Then - Actions
        • Trigger - Run (This trigger) (ignoring conditions)
      • Else - Actions
        • Unit - Create 1 Peasant for (Owner of (Dying unit)) at ThePoint facing Default building facing degrees
 

XxShadyxX

I abused the rep system.
Reaction score
81
does the Run (This trigger) (ignoring conditions)
have anything to do with it? o_O

Also make the part with the conditions in a Or - conditions

Your checking if ThePoint is in ALL of those regions at the same time, i suggest you put them as Or
 

vypur85

Hibernate
Reaction score
803
Code:
Set ThePoint = (Random point in (Playable map area))
Set Integer = 0
For loop Integer A from 1 to 4 do...
   Loop - Actions
      If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
              (YourRegion[Integer A] contains ThePoint) Equal to True
          Then - Actions
              Set Integer = Integer + 1
          Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
   If - Conditions
      Integer Equal to 4
   Then - Actions
      Trigger - Run (This trigger) (ignoring conditions)
   Else - Actions
      Unit - Create 1 Peasant for (Owner of (Dying unit)) at ThePoint facing Default building facing degrees

Not sure how much difference does this make, but worth a try. Hope it doesn't cause critical error.

Edit:
You need to set all your regions to arrayed variables.
 

Xebarsis

New Member
Reaction score
7
I changed it to checking conditions, and everything is already in an "Or" condition.

Trigger:
  • Spawner
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
    • Set ThePoint = (Random point in (Playable map area))
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Or - Any (Conditions) are true
          • Conditions
            • (EastCOP <gen> contains ThePoint) Equal to True
            • (WestCOP <gen> contains ThePoint) Equal to True
            • (NorthCOP <gen> contains ThePoint) Equal to True
            • (SouthCOP <gen> contains ThePoint) Equal to True
      • Then - Actions
        • Trigger - Run (This trigger) (checking conditions)
      • Else - Actions
        • Unit - Create 1 Peasant for (Owner of (Dying unit)) at ThePoint facing Default building facing degrees


Units are can still spawn in the four regions.

Edit: Okay, it turns out that when they do spawn in the regions, it's only the very edge. So, I can just make four more regions that are just outside the boundaries of the current regions I have to negate this. Thanks for your help.
 

N2o)

Retired.
Reaction score
51
Just something to note, but if you run the trigger a second time, how does the game know who the (Owner of (Dying Unit)) is? Unless im being rather stupid, there isn't a Dying Unit if its run another time.
 
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