| 09-10-2003, 02:08 PM | #1 |
If I build a farm, I want a trigger to know that and save it to a variable, how do I do? ANd the same if I destroy/sell/makeitdisappear, I need it to update the variable to know that I have gotten 1 less farm... How do I do that? (No regions is allowed) EDIT: 1 region can be allowed, but it need to work for 4 different players. |
| 09-10-2003, 02:18 PM | #2 |
Could look something like this: Untitled Trigger 003 Events Unit - A unit Finishes construction Conditions (Unit-type of (Constructed structure)) Equal to Farm Actions If (All Conditions are True) then do (Then Actions) else do (Else Actions) If - Conditions (Owner of (Constructed structure)) Equal to Player 1 (Red) Then - Actions Set farmsred = (farmsred + 1) Else - Actions Do nothing If (All Conditions are True) then do (Then Actions) else do (Else Actions) If - Conditions (Owner of (Constructed structure)) Equal to Player 2 (Blue) Then - Actions Set farmsred = (farmsblue + 1) Else - Actions Do nothing What u do with the integers after that is up to u :P Someone correct me if I'm wrong here pls :) |
| 09-10-2003, 05:03 PM | #3 |
This way is easier, and will take less time.... Make an integer array variable... Call it whatever you want, but I used farms in this case. I'm doing this from memory, I don't have WC3 in front of me, so the wording won't be exact, but you should be able to find everything ok. Events Unit - A unit Finishes construction Conditions (Unit-type of (Constructed structure)) Equal to Farm Actions Set Farms=[Player number of (owner of constructed structure)] to [Player number of (owner of constructed structure)] +1 Events Unit - A unit is killed (or whatever, just put muiltiple events. It only takes one to set them off) Conditions (Unit-type of (Dying Unit)) Equal to Farm Actions Set Farms=[Player number of (owner of dying unit)] to [Player number of (owner of dying unit)] -1 There you go. 1 is player 1, 2 is player 2, and so on. It's alot easier then the alternative.... Hope this helps. |
| 09-10-2003, 06:37 PM | #4 |
You could use a variable or..... use this condition or a variation of it (Number of units in (Units owned by (Player(1)) of type Farm)) Greater than 0 would allow you to test if player 1 had any farms. It would be easy to make this do whatever it is including using it in a variable assignment. Also to get it to work for all 4 players just use a For A : Loop Good Luck. |
| 09-11-2003, 05:49 AM | #5 |
Thanks everybody! I'll give you some credit for this in my map! :) |
