• 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.
  • It's time for the first HD Modeling Contest of 2025. Join the theme discussion for Hive's HD Modeling Contest #7! Click here to post your idea!

Need help with a couple of triggers!

Status
Not open for further replies.
Level 7
Joined
Apr 3, 2009
Messages
318
HELP PLEASE!!

I need help with periodic unit spawning, not just that I know how to make units spawn every x seconds and everything, I know all the basics and a little bit of advanced things HOWEVER, I need help with this:

•How can I make units spawn in a region for the player who owns a certain building?

•Giving a building to player who is attacking it and then healing the building to 100% when it's health is under 10%

Ok, here is how I want it to work..
Yellows village spawns 10 nord recruits (periodic spawn in region trigger) and red attacks, red defeats yellow's recruits and brings the village's health down to 9%, the village is then given to red AND the village now spawns the nord recruits for player red instead of yellow.

How can I do this? Thanks :)
 
1)
  • Trigger1
  • Events
    • Time - Every 10.00 seconds of game-time
  • Conditions
  • Actions
    • Player Group - Pick every player in (All players) and do (Actions)
      • Loop - Actions
        • Custom script: set bj_wantDestroyGroup = true
        • Unit Group - Pick every unit in (Units owned by (Picked player) of type Barracks) and do (Actions)
          • Loop - Actions
            • Set Point[1] = (Position of (Picked unit))
            • Set Region1 = (Region centered at (Point[1]) with size (300.00, 300.00)
            • Set Point[2] = (Random point in Region1)
            • Unit - Create 3 Footman for (Owner of (Picked unit)) at Point[2] facing default building degrees
            • Custom script: call RemoveLocation (udg_Point[1])
            • Custom script: call RemoveRect (udg_Region1)
            • Custom script: call RemoveLocation (udg_Point[2])
2)
  • Trigger1
  • Events
    • Map Initialization
  • Conditions
  • Actions
    • Custom script: set bj_wantDestroyGroup = true
    • Unit Group - Pick every unit in (Units in (Playable Map Area)) and do (Actions)
      • Loop - Actions
        • Trigger - Add to Trigger3 <gen> the event (Unit - (Picked unit) takes damage)
  • Trigger2
  • Events
    • Unit - A unit enters (Playable Map Area)
  • Conditions
  • Actions
    • Trigger - Add to Trigger3 <gen> the event (Unit - (Triggering unit) takes damage)
  • Trigger3
  • Events
  • Conditions
    • ((Triggering unit) is a structure) Equal to True
    • (Percentage life of (Triggering unit)) Less than (or Equal to) 10
    • ((Damage source) belongs to an enemy of (Owner of (Triggering unit))) Equal to True
  • Actions
    • Unit - Order (Damage source) to Stop
    • Unit - Change ownership of (Triggering unit) to (Owner of (Damage source))
    • Unit - Set percentage life of (Ownership-changed unit) to 100%
 
Status
Not open for further replies.
Top