• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Point variable moves!

Status
Not open for further replies.
Level 14
Joined
Aug 30, 2004
Messages
909
I have a variable called SpawnPointEmpire. At the start of the map I set it equal to the center of a region called Star Destroyer Spawn. I then have a periodic trigger that spawns enemies and tells them to attack-move to that point. I become concerned because the enemies, after a while, would start going to the center of the map instead. I put a test trigger that pinged the location of the point variable, and sure enough after a while it moves from the center of that region to the center of the map.

According to the object editor I use the variable in 5 triggers:
1. The test trigger that pings the location
2. The initial trigger that sets the point to that location and orders units to attack move toward it.
3. Three triggers that periodically spawn enemies and tell them to attack.

I've deleted the variable (then put it back) to see all the actions that depend on it. It is assigned only once at a trigger that fires only once! The point variable is never deleted using JASS custom script to avoid leaks.

The only thing I can think of is that I assign another point variable to "random point in Star Destroyer Spawn" and then I use JASS custom script to "removeLocation" on that variable. Is it possible that the random point is sometimes hitting the center of the region, then I remove that location and the center of the region gets destroyed or something crazy like that?

EDIT: I forgot to mention the units that move to the middle use triggered movement. The ground units ordered to go to the point go nowhere. The pings on the point hit the middle of the map though.

