im making trigger that detects when player kills another players hero and i have made a string varible with different messages to be displayed when a hero dies. the problem is that when i kill another hero the the variable messages doesn't show it only shows the dying player and the killing player.
look at my trigger maybe someone can help me
Events Unit - A unit Dies Conditions ((Dying unit) is A Hero) Equal to True Actions Game - Display to (All players) for 10.00 seconds the text: ((Name of (Owner of (Dying unit))) + (Messages[(Random integer number between 1 and TotalMessages)] + ((Name of (Owner of (Killing unit))) + !!!!)))
i seriously can't see anthing wrong here but maybe you pro coders can help me
Oh... i have a great idea. What you could do is have a series of triggers, each with a different message... and have them set NOT initally on (except for the first one). Then have it display whatever you want and have an Action (Trigger-Turn off This Trigger). And another action that turns on the next trigger... like so (Trigger- Turn on TRIGGERNAMEHERE). I remember using this for display messages once.
:::::::IF you STILL don't get it:::::::: Heres an example of 2 triggers doing what i just described... This Trigger Initiates the next... Kill1 Events Unit - A unit Dies Conditions ((Dying unit) is A Hero) Equal to True Actions Game - Display to (All players) for 15.00 seconds the text: ((Name of (Owner of (Killing unit))) + (Just PWNT + ((Name of (Owner of (Dying unit))) + (+20 gold)))) Trigger - Turn off (This trigger) Trigger - Turn on Kill 2 <gen>
The next Trigger... Kill2 Events Unit - A unit Dies Conditions ((Dying unit) is A Hero) Equal to True Actions Game - Display to (All players) for 15.00 seconds the text: ((Name of (Owner of (Killing unit))) + (Owned + ((Name of (Owner of (Dying unit))) + (+20 gold)))) Trigger - Turn off (This trigger) Trigger - Turn on Kill 3 <gen>
The Next Trigger... Kill3 Events Unit - A unit Dies Conditions ((Dying unit) is A Hero) Equal to True Actions Game - Display to (All players) for 15.00 seconds the text: ((Name of (Owner of (Killing unit))) + (fragged + ((Name of (Owner of (Dying unit))) + (+20 gold)))) Trigger - Turn off (This trigger) Trigger - Turn on Kill 4 <gen>
Then for the last trigger just make it turn back on trigger 'Kill1' it will just loop different ones, without bugging.
I know its not random, but its the next best thing.
herodie Events Unit - A unit Dies Conditions ((Dying unit) is A Hero) Equal to True Actions Set RndTxt = (Random integer number between 1 and 3) If (All Conditions are True) then do (Then Actions) else do (Else Actions) If - Conditions RndTxt Equal to 1 Then - Actions Game - Display to (All players) for 15.00 seconds the text: (((Name of (Owner of (Killing unit))) + killed ) + ((Name of (Owner of (Dying unit))) + +20 gold)) Else - Actions If (All Conditions are True) then do (Then Actions) else do (Else Actions) If - Conditions RndTxt Equal to 2 Then - Actions Game - Display to (All players) for 15.00 seconds the text: (((Name of (Owner of (Killing unit))) + slaughtered ) + ((Name of (Owner of (Dying unit))) + +20 gold)) Else - Actions Game - Display to (All players) for 15.00 seconds the text: (((Name of (Owner of (Killing unit))) + murdered ) + ((Name of (Owner of (Dying unit))) + +20 gold))
======================================== Remember the spaces! Otherwise you will get "Player1killedplayer6+20 gold". It would be a good idea also to use the colour codes for different players.
Initialization
Events
Map initialization
Conditions
Actions
Set messages[0] = 's Hero dreadfully died. Thanks to
Set messages[1] = 's Hero died. The killer has to be
Set messages[2] = 's Hero is owned. Pay respect to
Unit Died
Events
Unit - A unit Dies
Conditions
((Triggering unit) is A Hero) Equal to True
Actions
Game - Display to (All players) for 10.00 seconds the text: (((Name of (Owner of (Triggering unit))) + messages[randnum]) + (Name of (Owner of (Killing unit))))
Random
Events
Time - Every 0.20 seconds of game time
Conditions
Actions
Set randnum = (Random integer number between 0 and 2)
Reason I set up a random number trigger from periodic time because if you only random during specific trigger, it will repeat same random number. Like start a map check random number "6", ok restart map.. check again "6", restart.. check again "6"...
These worked fine for me.
EDIT - Oh btw, your problem is probably string array starting at 1 and your randomness probably landed to blank string every time. It's good idea to set variable starting from 0, say if your array size is 9 (meaning 0 -
Tie-Breakim making trigger that detects when player kills another players hero and i have made a string varible with different messages to be displayed when a hero dies. the problem is that when i kill another hero the the variable messages doesn't show it only shows the dying player and the killing player.
look at my trigger maybe someone can help me
Events Unit - A unit Dies Conditions ((Dying unit) is A Hero) Equal to True Actions Game - Display to (All players) for 10.00 seconds the text: ((Name of (Owner of (Dying unit))) + (Messages[(Random integer number between 1 and TotalMessages)] + ((Name of (Owner of (Killing unit))) + !!!!)))
i seriously can't see anthing wrong here but maybe you pro coders can help me
The main problem here seems to be that the strings are empty. Are you sure you created another trigger that sets the variables to certain strings? And those parts of the player names won't show up either if they're an Empty String.
As Rui said, could you post your trigger(s) that link the messages to those array variables? There's no mistake in your trigger. Else try Maker's workaround.
hehe thx for your help guys but i got it up working well i just had to set the variables in the same trigger then it worked. And to answer you Rui i did set some values in the string i just had set them in the same trigger and not in a seprate trigger