Unit Enters Region

Smitty

Member
Reaction score
20
I have a trigger which uses the event 'a unit enters a region', and then displays a text message to all players. The problem is that if I enter the region, then leave and go back in, it shows the message the first time, but not any time subsequent to that. Anyone got any idea what gives? Thanks in advance :)
 

Yoww89

New Member
Reaction score
0
It should work just fine. See my attached example.

The problem must be in your trigger. If you could paste it here we'll see what's wrong.
 

Attachments

  • Region.w3x
    16.7 KB · Views: 124

vypur85

Hibernate
Reaction score
803
Because you create and destroyed 'All player'. The player group is not supposed to be destroyed because it doesn't leak. Just a guess.
 

Smitty

Member
Reaction score
20
Doesn't sound right. Here are the triggers... there's quite a lot. Sorry XD

Trigger:
  • Ants Nest Stand on Entry Region
    • Events
      • Unit - A unit enters Region 003 <gen>
      • Unit - A unit enters Region 004 <gen>
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Unit Group - Add (Triggering unit) to AntsNestMaybe
      • Player Group - Add (Owner of (Triggering unit)) to TempPlayerGroup
      • Game - Display to TempPlayerGroup the text: Do you wish to pay ...
      • Custom script: call DestroyForce(udg_TempPlayerGroup)


Trigger:
  • Ants Nest Leave Entry Region
    • Events
      • Unit - A unit leaves Region 004 <gen>
      • Unit - A unit leaves Region 003 <gen>
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Unit Group - Remove (Triggering unit) from AntsNestMaybe


Trigger:
  • Ants Nest Accepted
    • Events
    • Conditions
      • (Number of units in (Units owned by (Triggering player) matching (((Matching unit) is in AntsNestMaybe) Equal to True))) Equal to 1
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering player) Current gold) Greater than or equal to 250
        • Then - Actions
          • Set TempGroup = (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to True))
          • Set TempPoint = (Center of Region 005 <gen>)
          • Set TempPoint2 = (Center of Region 011 <gen>)
          • Unit Group - Pick every unit in TempGroup and do (Actions)
            • Loop - Actions
              • Unit - Move (Picked unit) instantly to TempPoint, facing TempPoint2
              • Unit Group - Remove (Picked unit) from AntsNestMaybe
              • Unit Group - Add (Picked unit) to AntsNestRunners
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Triggering player) is in Sentinel) Equal to True
                • Then - Actions
                  • Unit Group - Add (Picked unit) to AntsNestRunnersSentinel
                • Else - Actions
                  • Unit Group - Add (Picked unit) to AntsNestRunnersScourge
          • Player - Set (Triggering player) Current gold to (((Triggering player) Current gold) - 250)
          • Camera - Pan camera for (Triggering player) to TempPoint over 0.00 seconds
          • Set AntsNestHeroCount = (Real((Number of units in AntsNestRunners)))
          • Custom script: call RemoveLocation(udg_TempPoint)
          • Custom script: call RemoveLocation(udg_TempPoint2)
          • Custom script: call DestroyGroup (udg_TempGroup)
        • Else - Actions
          • Player Group - Add (Owner of (Triggering unit)) to TempPlayerGroup
          • Game - Display to TempPlayerGroup the text: You do not have eno...
          • Custom script: call DestroyForce(udg_TempPlayerGroup)


Trigger:
  • Ants Nest During Reset
    • Events
      • Unit - A unit enters Region 003 <gen>
      • Unit - A unit enters Region 004 <gen>
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Player Group - Add (Owner of (Triggering unit)) to TempPlayerGroup
      • Game - Display to TempPlayerGroup the text: Please wait up to a...
      • Custom script: call DestroyForce(udg_TempPlayerGroup)


These are the triggers dealing directly with the regions. The events to the triggers containing chat strings are added at map initialization by another trigger.

Here are the other triggers, since they turn on/off various others. But I'm sure the necessary triggers are left ON at the end.

Trigger:
  • Ants Nest Setup
    • Events
      • Game - AntsNestHeroCount becomes Greater than 0.00
    • Conditions
    • Actions
      • Set TempPoint = (Center of Region 005 <gen>)
      • Set TempPoint2 = (Center of Region 011 <gen>)
      • Unit - Create 1 Queen Ant for Player 11 (Dark Green) at TempPoint2 facing TempPoint
      • AI - Ignore (Last created unit)'s guard position
      • Set QueenAnt = (Last created unit)
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Custom script: call RemoveLocation(udg_TempPoint2)
      • Trigger - Turn on Ants Nest AI <gen>
      • Trigger - Turn off (This trigger)


Trigger:
  • Ants Nest Hero Dies or Leaves
    • Events
      • Unit - A unit Dies
      • Unit - A unit leaves Region 009 <gen>
    • Conditions
      • ((Triggering unit) is in AntsNestRunners) Equal to True
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is in AntsNestRunnersSentinel) Equal to True
        • Then - Actions
          • Unit Group - Remove (Triggering unit) from AntsNestRunnersSentinel
        • Else - Actions
          • Unit Group - Remove (Triggering unit) from AntsNestRunnersScourge
      • Unit Group - Remove (Triggering unit) from AntsNestRunners
      • Set AntsNestHeroCount = (Real((Number of units in AntsNestRunners)))
      • Set TempGroup = (Units in Region 009 <gen> owned by (Owner of (Triggering unit)))
      • Unit Group - Pick every unit in TempGroup and do (Unit - Kill (Picked unit))
      • Custom script: call DestroyGroup (udg_TempGroup)
      • Unit Group - Pick every unit in Ants and do (Unit - Order (Picked unit) to Attack (Random unit from AntsNestRunners))


