• 🏆 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!

[General] Need help with a unit spawn (sort of)

Status
Not open for further replies.
Level 12
Joined
Mar 30, 2013
Messages
664
Iv'e created a map for about 1 year ago an epic map size. And the category is Defence/survival, where the player got a main hero and his tasks is to protect allied cities from the attackers. His seconds mission is to create a base for him self when he got the resources to do it. If you want to see the terrain on how the map is (picutres): http://www.hiveworkshop.com/forums/members/227524-albums6510.html

Ok. My problem is that the enemies who are going to attack randomly cities that the player are allied to. Is going spawn and attack. I got 3 Spawn points where the enemies attack. But the triggering is to hard and i tried to figure out how to do it for about 4 months now. When i tried the spawning, like first time, they was OK. They did move but didnt attack. Altought i tought i needed Variables to store the spawned units (im not good at variables so it can be that...
Heres my tiggers for the enemies spawn/move.

  • Spawning
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • Set tempPoint = (Center of EVIL SPAWN 1 <gen>)
      • Unit - Create 1 Legionare for Player 1 (Red) at tempPoint facing 0.00 degrees
      • Unit Group - Add (Last created unit) to UnitSpawnGroup
      • Unit - Create 1 Commandre for Player 1 (Red) at tempPoint facing 0.00 degrees
      • Unit Group - Add (Last created unit) to UnitSpawnGroup
      • Custom script: call RemoveLocation( udg_tempPoint)
      • Custom script: set udg_tempPoint = null
      • Set tempPoint = (Center of EVIL SPAWN 2 <gen>)
      • Unit - Create 1 Dimension Magican for Player 1 (Red) at tempPoint facing 0.00 degrees
      • Unit Group - Add (Last created unit) to UnitSpawnGroup
      • Unit - Create 1 Demon Hound for Player 1 (Red) at tempPoint facing 0.00 degrees
      • Unit Group - Add (Last created unit) to UnitSpawnGroup
      • Custom script: call RemoveLocation( udg_tempPoint)
      • Custom script: set udg_tempPoint = null
      • Set tempPoint = (Center of EVIL SPAWN 3 <gen>)
      • Unit - Create 1 Demon Beast Rider for Player 1 (Red) at tempPoint facing 0.00 degrees
      • Unit Group - Add (Last created unit) to UnitSpawnGroup
      • Unit - Create 1 Infernal Knight for Player 1 (Red) at tempPoint facing 0.00 degrees
      • Unit Group - Add (Last created unit) to UnitSpawnGroup
      • Custom script: call RemoveLocation( udg_tempPoint)
  • Attacking
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in UnitSpawnGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Current order of (Picked unit)) Equal to (Order(stop))
            • Then - Actions
              • Unit - Order (Picked unit) to Attack (Random unit from allUnitsInMap)
            • Else - Actions


I got as variables:

-allUnitsinmap variable type: unit group initial type Zero
-teamGroup variable type: unit group initial type Zero
-tempPoint variable type: Point initial type NONE
-UnitSpawnGroup variable type: unit group initial type Zero

Can some one help me with this, so i can be done with my map? :) :grin:
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
Each unit has its own string or integer variable that corresponds to the last taken order.
Initially, it is empty - "" or 0(?)
Empty does not mean null in this case.
After it has finished an order it will be "stop" or 851972

So essentially you have to check for both.
 
Status
Not open for further replies.
Top