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

Spawn in a different place every time?

Status
Not open for further replies.
Level 7
Joined
Sep 14, 2008
Messages
339
Hi Im trying to make my trigger spawn the units in a different spot of the map every time the game starts. What am i doing wrong?. Help will be appreciated and +rep!

  • Spawn Trigger
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • Unit - Create 1 Nightmare for Neutral Hostile at (Random point in (Playable map area)) facing Default building facing degrees
      • Unit - Create 1 Nightmare for Neutral Hostile at (Random point in (Playable map area)) facing Default building facing degrees
      • Unit - Create 1 Nightmare for Neutral Hostile at (Random point in (Playable map area)) facing Default building facing degrees
      • Unit - Create 1 Nightmare for Neutral Hostile at (Random point in (Playable map area)) facing Default building facing degrees
      • Unit - Create 1 Nightmare for Neutral Hostile at (Random point in (Playable map area)) facing Default building facing degrees
      • Unit - Create 1 Nightmare for Neutral Hostile at (Random point in (Playable map area)) facing Default building facing degrees
      • Unit - Create 1 Nightmare for Neutral Hostile at (Random point in (Playable map area)) facing Default building facing degrees
      • Unit - Create 1 Nightmare for Neutral Hostile at (Random point in (Playable map area)) facing Default building facing degrees
      • Unit - Create 1 Nightmare for Neutral Hostile at (Random point in (Playable map area)) facing Default building facing degrees
      • Unit - Create 1 Nightmare for Neutral Hostile at (Random point in (Playable map area)) facing Default building facing degrees
I am also trying to figure out how to make the unit move around the map at free will how would i do this? Help appreciated!
 
First of all, go to File -> Preferences -> Test Map and untick the option "Use fixed random seed", so that it doesn't use the same random points everytime (If you launch the map via the game itself, the points will be totally random, like you want them to be. It's that Test Map option that doesn't create total randomness, when testing it via the World Editor; so, in order to achieve the in-game randomness, untick that option).

Secondly, Use this instead:
  • Trigger
  • Events
    • Map Initialization
  • Conditions
  • Actions
    • For each (IntegerA) from 1 to 10, do (Actions)
      • Loop - Actions
        • Set Points[(IntegerA)] = (Random point in (Playable Map Area))
        • Unit - Create 1 Nightmare for Neutral Hostile at Points[(IntegerA)] facind Default building degrees
        • Custom script: call RemoveLocation (udg_Points[GetForLoopIndexA()])
Finally, either add to them the ability "Wander (Neutral)" or use a periodioc timer to order them to move to a random point in the playable map area, e.g.:
  • Trigger2
  • Events
    • Time - Every 7.00 seconds of game-time
  • Conditions
  • Actions
    • Custom script: set bj_wantDestroyGroup = true
    • Unit Group - Pick every unit in (Units owned by Neutral Hostile) and do (Actions)
      • Loop - Actions
        • If (All conditions are true) then do (Actions) else do (Actions)
          • If - Conditions
            • (Current order of (Picked unit)) Equal to (order(<Empty String>))
          • Then - Actions
            • Set Points[1] = (Position of (Picked unit))
            • Set Points[2] = (Points[1] offset by (Random real between 200.00 and 500.00) towards (Random angle))
            • Unit - Order (Picked unit) to Move to Points[2]
            • Custom script: call RemoveLocation (udg_Points[1])
            • Custom script: call RemoveLocation (udg_Points[2])
To get (order(<Empty String>)), delete the default "stop" and press Enter, so that the field stays blank (without even typing the space bar). It will check if the unit is idle at that very moment.
 
Level 7
Joined
May 18, 2010
Messages
264
should add patrol not move to cuz if he attacks that unit = it will just move .. not fight pack
and point1 point2 (are points ...)
now when unit comes near point 2
redo points or make the 3 4 so it moves not there and back
takes me hour to think what i have to tipe.. sry
btw what are u making?
and wont the unit go alwais str8 ?.( random angel fix)
 
Last edited:
Level 7
Joined
Sep 14, 2008
Messages
339
Okay i will try that pharaoh!


Edit: Where is Random Real between 200.00 and 500.00?

I cant find it and Wander isnt working too well they dont move far enough
 
Last edited:
Level 33
Joined
Mar 27, 2008
Messages
8,035
Hey, you should listen to tw3ye's suggestion
Order the (Picked Unit) to Patrol instead of just Move, the unit will NOT be aggresive and won't be able to fight back, making the game.... BORING
But Pharaoh_'s trigger can be used in Escape Map, to make the game unpredictable
 
Status
Not open for further replies.
Top