• 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] Gold Gain from Kill

Status
Not open for further replies.
Level 2
Joined
Sep 1, 2011
Messages
20
I am having trouble having a player gain gold from killing a building but it doesn't seem to be happening and instead the owner of the building gains it instead. Please help me fix this.

  • Events: Unit - A unit Dies
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Unit-type of (Dying unit)) Equal to Rocket Tower
      • (Unit-type of (Killing unit)) Not equal to Slayer
      • (Unit-type of (Killing unit)) Not equal to Dwarf Slayer
      • (Unit-type of (Killing unit)) Not equal to Orc Slayer
      • (Unit-type of (Killing unit)) Not equal to Shadow Hunter
    • Then - Actions
      • Hero - Add 50 experience to (Killing unit), Hide level-up graphics
      • Player - Set (Triggering player) Current gold to 5
 
Level 2
Joined
Sep 1, 2011
Messages
20
well i got that, but the Player that is killing the building is not gaining the gold at all and the owner of the building is gaining it that's what i'm not getting at all. Example: I use a hero to kill a building and gain 5 gold, but when i do that it doesn't give the gold to me at all but to the other person being killed.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Player - Set (Triggering player) Current gold to 5
Working as intended. You are giving it to the triggering player which is the owner of the triggering unit which is the unit which caused the event (as the event is based on unit death, its the unit which died).

To make the script behave like you want it to, you will need to give the gold to the owner of the killing unit. There is a native which returns the killing unit and a native which takes a unit and returns its owner.
 
Level 2
Joined
Sep 1, 2011
Messages
20
Working as intended. You are giving it to the triggering player which is the owner of the triggering unit which is the unit which caused the event (as the event is based on unit death, its the unit which died).

To make the script behave like you want it to, you will need to give the gold to the owner of the killing unit. There is a native which returns the killing unit and a native which takes a unit and returns its owner.

So i have to make the gold trigger say something like: Add 5 to Player 1 (Red) current gold? or would it be something entirely different?
 
Level 4
Joined
Oct 20, 2011
Messages
129
  • Events: Unit - A unit Dies
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Unit-type of (Dying unit)) Equal to Rocket Tower
      • (Unit-type of (Killing unit)) Not equal to Slayer
      • (Unit-type of (Killing unit)) Not equal to Dwarf Slayer
      • (Unit-type of (Killing unit)) Not equal to Orc Slayer
      • (Unit-type of (Killing unit)) Not equal to Shadow Hunter
Think about it.
ok that sounds like it would work, but how would i set the part (Killing Unit)?
 
Level 2
Joined
Sep 1, 2011
Messages
20
To: ForeverBeADragon, Don't i feel retarded for the obvious xD. I will try that and see what happens.

Edit: I am seriously pulling my hair out cause this is still not working >.<. Here is the trigger as it stands:
  • Building Exp 1
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Dying unit)) Equal to Rocket Tower
          • (Unit-type of (Killing unit)) Equal to Balnazzar
          • (Unit-type of (Killing unit)) Equal to Asmodeus
          • (Unit-type of (Killing unit)) Equal to Archimonde
          • (Unit-type of (Killing unit)) Equal to Cryptic Evil One
          • (Unit-type of (Killing unit)) Equal to Vampiric Minion
          • (Unit-type of (Killing unit)) Not equal to Slayer
          • (Unit-type of (Killing unit)) Not equal to Dwarf Slayer
          • (Unit-type of (Killing unit)) Not equal to Orc Slayer
          • (Unit-type of (Killing unit)) Not equal to Shadow Hunter
        • Then - Actions
          • Hero - Add 50 experience to (Killing unit), Hide level-up graphics
          • Player - Add 5 to (Triggering player) Current gold
 
