| 04-15-2009, 11:47 AM | #2 |
This is your problem: Trigger: Set UnitCount[(Player number of (Owner of (Picked unit)))] = (Number of units in (Units owned by (Matching player))) |
| 04-15-2009, 04:42 PM | #3 |
What is the proper way to use picked unit, and matching unit, etc.? Any ideas on the proper set up of this variable? |
| 04-15-2009, 06:32 PM | #4 |
Matching Player/Unit is only used in the conditions for the "pick every player/unit matching condition" action. Picked Player/Unit is only used in the actions of that action. Anywhere else, they have no meaning and return null. What you want is a loop. I don't really use GUI so this may not be in exactly the right words, but: for each integer A from 1 to 12 do actions: Set UnitCount[(integer A)] = (Number of units in (Units owned by (Player(integer A)))) |
| 04-15-2009, 06:58 PM | #5 |
The GUI isn't letting me set the variable to (Number of units in (Units owned by (Player(integer A)))) I'm not given the choice to use (Player(Integer A)))) It's either matching player, or picked player that seems the most likely, but they don't work. |
| 04-15-2009, 11:44 PM | #6 |
Okay, so what I need to do correctly is set the variable right. I'm clearly not doing that. So, how do get set that variable to store a count of each players units? Once I get this correct I should be able to get the leader board working right. |
| 04-16-2009, 12:33 AM | #7 | |
Quote:
|
| 04-16-2009, 04:52 AM | #8 |
Thanks, that got me to the line of code you said I should try. But it didn't work. I changed the full trigger around a little bit. See what you think, and where I'm going wrong. The leaderboard still shows 0.Trigger: Create Board
|
| 04-16-2009, 06:12 AM | #10 |
Awesome! That worked! Thank you very much. In testing the leaderboard, I found that my update trigger is only working once. When a unit dies of player owning that unit should lose a unit remaining that is displayed in the leaderboard. Here is the trigger: Trigger: Any ideas why it's only working once. Well, I shouldn't say once. Each player get's 1 unit updated on the board then it does nothing if another unit dies. |
| 04-16-2009, 07:01 AM | #11 |
IDK, but I would just recount all units when someone dies, because if you just reduce the number by one, and your trigger somehow misses a unit, you will always be off by 1. If you instead recount, even if you miss one, it will only display the wrong number temporarily. EDIT: and I would also make a variable to store your leaderbord in, you never now if last created leaderbord is the good one... |
| 04-16-2009, 08:17 AM | #12 |
Or you can have a separate trigger to change UnitCount every time a unit dies. And you can't use picked player outside Trigger: Player Group - Pick every player in (All players) and do (Actions) |
| 04-16-2009, 01:26 PM | #13 |
Of course it only works once, since you always set the value of the leaderboard to UnitCount-1, so, no matter how many units die, the leaderboard will always be set to however many units where there at the start minus one. What you need to do is either count the units again, or decrease the variable by 1 using the set variable action. |
| 04-16-2009, 05:25 PM | #14 |
Sorry to keep bugging everyone about this. Late last night I had the thought to just recount all of the units every time a unit died. I thought that it would be something easy for me to do. But alas, it doesn't work for me. Here's what I did with the update trigger: Trigger: It doesn't update at all. |
