BAsically i want to edit a variable depending on a ability/player so.
Event
Unit trains unit with ability "Ability here".
:
Con
Unit must have ability "This unit gave you money".
:
Action
Modify "p1income". +4
:
"p1income" is a integer variable.
I also have a "p2income" and "p3inc" ect,ect.
So if a unit have ability "income ability" then modify "p1income" variable of owner player1 +1
I hope im comming trough it's a bit messy, ive scoured all over and all i can find are records bank catalouges,script,ect and i can't really seem to find anything that lets me links the player to variable value..
So to irriate
Action
Modify "player variable" equal to owner of last created unit "p1income" +4.
Hopefully somebody can understand what im meaning with this mess.
I'll provide a few more details on this, it's a little bit confusing. Even if you've figured it out somebody might benefit from this :P
The way I like to explain arrays is like this: your normal variables are boxes that you can place a value into, but you only have room for one value. An variable with array is like using a box with multiple sections inside, lined up in a grid. Each section inside the one variable can hold an additional value. By adding more dimensions, you add another "dimension" of sections to the box. It's sort of like a grid. And the "coordinates" of the section you're referencing are denoted by a number inside square brackets like [this]. So myInt[2] would give you the second "slot" of your myInt variable, and myInt[6] would give you the sixth"slot" of the variable, etc....
So, you create your variable, change it to an array in the variable options, and set the array size to 15 (I'm using 15 for this example, but you'd set it to the number of players you can have in one game). We only need one dimension for this variable- so it's like the second example in my picture above, except it's 15 boxes wide instead of 6. So now, our one variable has a "slot" for each player. So say we're storing a number that represents how many lives a player has- we set it to 10 by default. Then when any player dies, we'd do something like this:
Event: Unit Dies
Condition: (none)
Actions:
Modify Variable: PlayerLives[Triggering Player] -1
If (PlayerLives[Triggering Player] <= 0)
then
{
End Game for player (triggering player)
}
"Triggering Player" will give us the number of the player, so when we stick that in the "slot" of the variable, it's going to look up the appropriate "slot" in our array. Hopefully that made at least a little bit of sense.
BAsically i want to edit a variable depending on a ability/player so.
Event Unit trains unit with ability "Ability here". :
Con Unit must have ability "This unit gave you money". :
Action Modify "p1income". +4 :
"p1income" is a integer variable.
I also have a "p2income" and "p3inc" ect,ect.
So if a unit have ability "income ability" then modify "p1income" variable of owner player1 +1
I hope im comming trough it's a bit messy, ive scoured all over and all i can find are records bank catalouges,script,ect and i can't really seem to find anything that lets me links the player to variable value..
So to irriate
Action Modify "player variable" equal to owner of last created unit "p1income" +4.
Hopefully somebody can understand what im meaning with this mess.
Make your income variable an array.
Then you can do:
Modify income[Triggering Player]: + 4
Thanks, i haven't used array's at all before, Il look into it!.
Posting back here when ive got it working.
And thanks again!
I'll provide a few more details on this, it's a little bit confusing. Even if you've figured it out somebody might benefit from this :P
The way I like to explain arrays is like this: your normal variables are boxes that you can place a value into, but you only have room for one value. An variable with array is like using a box with multiple sections inside, lined up in a grid. Each section inside the one variable can hold an additional value. By adding more dimensions, you add another "dimension" of sections to the box. It's sort of like a grid. And the "coordinates" of the section you're referencing are denoted by a number inside square brackets like [this]. So myInt[2] would give you the second "slot" of your myInt variable, and myInt[6] would give you the sixth"slot" of the variable, etc....
So, you create your variable, change it to an array in the variable options, and set the array size to 15 (I'm using 15 for this example, but you'd set it to the number of players you can have in one game). We only need one dimension for this variable- so it's like the second example in my picture above, except it's 15 boxes wide instead of 6. So now, our one variable has a "slot" for each player. So say we're storing a number that represents how many lives a player has- we set it to 10 by default. Then when any player dies, we'd do something like this:
"Triggering Player" will give us the number of the player, so when we stick that in the "slot" of the variable, it's going to look up the appropriate "slot" in our array. Hopefully that made at least a little bit of sense.