| 12-28-2005, 09:11 PM | #1 |
I have two questions with my trigger (I am NOT using JASS btw) that basically says this: When a player leaves, give the rest of his team sharing of his income (this is a lot of long If, Then, Else (Multiple Functions) triggers (depending on how many players on that player's team are left)) then, share units and sight with the rest of the player's team and finally display the text that the player has left (to everyone). My first question is how do i take the current gold of the player and divert it (right now all i have is incoming gold)? My second question is how do i set the player's name (ex. Undead_Lives) in the text to say "_____ has left the game"? And a final quick question, is there an easier way to divert gold without the numerous If, Then, Else (Multiple Functions)? |
| 12-28-2005, 11:13 PM | #2 |
1) Player - Current Gold 2) Player - Player Name Now the question is, where do you find them, right? 1) is an integer value, so whenever you can select an integer value, you shall find it. 2) is a string. Just use it in String concatenation. As for your logic issue, please post your trigger. You can do so easily by right-clicking in the function list and selecting "Copy as Text". Please use the trigger tags as described here: http://www.wc3campaigns.net/showthread.php?t=78403 |
| 12-29-2005, 01:38 AM | #4 |
There wouldn't be need for that. We call it variables and integers. |
| 12-29-2005, 04:15 AM | #5 |
then please, explain more than just "use integers and variables". |
| 12-29-2005, 07:28 AM | #7 |
One thing to correct on aaero's post: the condition in the "all players matching..." parts. You have to use "matching player" in there, not "picked player". Also, I think you need two conditions to be true, the player must still be playing and he must also be an ally of the leaving player (I suppose there are more teams), aaero missed that one. You can easily do that with an "and" condition which allows you to use two conditions instead of one. Then just use the player slot status comparison and the "boolean - player is an ally of player" comparison to filter out the right players for gold sharing. You might also want to set the leaving player's gold to 0 after you share it, I'm not sure if it can affect anything, but better be safe. Other than that, aaero's trigger gets the job done nicely. It's shortness should really motivate you to learn to use variables and variable arrays. :) |
| 12-29-2005, 04:11 PM | #8 |
Anitarf is right on with his reply, as is usual when he's correcting me :) I went ahead and corrected the original trigger to say Matching Player instead of Picked Player where necessary: here's the difference. Picked Player: When you do a Pick all Players in Player Group, this refers to the Player that is currently "picked". Pick all Players will loops through every player in the group (ie with All Players first it's Player 1, then Player 2, then Player 3). Matching Player: This is for All Players Matching Condition. It's actually kind of hard to explain, but I'll try my best using the example. Player Group - Pick every player in (All players matching (((Matching Player) slot status) Equal to Is playing)) and do (Actions) In this example, it's saying pick every Player where that Player is currently playing. You use Matching Player for the condition to show this. |
| 12-29-2005, 07:33 PM | #9 |
The short story is, use "matching player" in the pick-every-player conditions, and "picked player" in the actions. A longer explanation: what the action "Pick all Players in Player Group matching condition" does is, it loops through all the players in the group, and if the condition is true, it picks that player and does it's loop actions. However, when checking the conditions, the player isn't "picked" yet, so you can't use "picked player" in the condition, because it won't refr to the player that the conditions are being checked for. That player is the "matching player", and if the condition is met he becomes the picked player for the actions of the loop to use. |
