PDA

View Full Version : Help with trigger


gamer102
11-01-2005, 8:47 PM
is there a trigger or a process that says current player so i dont have to put player 1 does this and then another triggere player 2 does this and player 3,4,5 and etc.

Basan
11-02-2005, 9:03 AM
is there a trigger or a process that says current player so i dont have to put player 1 does this and then another triggere player 2 does this and player 3,4,5 and etc.

I'm not sure since haven't dedicated that much time into WC3-TFT triggering, but couldn't it be done with a "picked player" option amidst the actions you're setting? Just a thought, though. ;)

Zipsco
11-02-2005, 9:59 AM
No nothing is called current player, since current could mene anything... There is something called trigering player, though... But i see your problem, i too use a thing called currentPlayer, but it is a variable, where into the variable i put player of player index[0] and putting in another integer variable into the [] insteed of the 0, and the only thing i need to do when changing alot of players is changing the variable (also when i make a big trigger, since i just replace all instances of player something with the currentplayer, then i setup the currentplayer with the variable when i use this for the next player and the next player, aso.).... like this:

if owner trigering unit equal to player 1 red, add 100 gold to player 1 red, else substract 100 gold from player 1 red.

Replace it with this:

currentnumber = 1;
currentplayer = player of playerindex[currentnumber];
if owner trigering unit equal to currentplayer, add 100 gold to currentplayer, else substract 100 gold from currentplayer.

//

currentnumber = currentnumber + 1; //this is like var++; in programming, it adds 1 to the variable
//therefore you get player 2 insteed of player 1, and you just copy this (under the // in the middle)
// to add player 3, 4, 5 aso. (the first setting currentnumber = 1, must be used to reset the variable, each time it is used, also for the first time, so var++; should only be used for player 2,3,4,5 aso.)
currentplayer = player of playerindex[currentnumber];
if owner trigering unit equal to currentplayer, add 100 gold to currentplayer, else substract 100 gold from currentplayer.


This is just one example of how to use variables, and the term currentplayer, becouse you can make your own terms by just making a variable and check conditions like:

a unit owned by player 1 red dies:

OwnerOfLatestDeadUnit = player 1 red;

// now you can use the OwnerOfLatestDeadUnit as a condition like triggering unit or like other things. (and yes i do know that OwnerOfLatestDeadUnit wasnt the best idea since something like it already exist, but hey, iam brainstorming here, for no use!

Hope this helpes, Zipsco

gamer102
11-02-2005, 5:19 PM
NVM i got some of it just do "pick every player and do action" and then tada

see thats why i said "Current Player" cuz i got SC too and it says current player. gess it triggering player for warcraft

Zipsco
11-02-2005, 5:45 PM
Hehe, thought you knew about triggering player... since it wasnt your question :D anyway now you know both. Also, picking every player isnt gonna cut it, in some of the situations, my explained system, will help you if you only need like a portion of the players, you can simply add or just set this one variable to the players index, and vubti, it changes in all the triggers... Sometimes advanced triggers, well atleast many of those i do, have like the same player id, in it like 12 times before it changes to the next, it is better to it like i said then. (maybe not all players need selection as i said, maybe only 1 team needs it aso. And yes there is a player group function, but it takes longer to set up if that is all you need it for.)