Last edited:
Your logic is flawed. You check if "all conditions are true" and then check if a unit is a certain type. A unit cannot be two types at once, so that function will always return false. One thing you could do is change all the comparisons to "Equal to false" and set it up like this:

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Unit-type of (Dying unit)) Not equal to Rocket Tower
      • (Unit-type of (Killing unit)) Not equal to Balnazzar
      • (Unit-type of (Killing unit)) Not equal to Asmodeus
      • (Unit-type of (Killing unit)) Not equal to Archimonde
      • (Unit-type of (Killing unit)) Not equal to Cryptic Evil One
      • (Unit-type of (Killing unit)) Not equal to Vampiric Minion
      • (Unit-type of (Killing unit)) Not equal to Slayer
      • (Unit-type of (Killing unit)) Not equal to Dwarf Slayer
      • (Unit-type of (Killing unit)) Not equal to Orc Slayer
      • (Unit-type of (Killing unit)) Not equal to Shadow Hunter
    • Then - Actions
    • Else - Actions
      • Hero - Add 50 experience to (Killing unit), Hide level-up graphics
      • Player - Add 5 to (Triggering player) Current gold
Edit: I just realized that you also have some "Not equal to" checks in there, in which case you can use this:

  • Or - (Any conditions are true)
    • Conditions -
 
Level 2
Joined
Sep 1, 2011
Messages
20
ok for one you copied the trigger wrong. it should say:
  • Building Exp 1
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Dying unit)) Equal to Rocket Tower
          • (Unit-type of (Killing unit)) Equal to Balnazzar
          • (Unit-type of (Killing unit)) Equal to Asmodeus
          • (Unit-type of (Killing unit)) Equal to Archimonde
          • (Unit-type of (Killing unit)) Equal to Cryptic Evil One
          • (Unit-type of (Killing unit)) Equal to Vampiric Minion
          • (Unit-type of (Killing unit)) Not equal to Slayer
          • (Unit-type of (Killing unit)) Not equal to Dwarf Slayer
          • (Unit-type of (Killing unit)) Not equal to Orc Slayer
          • (Unit-type of (Killing unit)) Not equal to Shadow Hunter
        • Then - Actions
          • Hero - Add 50 experience to (Killing unit), Hide level-up graphics
          • Player - Add 5 to (Triggering player) Current gold
Also what do you mean by this:
  • Or - (Any conditions are true)
  • Conditions
 
How is it that I "copied the trigger wrong"? I copied it and edited it.

  • Building Exp 1
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or (Any conditions are true)
            • Or - Conditions
              • (Unit-type of (Dying unit)) Equal to Rocket Tower
              • (Unit-type of (Killing unit)) Equal to Balnazzar
              • (Unit-type of (Killing unit)) Equal to Asmodeus
              • (Unit-type of (Killing unit)) Equal to Archimonde
              • (Unit-type of (Killing unit)) Equal to Cryptic Evil One
              • (Unit-type of (Killing unit)) Equal to Vampiric Minion
          • (Unit-type of (Killing unit)) Not equal to Slayer
          • (Unit-type of (Killing unit)) Not equal to Dwarf Slayer
          • (Unit-type of (Killing unit)) Not equal to Orc Slayer
          • (Unit-type of (Killing unit)) Not equal to Shadow Hunter
        • Then - Actions
          • Hero - Add 50 experience to (Killing unit), Hide level-up graphics
          • Player - Add 5 to (Triggering player) Current gold
 
Level 2
Joined
Sep 1, 2011
Messages
20
ok, sorry for the misunderstanding... so again what do you mean by this:
  • Or (All Conditons are true)- Conditions
Do i need to add something here? or take out something from original trigger?
 
Last edited:
Level 9
Joined
Jul 30, 2011
Messages
296
  • Building Exp 1
    • Events :
    • Unit - A unit Dies
      • Conditions :
        • Actions :
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Dying unit)) Equal to Rocket Tower
              • (Unit-type of (Killing unit)) Equal to Balnazzar
              • (Unit-type of (Killing unit)) Equal to Asmodeus
              • (Unit-type of (Killing unit)) Equal to Archimonde
              • (Unit-type of (Killing unit)) Equal to Cryptic Evil One
              • (Unit-type of (Killing unit)) Equal to Vampiric Minion
              • (Unit-type of (Killing unit)) Not equal to Slayer
              • (Unit-type of (Killing unit)) Not equal to Dwarf Slayer
              • (Unit-type of (Killing unit)) Not equal to Orc Slayer
              • (Unit-type of (Killing unit)) Not equal to Shadow Hunter
            • Then - Actions
        • Hero - Add 50 experience to (Killing unit), Hide level-up graphics
        • Player - Add 5 to (Owner of (Killing Unit)) Current gold
 
Status
Not open for further replies.
Top