• 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] Hatch Eggs ability

Status
Not open for further replies.
Level 8
Joined
Dec 29, 2006
Messages
359
I have an ability called Hatch Eggs, which is used to, you guessed it, hatch eggs. This map i am working on atm has five different types of eggs, living eggs, dead eggs, infected eggs, wood eggs, and gold eggs. I want to make a trigger that, when Hatch Eggs is cast (which is by the way, based off of war stomp, if that helps) it will destroy every egg within 250 of the caster, and spawn something according to the type of egg destroyed. Also, the eggs should only spawn these things if they die from the hatch eggs effect.

Living Eggs spawn allied units when hatched.
Dead Eggs spawn corpses when hatched.
Infected Eggs spawn enemy units when hatched.
Wood Eggs add wood to the player's stock when hatched.
Gold Eggs add gold to the player's stock when hatched.

Thanks to anyone who can help me make this trigger!
 
Level 7
Joined
Jun 16, 2008
Messages
253
I'm having to guess this from memory.

Stick all eggs, existing and created into a unit group variable.

Event - A unit casts an ability

Conditions - Ability is equal to (Hatch Eggs)

Actions -

/-Pick group and actions-/
Pick every unit in /-unit group-/ (every unit in 250 range of (casting unit)) matching /-boolean I think-/ unit is in /-unit group variable-/ (Eggs)
then- kill (picked unit)
else - whatever :D



Another trigger with a 'when a generic unit dies',

Put five 'if,then,elses' in the trigger each with the unit-type condition 'unit type is equal to (insert egg unit type here)'
then,
remove (triggering unit) from /-unit group-/ (Eggs)
and
(whatever action you want, like 'create 5 footmen at position of (triggering unit) for Player 1.

Rinse and repeat for other four 'if,then,elses'.

That's what I'd do anyway, but I don't have a lot of mapping experience. Think that covers it.
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
  • Untitled Trigger 001
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to (==) Animate Dead
    • Actions
      • Set temp_point = (Position of (Triggering unit))
      • Set temp_group = (Units within 250.00 of temp_point matching (((Matching unit) is alive) Equal to (==) True))
      • Custom script: call RemoveLocation(udg_temp_point)
      • Unit Group - Pick every unit in temp_group and do (Actions)
        • Loop - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Matching unit)) Equal to (==) Living Egg
            • Then - Actions
              • Set temp_point = (Position of (Picked unit))
              • Unit - Kill (Picked unit)
              • Unit - Create 1 Footman for (Owner of (Triggering unit)) at temp_point facing Default building facing (270.0) degrees
              • Custom script: call RemoveLocation(udg_temp_point)
            • Else - Actions
              • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of (Matching unit)) Equal to (==) Dead Egg
                • Then - Actions
                  • Set temp_point = (Position of (Picked unit))
                  • Unit - Kill (Picked unit)
                  • Unit - Create a Footman corpse for (Owner of (Triggering unit)) at temp_point
                  • Custom script: call RemoveLocation(udg_temp_point)
                • Else - Actions
                  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of (Matching unit)) Equal to (==) Infected Egg
                    • Then - Actions
                      • Set temp_point = (Position of (Picked unit))
                      • Unit - Kill (Picked unit)
                      • Unit - Create 1 Footman for Neutral Hostile at temp_point facing Default building facing (270.0) degrees
                      • Custom script: call RemoveLocation(udg_temp_point)
                    • Else - Actions
                      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Unit-type of (Matching unit)) Equal to (==) Gold Egg
                        • Then - Actions
                          • Unit - Kill (Picked unit)
                          • Player - Set (Owner of (Triggering unit)) Current gold to (((Owner of (Triggering unit)) Current gold) + 50)
                        • Else - Actions
                          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Unit-type of (Matching unit)) Equal to (==) Wood Egg
                            • Then - Actions
                              • Unit - Kill (Picked unit)
                              • Player - Set (Owner of (Triggering unit)) Current lumber to (((Owner of (Triggering unit)) Current lumber) + 50)
                            • Else - Actions
      • Custom script: call DestroyGroup(udg_temp_group)
 
Level 8
Joined
Dec 29, 2006
Messages
359
most of the trigger looks good, but why set temp_point to a location, then remove the location an action later without using the location for anything?
 
Level 8
Joined
Dec 29, 2006
Messages
359
idk, i cant get it to work, iv been looking around for like 2 hours trying to figure out whats wrong. Ill post the map so people can look through it, maybe someone can figure out whats wrong. Oh and just so u know, its a campaign, so you cant go to custom game when opening it.
 

Attachments

  • Bug Campaign.w3x
    77 KB · Views: 64
  • Carathid Campaign.w3n
    1.2 MB · Views: 48
Level 12
Joined
Apr 27, 2008
Messages
1,228
This one got me.
Too lazy to examine carefully, but it seems it is an issue with that being a campaign(NO idea what I am talking about, haven't done any of those :p )
P.s. Why did you attach Bug Campaign.w3x it is sort of empty without the campaign.
 
Level 8
Joined
Dec 29, 2006
Messages
359
I attached it because its part of Carathid Campaign.w3n. I thought you would need it or the campaign would work right or something.
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
Bug Campaign.w3x is sort of empty(no triggers, no custom objects). (maybe that is the reason; don't know, I don't do campaigns, yet)
All of these are in the campaign.
 
Last edited:
Level 6
Joined
Jul 25, 2005
Messages
221
I'd just like to add, on top of all the things you've just said and mention the names of your egg hatching... thing...

Living Eggs spawn allied units when hatched.
Dead Eggs spawn corpses when hatched.
Infected Eggs spawn enemy units when hatched.
Wooden Eggs add wood to the player's stock when hatched.
Golden Eggs add gold to the player's stock when hatched.

Should be correct usage of grammar, but hey, what do I know? I'm freggin Swede :)
 
Status
Not open for further replies.
Top