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

Help with a trigger

Status
Not open for further replies.
Level 3
Joined
Feb 13, 2008
Messages
65
Hey, ive been working on a hero arena map, and ive been trying to create a script so that when a hero dies, he loses half of his gold which is divided amongst the team of the player that killed the hero.

Heres what i have so far

  • Events
    • Unit - A unit Dies
  • Conditions
  • ((Triggering unit) is A Hero) Equal to True
  • Actions
    • Player Group - Pick every player in (All enemies of (Triggering player)) and do (actions)
      • -Loop - Actions
        • Player - Add (((Triggering player)Current Gold)/10) to (Picked player)Current gold
        • Player - Set (Triggering Player) Current gold to (((triggering player)Current gold)/2)
The part that divides the triggering player's gold by half works, but the part that adds the gold to the team of the member that killed the player does not. Any ideas?
 
Level 3
Joined
Feb 13, 2008
Messages
65
In the All Players Of; Change it to all allies of killing unit, and for the resource ammounts, change the player to owner of triggering unit.

Hmm ok, this is what i have now:

  • Events
  • Unit - A Unit Dies
  • Conditions
  • ((triggering unit) is A hero)Equal to true
  • Actions
    • Player group - Pick every player in ((all enemies of (Triggering player) and do (actions)
      • Loop - Actions
        • Player - Add(((Owner of (triggering unit))Current Gold) / 10) to (Owner of ((Picked unit))Current Gold
        • Player - Set(((triggering player)Current Gold to (((Triggering Player) Current Gold) / 2)
And unfortunatly its still not working
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Remove more of the triggering players.

Also put the halve the gold action outside the loop actions otherwise it will not do what you want.

Also you may wish to imrpove your money divide system as currently it will add 1/2 of his money (if you fix the above) to everyone who is enemy to the unit even if they are playing or not. This will cause big problems with incomplete games as even if it is 1 v 1, the other player will still get 1/5 of what he should get.
 
Level 3
Joined
Feb 13, 2008
Messages
65
Remove more of the triggering players.



Also put the halve the gold action outside the loop actions otherwise it will not do what you want.

Also you may wish to imrpove your money divide system as currently it will add 1/2 of his money (if you fix the above) to everyone who is enemy to the unit even if they are playing or not. This will cause big problems with incomplete games as even if it is 1 v 1, the other player will still get 1/5 of what he should get.

Had a temporary fix prepared for that. Basically the idea i had was, a trigger that every 30 seconds would take the money collected by players that arnt in the game anymore, and would distribute it amongst the players who are. But need to fix this one first =x


Did the half the gold action outside the loop, thanks for that ^^
 
Level 3
Joined
Feb 13, 2008
Messages
65
Still have issues with this.

Currently its:

  • Events
    • Unit - A Unit Dies
  • Conditions
    • ((Killing unit) is a Hero)Equal to True
    • ((Dying unit) is a Hero)Equal to True
  • Actions
    • Player Group - Pick ever player in (All allies of (Owner of (Killing unit))) and do (Player - Add (((triggering player) current gold / 10) to (Picked player) current gold)
    • Player - Set (Triggering player) Current Gold to (((Triggering player) Current Gold / 2)
Any ideas?
 
Level 14
Joined
Nov 4, 2006
Messages
1,241
couldn't you just do one action for each player? its a bit more work maybe depending on how many teams you have, you would need one trigger for each team, use your trigger but add as condition owner of killing unit is an ally of (any player from team1)
and action:
add triggering player current gold/10 to player 1
add triggering player current gold/10 to player 2
add triggering player current gold/10 to player 3
...
and another trigger for the other team(s)

maybe i got this wrong, but if you want 1/10 of triggering players gold to be split up in the killing team, you have to do this:
add (triggering player current gold/10)/(number of players in team1) to player 1 instead of the upper ones

you see its a bit more work but it should work
 
Level 4
Joined
Dec 16, 2007
Messages
134
I got you problem now Fixed...
Here is the Trigger :

  • Untitled Trigger 001
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) is A Hero) Equal to True
    • Actions
      • Player Group - Pick every player in (Player group((Owner of (Dying unit)))) and do (Actions)
        • Loop - Actions
          • Player - Add (((Picked player) Current gold) / 2) to (Owner of (Killing unit)) Current gold
          • Player - Set (Picked player) Current gold to (((Picked player) Current gold) / 2)
Also the problem why your trigger is not working because you use Triggering Player instead of Owner of Dying unit or Killing Unit
 
Status
Not open for further replies.
Top