• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

unit spawning and roaming help please

Status
Not open for further replies.
Level 6
Joined
Oct 29, 2010
Messages
171
alright so i want to make it so once a gate is destroyed certain places on the map start spawning units, the units wonder around everywhere attacking everyone they see. The only way to stop the spawning is by destroying this tower, how do i make a trigger like this?
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,219
well, first we want it to start when the gate dies
  • start spawn
    • Events
      • Destructible - Elven Gate (Diagonal 1) 0001 <gen> dies
    • Conditions
    • Actions
      • Trigger - Turn loop


and then you turn a loop trigger
the loop trigger is how ofen the units should spawn so lets say every 30 seconds
  • spawning
    • Events
      • Time - Every 30.00 seconds of game time
    • Conditions
    • Actions
      • Unit - Create 15 Footman for Neutral Hostile at loc facing Default building facing degrees
now you want them to stop spawning when a tower dies huh?
  • stop spawn
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Guard Tower
    • Actions
      • Trigger - Turn off (loop)
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
well, first we want it to start when the gate dies
  • start spawn
    • Events
      • Destructible - Elven Gate (Diagonal 1) 0001 <gen> dies
    • Conditions
    • Actions
      • Trigger - Turn loop


and then you turn a loop trigger
the loop trigger is how ofen the units should spawn so lets say every 30 seconds
  • spawning
    • Events
      • Time - Every 30.00 seconds of game time
    • Conditions
    • Actions
      • Unit - Create 15 Footman for Neutral Hostile at loc facing Default building facing degrees
now you want them to stop spawning when a tower dies huh?
  • stop spawn
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Guard Tower
    • Actions
      • Trigger - Turn off (loop)

Don't make him confuse about Trigger - Turn on/off (loop)

It should be

  • Trigger - Turn on spawning <gen>
  • Trigger - Turn off stop spawn <gen>
He'll understand better
 
Level 7
Joined
Sep 9, 2007
Messages
253
I might be wrong here but I'm sure someone will correct me if I am....

The loop trigger (the second one) should be turned off at the start of the game, otherwise units will start spawning as soon as the game starts. To do this in the trigger editor: right click on the loop trigger and untick the option which says "initially on". This means that the trigger will be turned off at the start of the game and it will only be switched on when the gate is destroyed.
 
Here you should understand how it work, just edit setup trigger and everything else will work fine...

EDIT:

I might be wrong here but I'm sure someone will correct me if I am....

The loop trigger (the second one) should be turned off at the start of the game, otherwise units will start spawning as soon as the game starts. To do this in the trigger editor: right click on the loop trigger and untick the option which says "initially on". This means that the trigger will be turned off at the start of the game and it will only be switched on when the gate is destroyed.
That triggers won't work at first place,, trigger names are different, there is no defined variable loc etc etc.
It's just example what trigger should do, unfortunately example is bad, for 10 gates you will need to have 30 triggers.
In mine 2 triggers do everything, if you need it jass everything can be placed into 1 trigger.
I used same time interval and same spawn units owner, if you need this changed as well then trigger need to be split because of different even that will trigger them (in GUI).
 

Attachments

  • test map.w3x
    21.8 KB · Views: 79
Level 6
Joined
Oct 29, 2010
Messages
171
alright thank you very much but i still need to know how to make the units walk around randomly as soon as they spawn and attacking all player units/buildings and doodad gates

because you see the whole idea of this is so that once the gates are opened a dark army is unleashed on the land and to stop it you have to destroy the dark tower lol so could you give me a better example of that with like an orc unit kobas? TY for the help already though guys
 
Last edited:
Level 33
Joined
Mar 27, 2008
Messages
8,035
Add Tornado Wander (Tornado) ability to the units.

Object editor -> Abilities tab -> CTRL + F -> wander -> Select that ability as your base ability

Next, to edit the field of the ability:

Stats - Area of Effect: This determines how big your unit will go randomly.
Stats - Cast Range: Just put it the same value as above field.
Stats - Duration - Hero/Unit: This determines how long does the unit goes to that direction before changing its direction.

Done. You have your unit to walk 'randomly' across the map, with your own settings via Object Editor.

You can also order your unit to attack its way to the main point; let's say your unit is spawned from the west and your HQ (or main position) is on the middle of the map, you can order directly to your spawned units to move-attack to the east direction

By ordering attack-move, the unit will attack anything that is enemy for him but this won't give you the feeling of 'random movement' as you can see its pattern is reaching towards easy, in orderly manner that is very much different to Wander Ability
 
Level 6
Joined
Oct 29, 2010
Messages
171
alright but the roaming units are computers so how do i get the computers to attack units/buildings and ALSO i need it to attack doodad gates. and also can i set them to randomly choose a place and attack it? and if so and if its a trigger can you show me howq to do it?
 
Level 8
Joined
Jan 8, 2010
Messages
493
a sample random-attacking trigger would be like:
  • Events
    • Time - Every 2.00 seconds of game time
  • Actions
    • Unit Group - Pick every Unit owned by Computer Player and do Actions
      • Unit - Order unit to Attack-Move to Location
..where Location is anywhere in a region you want the unit to attack move. the trigger simply commands the unit to attack move to that location, which changes periodically. it might not look like a real "wandering unit", but it should be able to attack any enemy unit it encounters while going to that location. also, you might want to try to make the doodad gate a unit and owned by an enemy player (though i haven't tried that) 'cause the unit will certainly only attack enemy units using this method.

btw, i haven't found any wander-attack AI system (maybe just didn't look well enough). you might to try to look at this:
AI Engage System
 
Status
Not open for further replies.
Top