Trigger:
  • Ants Nest Reset
    • Events
      • Game - AntsNestHeroCount becomes Equal to 0.00
    • Conditions
    • Actions
      • Trigger - Turn off Ants Nest Victory <gen>
      • Game - Display to (All players) the text: Some bunch of poor ...
      • Trigger - Turn off Ants Nest Stand on Entry Region <gen>
      • Trigger - Turn on Ants Nest During Reset <gen>
      • Trigger - Turn off Ants Nest AI <gen>
      • Set QueenAnt = No unit
      • Set TempGroup = (Units in Region 009 <gen> matching ((((Matching unit) is alive) Equal to True) and ((Owner of (Matching unit)) Not equal to Player 11 (Dark Green))))
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Unit - Make (Picked unit) Vulnerable
          • Unit - Kill (Picked unit)
      • Custom script: call DestroyGroup (udg_TempGroup)
      • Wait 60.00 seconds
      • Set TempGroup = (Units in Region 009 <gen> matching ((((Matching unit) is alive) Equal to True) and ((Matching player) Equal to Player 11 (Dark Green))))
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Unit - Make (Picked unit) Vulnerable
          • Unit - Kill (Picked unit)
      • Custom script: call DestroyGroup (udg_TempGroup)
      • Trigger - Turn on Ants Nest AI <gen>
      • Trigger - Turn on Ants Nest Setup <gen>
      • Trigger - Turn on Ants Nest Stand on Entry Region <gen>
      • Trigger - Turn off Ants Nest During Reset <gen>
      • Trigger - Turn on Ants Nest Victory <gen>


Trigger:
  • Ants Nest Victory
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Triggering unit) Equal to QueenAnt
    • Actions
      • Trigger - Turn off Ants Nest Stand on Entry Region <gen>
      • Trigger - Turn off Ants Nest Reset <gen>
      • Trigger - Turn on Ants Nest During Reset <gen>
      • Game - Display to (All players) the text: A band of warriors ...
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Killing unit) is in AntsNestRunnersSentinel) Equal to True
        • Then - Actions
          • Unit Group - Pick every unit in AntsNestRunnersSentinel and do (Actions)
            • Loop - Actions
              • Player - Set (Owner of (Picked unit)) Current gold to (((Owner of (Picked unit)) Current gold) + 100)
        • Else - Actions
          • Unit Group - Pick every unit in AntsNestRunnersScourge and do (Actions)
            • Loop - Actions
              • Player - Set (Owner of (Picked unit)) Current gold to (((Owner of (Picked unit)) Current gold) + 100)
      • Wait 2.00 seconds
      • Set TempPoint = (Center of Region 003 <gen>)
      • Unit Group - Pick every unit in AntsNestRunnersSentinel and do (Actions)
        • Loop - Actions
          • Unit - Move (Picked unit) instantly to TempPoint
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Set TempPoint = (Center of Region 004 <gen>)
      • Unit Group - Pick every unit in AntsNestRunnersScourge and do (Actions)
        • Loop - Actions
          • Unit - Move (Picked unit) instantly to TempPoint
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Unit Group - Remove all units of AntsNestRunners from AntsNestRunners
      • Set QueenAnt = No unit
      • Set TempGroup = (Units in Region 009 <gen> matching ((((Matching unit) is alive) Equal to True) and ((Matching player) Not equal to Player 11 (Dark Green))))
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Unit - Make (Picked unit) Vulnerable
          • Unit - Kill (Picked unit)
      • Custom script: call DestroyGroup (udg_TempGroup)
      • Wait 60.00 seconds
      • Set TempGroup = (Units in Region 009 <gen> matching ((((Matching unit) is alive) Equal to True) and ((Matching player) Equal to Player 11 (Dark Green))))
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Unit - Make (Picked unit) Vulnerable
          • Unit - Kill (Picked unit)
      • Custom script: call DestroyGroup (udg_TempGroup)
      • Custom script: call DestroyGroup (udg_TempGroup)
      • Trigger - Turn off Ants Nest During Reset <gen>
      • Trigger - Turn on Ants Nest Stand on Entry Region <gen>
      • Trigger - Turn on Ants Nest Reset <gen>


there are others referring to specifics regarding the area, but they don't turn any triggers on or off. So, anyone able to see the problem? :( Thanks for the help ^^

EDIT: I know I destroyed TempGroup twice. Ignore it :p
 

Smitty

Member
Reaction score
20
I know double post, but;

To explain, just in case, what I want is for the trigger 'ants nest stand on entry region' to be on as standard. Ants nest during reset (off at initialisation) should be turned on during Ants Nest victory or reset, whilst stand on entry region is off. But this doesn't seem to be the case. Even just having the first trigger enabled and not the rest, it only occurs once.
 

vypur85

Hibernate
Reaction score
803
You shouldn't add Players into group and destroy them...
Try this:
Code:
    Set TempPlayerGroup = ......
    Game - Display to TempPlayerGroup the text: Please wait up to a...
    Custom script: call DestroyForce(udg_TempPlayerGroup)
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
It is, the problem with adding players/units to player groups / unit groups is that the groups have to exist beforehand in order to work.
if you destroy a group with custom text to prevent leaks you really destroy that group. You cannot add anything to the group afterwards.
You would need to create a new group first by setting the variable to a group.
 
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