The triggers are below in case you want to see them.

  • test Copy
    • Events
      • Player - Player 1 (Red) types a chat message containing test as An exact match
    • Conditions
    • Actions
      • Cinematic - Ping minimap for (All players) at SpawnPointEmpire for 10.00 seconds
      • Cinematic - Ping minimap for (All players) at SpawnPointRebel for 10.00 seconds
  • Scenario
    • Events
      • Player - Player 1 (Red) types a chat message containing start as An exact match
      • Player - Player 2 (Blue) types a chat message containing start as An exact match
    • Conditions
    • Actions
      • Set sc1EmpireCap = Imperial Star Destroyer 0016 <gen>
      • Set sc1RebelCap = Rebel Base 0025 <gen>
      • Set SpawnPointEmpire = (Center of Star Destroyer Spawn <gen>)
      • Set SpawnPointRebel = (Center of Calamari Cruiser Spawn <gen>)
      • Set spawnRebel = 8
      • Set spawnEmpire = 8
      • Trigger - Turn on Scenario spawn <gen>
      • Trigger - Turn on Scenario spawn bombers <gen>
      • Trigger - Turn on Scenario Update Bombers <gen>
      • -------- --- --------
      • -------- spawn opening ships --------
      • -------- --- --------
      • Set CreationShipType = TIE Fighter AI
      • Set CreationPlayerOwner = Player 12 (Brown)
      • Set CreationPoint = (Random point in Star Destroyer Spawn <gen>)
      • Set CreationAngle = 180.00
      • Set CreationSpeed = 12.00
      • Set CreationAIBoolean = True
      • Set CreationEnemy = No unit
      • Trigger - Run Create New Ship <gen> (ignoring conditions)
      • Custom script: call RemoveLocation (udg_CreationPoint)
      • Wait 0.10 game-time seconds
      • Set CreationPoint = (Random point in Star Destroyer Spawn <gen>)
      • Trigger - Run Create New Ship <gen> (ignoring conditions)
      • Set CreationEnemy = sc1RebelCap
      • Set CreationShipType = TIE Bomber AI
      • Set CreationSpeed = 9.00
      • Set CreationPoint = (Random point in Star Destroyer Spawn <gen>)
      • Trigger - Run Create New Ship <gen> (ignoring conditions)
      • Custom script: call RemoveLocation (udg_CreationPoint)
      • Set CreationPoint = (Random point in Star Destroyer Spawn <gen>)
      • Trigger - Run Create New Ship <gen> (ignoring conditions)
      • Custom script: call RemoveLocation (udg_CreationPoint)
      • -------- AI --------
      • Wait 0.10 game-time seconds
      • Unit Group - Pick every unit in (Units owned by Player 12 (Brown) of type TIE Fighter AI) and do (Set defaultMove[(Custom value of (Picked unit))] = HeroSpawnPointRebel)
      • -------- ------------------------------ --------
      • -------- ------------------------------ --------
      • -------- spawn opening ships --------
      • Set CreationShipType = Z-95 POS AI
      • Set CreationPlayerOwner = Player 11 (Dark Green)
      • Set CreationPoint = (Random point in Calamari Cruiser Spawn <gen>)
      • Set CreationAngle = 180.00
      • Set CreationSpeed = 14.00
      • Set CreationAIBoolean = True
      • Set CreationEnemy = No unit
      • Trigger - Run Create New Ship <gen> (ignoring conditions)
      • Custom script: call RemoveLocation (udg_CreationPoint)
      • -------- ------------------------------ --------
      • Wait 0.10 game-time seconds
      • Set CreationShipType = Z-95 POS AI
      • Set CreationPlayerOwner = Player 11 (Dark Green)
      • Set CreationPoint = (Random point in Calamari Cruiser Spawn <gen>)
      • Set CreationAngle = 180.00
      • Set CreationSpeed = 14.00
      • Set CreationAIBoolean = True
      • Set CreationEnemy = No unit
      • Trigger - Run Create New Ship <gen> (ignoring conditions)
      • Custom script: call RemoveLocation (udg_CreationPoint)
      • Set CreationEnemy = sc1EmpireCap
      • Set CreationShipType = Ywing Assault Fighter AI
      • Set CreationSpeed = 10.00
      • Set CreationPoint = (Random point in Calamari Cruiser Spawn <gen>)
      • Trigger - Run Create New Ship <gen> (ignoring conditions)
      • Custom script: call RemoveLocation (udg_CreationPoint)
      • -------- AI --------
      • Wait 0.10 game-time seconds
      • -------- leak --------
      • Unit Group - Pick every unit in (Units owned by Player 11 (Dark Green) of type Z-95 POS AI) and do (Set defaultMove[(Custom value of (Picked unit))] = SpawnPointEmpire)
      • -------- ------------------------------ --------
  • Scenario spawn
    • Events
      • Time - Every 65.00 seconds of game time
    • Conditions
    • Actions
      • Set SpawnPointEmpire = (Center of Star Destroyer Spawn <gen>)
      • Set SpawnPointRebel = (Center of Calamari Cruiser Spawn <gen>)
      • Unit - Create spawnRebel Rebel Marine for Player 11 (Dark Green) at SpawnPointRebel facing Default building facing degrees
      • Unit - Create 1 T4-B Heavy Tank for Player 11 (Dark Green) at SpawnPointRebel facing Default building facing degrees
      • Unit - Create spawnEmpire Storm Trooper for Player 12 (Brown) at SpawnPointEmpire facing Default building facing degrees
      • Unit - Create 1 ATST for Player 12 (Brown) at SpawnPointEmpire facing Default building facing degrees
      • -------- - --------
      • -------- order attacks --------
      • -------- - --------
      • Set tempUnitGroup = (Units owned by Player 11 (Dark Green) of type Rebel Marine)
      • Unit Group - Pick every unit in tempUnitGroup and do (Unit - Order (Picked unit) to Attack-Move To SpawnPointEmpire)
      • Set tempUnitGroup = (Units owned by Player 11 (Dark Green) of type T4-B Heavy Tank)
      • Unit Group - Pick every unit in tempUnitGroup and do (Unit - Order (Picked unit) to Attack-Move To SpawnPointEmpire)
      • Set tempUnitGroup = (Units owned by Player 12 (Brown) of type Storm Trooper)
      • Unit Group - Pick every unit in tempUnitGroup and do (Unit - Order (Picked unit) to Attack-Move To SpawnPointRebel)
      • Set tempUnitGroup = (Units owned by Player 12 (Brown) of type ATST)
      • Unit Group - Pick every unit in tempUnitGroup and do (Unit - Order (Picked unit) to Attack-Move To SpawnPointRebel)
      • Custom script: call DestroyGroup( udg_tempUnitGroup)
  • Scenario Spawn Sandpeople
    • Events
      • Time - Every 95.00 seconds of game time
    • Conditions
    • Actions
      • Set SpawnPointEmpire = (Center of Star Destroyer Spawn <gen>)
      • Set SpawnPointRebel = (Center of Calamari Cruiser Spawn <gen>)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SandPeople Equal to True
        • Then - Actions
          • Unit - Create 8 Tusken Raider for Player 12 (Brown) at SandPeoplePointSpawn facing Default building facing degrees
          • Set tempUnitGroup = (Last created unit group)
          • Unit Group - Pick every unit in tempUnitGroup and do (Unit - Order (Picked unit) to Attack-Move To SpawnPointRebel)
          • Custom script: call DestroyGroup( udg_tempUnitGroup)
        • Else - Actions
          • Unit - Create 8 Tusken Raider for Player 12 (Brown) at SandPeoplePointSpawn facing Default building facing degrees
          • Set tempUnitGroup = (Last created unit group)
          • Unit Group - Pick every unit in tempUnitGroup and do (Unit - Order (Picked unit) to Attack-Move To SpawnPointEmpire)
          • Custom script: call DestroyGroup( udg_tempUnitGroup)
  • Scenario spawn bombers
    • Events
      • Time - Every 180.00 seconds of game time
    • Conditions
    • Actions
      • Set SpawnPointEmpire = (Center of Star Destroyer Spawn <gen>)
      • Set SpawnPointRebel = (Center of Calamari Cruiser Spawn <gen>)
      • Set CreationShipType = Z-95 POS AI
      • Set CreationPlayerOwner = Player 11 (Dark Green)
      • Set CreationPoint = (Random point in Calamari Cruiser Spawn <gen>)
      • Set CreationAngle = 180.00
      • Set CreationSpeed = 14.00
      • Set CreationAIBoolean = True
      • Set CreationEnemy = No unit
      • Trigger - Run Create New Ship <gen> (ignoring conditions)
      • Custom script: call RemoveLocation (udg_CreationPoint)
      • -------- tie --------
      • Set CreationShipType = TIE Fighter AI
      • Set CreationPlayerOwner = Player 12 (Brown)
      • Set CreationPoint = (Random point in Star Destroyer Spawn <gen>)
      • Set CreationAngle = 180.00
      • Set CreationSpeed = 12.00
      • Set CreationAIBoolean = True
      • Set CreationEnemy = No unit
      • Trigger - Run Create New Ship <gen> (ignoring conditions)
      • Custom script: call RemoveLocation (udg_CreationPoint)
      • -------- EMPIRE --------
      • Set CreationShipType = TIE Bomber AI
      • Set CreationPlayerOwner = Player 12 (Brown)
      • Set CreationPoint = (Random point in Star Destroyer Spawn <gen>)
      • Set CreationAngle = 180.00
      • Set CreationSpeed = 9.00
      • Set CreationAIBoolean = True
      • Set CreationEnemy = No unit
      • Set CreationPoint = (Random point in Star Destroyer Spawn <gen>)
      • Trigger - Run Create New Ship <gen> (ignoring conditions)
      • Custom script: call RemoveLocation (udg_CreationPoint)
      • Set CreationPoint = (Random point in Star Destroyer Spawn <gen>)
      • Trigger - Run Create New Ship <gen> (ignoring conditions)
      • Custom script: call RemoveLocation (udg_CreationPoint)
      • Wait 0.10 game-time seconds
      • Game - Display to (All allies of Player 1 (Red)) the text: |c00FF0000WARNING|r...
      • Sound - Play Warning <gen>
      • -------- --------Leaks below --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random real number between 1.00 and 3.00) Greater than or equal to 2.00
        • Then - Actions
          • Unit Group - Pick every unit in (Units owned by Player 12 (Brown) of type TIE Bomber AI) and do (Set defaultMove[(Custom value of (Picked unit))] = (Center of Bomber Relay North <gen>))
        • Else - Actions
          • Unit Group - Pick every unit in (Units owned by Player 12 (Brown) of type TIE Bomber AI) and do (Set defaultMove[(Custom value of (Picked unit))] = (Center of Bomber Relay South <gen>))
      • -------- REBELs --------
      • Set CreationPlayerOwner = Player 11 (Dark Green)
      • Set CreationShipType = Ywing Assault Fighter AI
      • Set CreationAngle = 180.00
      • Set CreationSpeed = 10.00
      • Set CreationAIBoolean = True
      • Set CreationEnemy = No unit
      • Set CreationPoint = (Random point in Calamari Cruiser Spawn <gen>)
      • Trigger - Run Create New Ship <gen> (ignoring conditions)
      • Custom script: call RemoveLocation (udg_CreationPoint)
      • Set CreationPoint = (Random point in Calamari Cruiser Spawn <gen>)
      • Trigger - Run Create New Ship <gen> (ignoring conditions)
      • Custom script: call RemoveLocation (udg_CreationPoint)
      • Wait 0.10 game-time seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random real number between 1.00 and 3.00) Greater than or equal to 2.00
        • Then - Actions
          • Unit Group - Pick every unit in (Units owned by Player 11 (Dark Green) of type Ywing Assault Fighter AI) and do (Set defaultMove[(Custom value of (Picked unit))] = (Center of Bomber Relay North <gen>))
        • Else - Actions
          • Unit Group - Pick every unit in (Units owned by Player 11 (Dark Green) of type Ywing Assault Fighter AI) and do (Set defaultMove[(Custom value of (Picked unit))] = (Center of Bomber Relay South <gen>))
      • Game - Display to (All allies of Player 2 (Blue)) the text: |c00FF0000WARNING|r...
      • Unit Group - Pick every unit in (Units owned by Player 11 (Dark Green) of type Z-95 POS AI) and do (Set defaultMove[(Custom value of (Picked unit))] = SpawnPointEmpire)
      • Unit Group - Pick every unit in (Units owned by Player 12 (Brown) of type TIE Fighter AI) and do (Set defaultMove[(Custom value of (Picked unit))] = SpawnPointRebel)
 
