• 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] Heros and Spellbooks.

Status
Not open for further replies.
Level 9
Joined
Jun 7, 2008
Messages
440
I got a herotavern that can sell heros. My problem is when a certain hero is sold, I want the computer to create the 4 spellbooks and give it to the hero. Ive tried triggering it, but im messing up somewhere. Any ideas?
  • Events
    • Unit - A unit owned by Neutral Passive Sells a unit
  • Conditions
    • ((Unit-type of (Selling unit)) Equal to Hero Select 1 (Lordaeron Summer))
  • Actions
    • Unit - Remove (Buying unit) from the game
    • If (((Buying unit) belongs to an ally of Player 10 (Light Blue)) Equal to True) then do (Set RandomUnitLight = (Buying unit)) else do (Set RandomUnitDark = (Buying unit))
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • ((Buying unit) belongs to an ally of Player 10 (Light Blue)) Equal to True
      • Then - Actions
        • Set RandomUnitLight = (Sold unit)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of (Sold unit)) Equal to Wizard
          • Then - Actions
            • Hero - Create Spellbooks[1] and give it to Hero
            • Hero - Create Spellbooks[2] and give it to Hero
            • Hero - Create Spellbooks[3] and give it to Hero
            • Hero - Create Spellbooks[4] and give it to Hero
          • Else - Actions
        • Unit - Move RandomUnitLight instantly to (Center of Light Teleport Base <gen>)
        • Camera - Pan camera for (Owner of RandomUnitLight) to (Center of Light No Entry Zone <gen>) over 2.00 seconds
        • Custom script: call SetPlayerPrefix(udg_RandomUnitLight)
        • Set Players_Hero[(Player number of (Owner of (Buying unit)))] = RandomUnitLight
        • Game - Display to (All allies of Player 12 (Brown)) the message: (Player_Color[(Player number of (Triggering player))] + ( has selected: |cffffcc00 + ((Name of RandomUnitLight) + |r)))
        • Unit - Set mana of RandomUnitLight to 100.00%
        • Unit Group - Add RandomUnitLight to LightHero
        • Set RandomUnitLight = No unit
        • Cinematic - Fade in over 2.00 seconds using texture Dream and color (100.00%, 100.00%, 100.00%) with 0.00% transparency
      • Else - Actions
        • Set RandomUnitDark = (Sold unit)
        • Unit - Move RandomUnitDark instantly to (Center of Dark Teleport Base <gen>)
        • Camera - Pan camera for (Owner of (RandomUnitDark)) to (Center of Dark Teleport Base <gen>) over 2.00 seconds
        • Custom script: call SetPlayerPrefix(udg_RandomUnitDark)
        • Set Players_Hero[(Player number of (Owner of (Entering unit)))] = RandomUnitDark
        • Game - Display to (All allies of Player 10 (Light Blue)) the message: (Player_Color[(Player number of (Triggering player))] + ( has selected: |cffffcc00 + ((Name of RandomUnitDark) + |r)))
        • Unit - Set mana of RandomUnitDark to 100.00%
        • Unit Group - Add RandomUnitDark to DarkHero
        • Set RandomUnitDark = No unit
        • Cinematic - Fade in over 2.00 seconds using texture Dream and color (100.00%, 100.00%, 100.00%) with 0.00% transparency
Ya, I set the spellbooks into an array.
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
You are repeating 2 IF/THEN/ELSE statment.

  • If (((Buying unit) belongs to an ally of Player 10 (Light Blue)) Equal to True) then do (Set RandomUnitLight = (Buying unit)) else do (Set RandomUnitDark = (Buying unit))
You don't need this action because you are repeating it in the next action also you are setting either the variable RandomUnitLight or RandomUnitDark to (Buying unit) then in the following action setting them to (Sold unit) like this:

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • ((Buying unit) belongs to an ally of Player 10 (Light Blue)) Equal to True
    • Then - Actions
      • Set RandomUnitLight = (Sold unit)
      • -------- the rest of THEN actions --------
    • Else - Actions
      • Set RandomUnitDark = (Sold unit)
      • -------- the rest of ELSE actions --------
 
Status
Not open for further replies.
Top