• 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.

[Trigger] question

Status
Not open for further replies.
Level 9
Joined
Jun 20, 2008
Messages
476
I made an little script for spawning zombies and stuff that they shutdown etc
But i want to have them walk everywhere on the site can someone tell me bout that?
It whas something like

  • event
  • Time-every 5 seconds of game
  • condition
  • action
  • unit-create 1 zombie for neutral hostile at center of 001 rect
  • unit-create 1 zombie for neutral hostile at center of 002 rect
  • unit-create 1 zombie for neutral hostile at center of 003 rect
  • unit-create 1 zombie for neutral hostile at center of 004 rect
  • unit-create 1 zombie for neutral hostile at center of 005 rect
  • Time-wait 1200 seconds
  • Trigger-Remove this trigger
Just want them to wander or go straight to player red till darkgreen.
 
Level 16
Joined
May 1, 2008
Messages
1,605
Seas =)

WoW ... I realy understand nothing ^^

Lets clear your Question:
1) "I made an little script for spawning zombies and stuff that they shutdown etc"
1.1) Means that you want create zombies at some rects? "They shutdown" - you mean that the zombies should die after some time or the trigger should turned off after some time)

2) "But i want to have them walk everywhere on the site can someone tell me bout that?"
2.1) You mean, that the created zombies should walk over the map?
 
Level 9
Joined
Jun 20, 2008
Messages
476
Seas =)

WoW ... I realy understand nothing ^^

Lets clear your Question:
1) "I made an little script for spawning zombies and stuff that they shutdown etc"
1.1) Means that you want create zombies at some rects? "They shutdown" - you mean that the zombies should die after some time or the trigger should turned off after some time)

2) "But i want to have them walk everywhere on the site can someone tell me bout that?"
2.1) You mean, that the created zombies should walk over the map?

ment that i made an script wich creates zombie after 2 minutes the script removes itself but i want all created somzibes to wander or go straight to enemy
 
Level 16
Joined
May 1, 2008
Messages
1,605
Seas =)

ok, for me its still hard english you use but i will try to help =)

1) The normal spawn for your Zombies are:

  • Create Zombies
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • Unit - Create 1 Zombie for Neutral Hostile at (Center of (Your Rect)) facing Default building facing (270.0) degrees
      • Unit - Create 1 Zombie for Neutral Hostile at (Center of (Your Rect)) facing Default building facing (270.0) degrees
      • Unit - Create 1 Zombie for Neutral Hostile at (Center of (Your Rect)) facing Default building facing (270.0) degrees
      • Unit - Create 1 Zombie for Neutral Hostile at (Center of (Your Rect)) facing Default building facing (270.0) degrees
      • Unit - Create 1 Zombie for Neutral Hostile at (Center of (Your Rect)) facing Default building facing (270.0) degrees
      • Unit - Create 1 Zombie for Neutral Hostile at (Center of (Your Rect)) facing Default building facing (270.0) degrees
  • Remove Create Zombies
    • Events
      • Time - Elapsed game time is 1200.00 seconds
    • Conditions
    • Actions
      • Trigger - Turn off Create Zombies <gen>
2) If you got a base and you want, that your Zombie should attack the base and everything in the way between spawning and the base:

Create a rect at the middle of the base (I! named it BaseRect) and add this action after every "Unit - Create 1 Zombie" - Action:

  • Actions:
    • Unit - Order (Last created unit) to Attack-Move To (Center of (BaseRect))
3) If you want, that the created Zombie just should walk around the map and if an enemy comes close to the zombies, they should attack than use:

  • Pick Every Zombie
    • Events
      • Time - Every 5.01 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Zombie
            • Then - Actions
              • Unit - Order (Picked unit) to Attack-Move To (Center of (Playable map area))
            • Else - Actions
              • Do nothing
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Note:
Your trigger has a lot of leaks, I suggest fixing them.
If you do not fix these leaks, there is a chance for a server-split and it will certainly cause lag.
Also, the "Do Nothing" action is futile, it actually doesn't do anything at all, so you can leave it out...
It's good to have it in a test-trigger, so you can see there is really nothing, but don't add it in the actual trigger, it's just wasted time.

The things that leak in this trigger:
- Unit Group
- Location

The fix (example trigger):
  • Pick Every Zombie
  • Events
    • Time - Every 5.01 seconds of game time
  • Conditions
  • Actions
    • Set TempUnitGroup = (Units in (Playable map area))
    • Unit Group - Pick every unit in (TempUnitGroup) and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Unit-type of (Picked unit)) Equal to Zombie
      • Then - Actions
        • Set TempLoc = (Center of Playable map area)
        • Unit - Order (Picked unit) to Attack-Move To (TempLoc)
        • Custom Script: call RemoveLocation(udg_TempLoc)
      • Else - Actions
    • Custom script: call DestroyGroup(udg_TempUnitGroup)
For further info on leaks, check this thread: Things that Leak
 
Level 9
Joined
Jun 20, 2008
Messages
476
  • Create Zombies
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • Unit - Create 1 Zombie for Neutral Hostile at (Center of (Your Rect)) facing Default building facing (270.0) degrees
      • Unit - Create 1 Zombie for Neutral Hostile at (Center of (Your Rect)) facing Default building facing (270.0) degrees
      • Unit - Create 1 Zombie for Neutral Hostile at (Center of (Your Rect)) facing Default building facing (270.0) degrees
      • Unit - Create 1 Zombie for Neutral Hostile at (Center of (Your Rect)) facing Default building facing (270.0) degrees
      • Unit - Create 1 Zombie for Neutral Hostile at (Center of (Your Rect)) facing Default building facing (270.0) degrees
      • Unit - Create 1 Zombie for Neutral Hostile at (Center of (Your Rect)) facing Default building facing (270.0) degrees
      • Time - Elapsed game time is 1200.00 seconds
      • Trigger - Remove (this) trigger
That whas it, but just want wander around and i got no idea what to do with custom triggers
 
Level 4
Joined
Mar 14, 2009
Messages
98
  • Zombie Roaming
    • Events
      • Time - Every 3.14 seconds of game time
    • Conditions
    • Actions
      • Set PlayableMapRect = (Playable map area)
      • Set ZombieGroup = (Units in PlayableMapRect matching ((Unit-type of (Matching unit)) Equal to Zombie))
      • Unit Group - Pick every unit in ZombieGroup and do (Actions)
        • Loop - Actions
          • Set ZombieDestination = (Random point in PlayableMapRect)
          • Unit - Order (Picked unit) to Attack-Move To ZombieDestination
          • Custom script: call RemoveLocation(udg_ZombieDestination)
      • Custom script: call DestroyGroup(udg_ZombieGroup)
If possible, it's best to initialize PlayableMapRect elsewhere so that it won't have to run so much. You can also change it to a more specified rect(or region in GUI) like a graveyard or something. Also, it's best to add zombies to the group as they're created so you won't have to create groups and get rid of leaking groups every five seconds.
 
Last edited:
Status
Not open for further replies.
Top