Last edited:
Level 5
Joined
Mar 22, 2009
Messages
170
As a note, in this trigger, you are leaking 4 groups, you create 5 there, and only destroy one at the end. I am still looking for the cause of the problem.

  • Set tempUnitGroup = (Units owned by Player 11 (Dark Green) of type Rebel Marine)
  • Unit Group - Pick every unit in tempUnitGroup and do (Unit - Order (Picked unit) to Attack-Move To SpawnPointEmpire)
  • Set tempUnitGroup = (Units owned by Player 11 (Dark Green) of type T4-B Heavy Tank)
  • Unit Group - Pick every unit in tempUnitGroup and do (Unit - Order (Picked unit) to Attack-Move To SpawnPointEmpire)
  • Set tempUnitGroup = (Units owned by Player 12 (Brown) of type Storm Trooper)
  • Unit Group - Pick every unit in tempUnitGroup and do (Unit - Order (Picked unit) to Attack-Move To SpawnPointRebel)
  • Set tempUnitGroup = (Units owned by Player 12 (Brown) of type ATST)
  • Unit Group - Pick every unit in tempUnitGroup and do (Unit - Order (Picked unit) to Attack-Move To SpawnPointRebel)
  • Custom script: call DestroyGroup( udg_tempUnitGroup)
 
Level 8
Joined
Jun 26, 2010
Messages
530
What is that default move variable?

Also, as far as i know/happened to me, every time a point returns ((Center Of(Playable Map Area)) is because that point does not exist any more, like, for example, when you create a special effect in the position of a unit that is dead and long gone.
 
Level 14
Joined
Aug 30, 2004
Messages
909
What is that default move variable?

Also, as far as i know/happened to me, every time a point returns ((Center Of(Playable Map Area)) is because that point does not exist any more, like, for example, when you create a special effect in the position of a unit that is dead and long gone.

defaultMove is where a unit is ordered to go after they kill their enemy. So every unit has a "target" enemy. If it dies, they go to the default. That appears to work fine though; as my test PING showed, it's a point that is moving. That point is never reassigned via a "set variable" action. It must be being destroyed, but I've never done a custom script "RemoveLocation" action on it directly.

I've taken to just reassigning the variable to the center of the region every time I spawn people. That appears to fix it.

p.s. Good call Master, +rep
 
Status
Not open for further replies.
Top