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

Tracking assists on a hero kill

Status
Not open for further replies.
Level 3
Joined
Jul 12, 2005
Messages
48
Ok im sure some of you have played the map tides of blood. What im trying to do is recreate the text that displays after a hero kill. Example: <Player name> has killed <player name> with help from <player name> and <player name>. Thanks in advance.
 
Level 4
Joined
Jul 5, 2005
Messages
140
im trying to learn variables to use right now (im still fairly weak at them) but im preety sure you have to store the player names in variabels...witch you will use in the trigger when a hero unit dies....and for the people helping...you should add all allied heroes on a certain range.

i'll try to think of the trigger...but im pretty busy right now...i have to go to the market and stuff...so if anyone has an ideea before me please help him out
 
Level 3
Joined
Jul 12, 2005
Messages
48
If all i was going for was a trigger that said "<player> has killed <player>" i could do that blindfolded in under a minute. My problem, as the title suggests, is displaying who "helped" get the hero kill. Im finding this hard, becuase the number of players that helped isnt always set, as for example one time only 2 heros might of helped kill the hero, but the other time all 6 heros might of helped out in the hero kill. One solution i though of, is just giving assists to all units within range of the hero kill, but the trigger would not always be 100% correct, and im sort of keeping that solution as a last resort. Thanks anyways for your replies though, keep them coming.
 
Level 2
Joined
Nov 12, 2004
Messages
14
well this is easily done with a few triggers and variables....
each trigger is set up differently, like if you use heros as the only player units or whatever, maybe the target is a building i dont know, im going to explain it like it was everyone owns a hero. so then have a trigger like:

EVENT

a unit is attacked *GENERIC*

CONDITION

(Unit-Type of (attacked unit) is is A Hero) Equal True *BOOLEAN COMPARISON*

((Owner of (attacking unit) controller) equal user *PLAYER COMPARISION*

ACTION

Player Group - Add (Owner of (Attacking Unit)) to AssistingKillers(Player Number of (Owner of (attacked unit))) *PLAYER GROUP ADD*






on death trigger:
EVENT

unit - a unit dies

CONDITIONS

(Unit-Type of (dying unit) is is A Hero) Equal True *BOOLEAN COMPARISON*

ACTIONS

Set assistertexttemp = <empty Sting> *actually its nothing but game defaults nothing as empty string so dont type it in literally this is done to clear the variable*
Player Group - Remove (Owner of (killing unit) from AssistingKillers(player number of (owner of (dying unit)))
For Each (interger A) from 1 to (number of players in (assistingkillers(player number of (owner of (dying unit))), do actions
LOOP
Set assister temp = (random player from (Assistingkillers(player number of (owner of (dying unit)))))
Player group - remover assistertemp from assistingkillers(player number of (owner of (dying unit)))
set assistertexttemp = (assistertexttemp + (",~" + (name of assistertemp)))



*out of loop now*
game - display to (all players) the text: ((Name of (owner of (dying unit))) + (" was killed by " + ((Name of (owner of (killing unit))) + (" with help from" + (assistertexttemp + ".")))))







NECESARY VARIBLES-
assistingkillers(array - number of players playing) *PLAYER GROUP*
assistertemp *PLAYER*
assistertexttemp *STRING*


*i put in temp cause they are really only local variables, but i only know how to make global variables, so the temp tells me that its local FYI.
also all the quotes in the game diplay part are not necesary, i just did it to let you know, cause some have spaces at the end or beginging or whatnot that are hard to see without the quotes. and i know this is not the cleanest ways of doing things, but this is the simplest way i can explain to get it working on your map asap, any more questions let me know, if all comes to worse ill send you an example map if you really need it... also to make it display something besides 'Player 13" when the computer gets the kill just make a giant 'if then esle multiple funtions' in the actions where 'is contolled by a user' as the IF CONDITIONS, then the regular actions from above to display in the THEN. but in the ELSE part of that giant if, change it to display 'the computer' instead of the name of(owner of (killing unit))) whatever.... should be easy, very basic triggering. =)
 
Level 3
Joined
Jul 12, 2005
Messages
48
<3 thanks for the help. ok its not working quite right though. It just says "<player> was killed by <player> with help from . "

im pretty sure i did everything right, here il post my trigger just to see if it was just a typo i didnt catch.
Quote:
Events
Death Text
Events
Unit - A unit Dies
Conditions
((Owner of (Dying unit)) controller) Equal to User
((Unit-type of (Dying unit)) is A Hero) Equal to True
Actions
Set Assister_text_temp = <Empty String>
Player Group - Remove (Owner of (Killing unit)) from Assisting_killers[(Player number of (Owner of (Dying unit)))]
For each (Integer A) from 1 to (Number of players in Assisting_killers[(Player number of (Owner of (Dying unit)))]), do (Actions)
Loop - Actions
Set Assistser_temp = (Random player from Assisting_killers[(Player number of (Owner of (Dying unit)))])
Player Group - Remove Assistser_temp from Assisting_killers[(Player number of (Owner of (Dying unit)))]
Set Assister_text_temp = (Assister_text_temp + (,~ + (Name of Assistser_temp)))
Game - Display to (All players) the text: (|c00ffff00 + (((Name of (Owner of (Dying unit))) + |r) + ( was |c00ff0000killed|r by + ((Name of (Owner of (Killing unit))) + ( with help from + (|c0033cc00 + (Assister_text_temp + (. + |r))))))))
 
Status
Not open for further replies.
Top