| 01-12-2004, 06:48 AM | #1 |
THE TRIGGER: (begin code) Events Unit- A Unit dies Conditions (Unit-type of (Triggering Unit)) Equal to Farmhand Actions Unit Group - Pick every unit in (Units owned by (Owner of (Triggering unit))) and do (Actions) Loop - Actions Unit - Kill (Picked unit) Unit - Create 1 Farmhand for (Owner of (Triggering unit)) at (Random point in Start[(Random integer number between 1 and 10)]) facing Default building facing degrees (end code) --Sorry the indentation came out ****ed but i hope you get the idea. This is a modified version of a trigger a guy on these forums gave me to help me have a unit (the farmhand) respawn after he was killed, but in the process losing all of his buildings/units. Also he respawns in one of 10 random places on the map. MY QUESTION: A friend gave me the idea that the farmhand should have a limited number of respawns and then he would be out of the game. BASICALLY I want help devising a little trigger that limits the times the farmhand can respawn to ... lets say 5. At that point he would be out of the game. I wish I could do it alone but im still VERY MUCH a triggering n00b and any help would be appreciated. SLowly but surely im learning my way through triggering with help of you friendly folks on this forum. THANKS in advance! -Huh |
| 01-12-2004, 06:53 AM | #2 |
First of. put your triggers in "code" (hit the # above and just hit space then ok, then paste your trigger between the tags)tags to save the indents. Second of, make a variable, call it lives, integer variable, with array. In the map init put: Set Lives[1] = # Set Lives[2] = # Set Lives[3] = # Set Lives[4] = # .... ect, ect..... for each player and # is the amount of lives you want them to have, then at the begining of the above trigger add: Code:
Set Lives[player number(owner of unit(killed unit))] = Lives[player number(owner of unit(killed unit))]-1
If
Condtions
Lives[player number(owner of unit(killed unit))] = 0
Then
Game - Send mesage to Force (convert player to force( player (owner of unit(killed unit)))) "You are out of lives"
Trigger = Skip remaining actions
Else
Do nothingPS, rember me? I gave you the first trigger too :D Or, instead of having "Do Nothing" or the "Trigger skip remaing actions" you could make your trigger look like this: Code:
Events
Unit- A Unit dies
Conditions
(Unit-type of (Killed unit)) Equal to Farmhand
Actions
Unit Group - Pick every unit in (Units owned by (Owner of (killed unit))) and do (Actions)
Loop - Actions
Unit - Kill (Picked unit)
Set Lives[player number(owner of unit(killed unit))] = Lives[player number(owner of unit(killed unit))]-1
If
Condtions
Lives[player number(owner of unit(killed unit))] = 0
Then
Game - Send mesage to Force (convert player to force( player (owner of unit(killed unit)))) "You are out of lives"
Else
Unit - Create 1 Farmhand for (Owner of (Killed Unit)) at (Random point in Start[(Random integer number between 1 and 10)]) facing Default building facing degreesPS, in your trigger you have "Triggering Unit", me personally I like to use an event corrisponding item, so in my example I use Killed Unit. Its not better or anything, I just prefer it. |
| 01-12-2004, 07:16 AM | #3 |
Ok I havnt had a chance to completely read through both ideas enough to actually understand them but THANKS. Ill hafta do what i did with your other trigger suggestions, and pick them apart piece by piece in the editor to understand them and make them work for my map. As always youve been a huge help. Cya AllPainful :mtk: -Huh Oh yes, One thing i noticed. You use "(Unit-type of (Killed unit))". WHile i had triggering unit. I didnt see an event response for killed unit in the drop down menu. It had "killing unit" but not killed. Why cant I find that? Edit- OMFG thats perfect! Im writing it in now. Ill let you know how it comes along. Cya. |
| 01-12-2004, 07:27 AM | #4 |
killed unit = dying unit |
| 01-12-2004, 07:52 AM | #5 |
I cant get the following line into the WE correctly... "Set Lives[player number(owner of unit(killed unit))] = Lives[player number(owner of unit(killed unit))]-1" I can get it into the WE except for the -1 at the very end. It doesnt let me add that in. When I get to the last part (killed unit) it seems to want to close the code. Did I do my variable wrong? Thanks again. -Huh Edit- im almost positive i did it correctly. Not sure why it wont let me do the math at the end... |
| 01-12-2004, 09:18 AM | #6 | |
You didn't quite get it, you forgot the arithmatic part. I answered your other board about the problem, so to quote myself: Quote:
|
| 01-12-2004, 10:32 PM | #7 |
ahahah DUH i knew thats what it was, but thanks for the reply! I've already got my map pretty much functional, just gotta add in alot of stuff, re-terrain it, and maybe do more custom triggers once i learn triggers better. Take Care AllPainful! |
