Yeah that is the thing. Those 3 units ([0] [1] [2]) are set when you enter "battle-mode." After that i do not touch the arrays other than calling on it (like in my posted trigger.)
I have noticed however that this event fires whenever ANY unit has a property change. Setting it as a specific unit does not seem to matter. It fires as if it was default (Any Units Property Changes)
Marine's (cords) Life changes - Fires whenever any unit on the map has a property change, so this event seems to not work properly, which is a bummer :)
On another note, does anyone have a good tip on how to store Integer Array values in a bank?
As an example - Kills[9] has the kills of 10 different players, each stored in its own array. (Player 1 in Kills[0] Player 2 in Kill[1] etc.)
I know that a loop of some kind probably does the trick. I am just not sure how to do it as I am a bit newbish when it comes to using loops.
Something here (only here, don't pay attention to variables and "picked integer") is wrong. I wonder what...
Explanation: I need to kill (Hunger[(Picked integer)])) of randomly chosen units which belong to the selected player.
Any idea?
@FunBotan: Go
"Picked unit" is wrong.
The unit that changes each loop run is in your "Untitled variable 001". So you need to kill the unit that variable refers to.
"Picked ..." belongs to things that iterate but do not take a variable. Read the action's tooltip to understand what it does.
I would suggest mapmakers to not use the functions that fill the stuff into "picked" as it can create bugs with waits, loops within loops, etc. I would use "For each X" instead and give it a local variable.
edit:
But that function won't do what you want it to do as you are killing 2 units of that player on the map which are not random.
how to achieve what you want:
1. save all units for the player on the entire map in a local variable (variable that is defined in the trigger/function/action definition) with "unit group" as type
2. For each integer 'A' from '0' to 1 with increment of '1' do:
- Kill unit ( Random unit from 'unitGroup' )
I hope you understand it and are able to recreate that in the editor. If you experience problems, just ask. :)
Ok, another noob (or not) question:
How do i restore unit's xp from the bank when game's loaded?
A remark: this should give the same xp to any hero selected by player.
Searched the forum for similar issues but those answers which i found seem to complicated for me...
Thanks in advance.
You would have to store unit xp from the game before and then recall it every game. When a unit is saved via banks the only think that is actually really saved is the unit type not its info
There is way to get the experience level (how much exp a unit has) so you could probably use that to set the bank.
Also, there is a way to change the exp points if units, so you could probably use that with the bank to give units the same points as the unit had in a previous game.
@Spoolofwhool:
@hobbidude:
The only way to change unit's xp via triggers i know is with effects, but u can only create effects giving the unit a definite amount of xp, so for this i'll have to either make 100500 effects or call an effect 100500 times for each unit, which will obviously cause lags... Thank u both men, but i already know everything u've written here and wanna know smth else...
You are making it far too much work. You seem to think you'll need to make 100,500 different effects to set XP to the right level, or one effect at 1 experience to run up to 100,500 times. No, how about being more clever about it, make 1 Effect be worth 1k XP, another 100 XP, another 10 XP, another 1 XP. Doing this, could load up your saved XP to a variable, let's say XPAmount, and just go through a few loops to get through it(pseudo-code below, the logic will in fact work):
while(XPAmount > 999)
{
Use effect 1000XP on Hero Unit;
XPAmount -= 1000;
}
while(XPAmount > 99)
{
Use effect 100XP on Hero Unit;
XPAmount -= 100;
}
while(XPAmount > 9)
{
Use effect 10XP on Hero Unit;
XPAmount -= 10;
}
while(XPAmount > 0)
{
Use effect 1XP on Hero Unit;
XPAmount -= 1;
}
Make sense? I use something like this for all the stats on my project, no reason it can't work for this problem either.
You may want to recheck your information there funbutan as your clearly mistaken. There is an exact single line of action that allows you to set unit experience to whatever value you want instantly. Do your research dude.
@wolkec: Go
I can solve any issue you have but what exactly are you trying to achieve. Are you looking to have 2 players have the same max supply or rather have two players working off the same set of supply. I see you using supplies made which would mean when plyon/depots are made which in turn change max pop.
I'm trying to sync up research and supply between two players, but don't know how to. Here's the code i've gotten so far: Unit - Any Unit research progress is Completed
Local Variables
Conditions
(Owner of (Triggering progress unit)) == Team 1 Mac
Actions
Tech Tree - Add (Triggering unit property change) to (Triggering progress upgrade) upgrade for player Team 1 Mic
and for supply
Events
Player - Player (Round(Team 1 Mac)) Supplies Made changes
Local Variables
Conditions
Actions
Player - Modify player Team 1 Mac Supplies Made: Set To {(Player Team 1 Mac Supplies Made)+(Player Team 1 Mic Supplies Made)}
But neither of those two work
Not really sure about the syncing of supply besides maybe making dummy hidden units for one player that eat up supply when another player on the team makes a unit. I'm really not sure how useful such a thing might be, but it is your project, not mine.
As for shared Research, I might use a long list of variables, or a somewhat big array of integers. Could do something like research[40], have element 0 be infantry weaps, 1 be infantry armor, 2 be some researched ability, whatever. Then when someone completes some research, can go through a big switch statement depending on what the research is which will assign the value to the proper element of the array, then call a TechUpgrade function/action definition/whatever which sets the tech levels of everything using that array. I'll try to make a basic picture of it here:
Player 3 Completes Research on Something:
Trigger with event research is completed is called:
Trigger sets research[n] to the level of the research event that just happened.
Trigger calls TechUpgrade Action Definition:
TechUpgrade sets ups using the research array for all active players.
I would greatly recommend testing this with 4 or 5 upgrades first before going all out with it, just so you know you got the logic right.
Lol hobbidude I was wondering about that when I showed an example of using effects and loops. I just decided not to have any veterancy connected to my heroes, so a player could hide their level if they liked, so had absolutely no experience messing with that, lol.
@wolkec: Go I can solve any issue you have but what exactly are you
trying to achieve. Are you looking to have 2 players have the same max
supply or rather have two players working off the same set of supply. I
see you using supplies made which would mean when plyon/depots are made
which in turn change max pop.
I'm trying to have two players act as one. I'm trying to sync up the supplies to player 1 (so he gets extra supplies when i change the ownership of units)
@Deadzergling: Go
Yeah that is the thing. Those 3 units ([0] [1] [2]) are set when you enter "battle-mode." After that i do not touch the arrays other than calling on it (like in my posted trigger.)
I have noticed however that this event fires whenever ANY unit has a property change. Setting it as a specific unit does not seem to matter. It fires as if it was default (Any Units Property Changes) Marine's (cords) Life changes - Fires whenever any unit on the map has a property change, so this event seems to not work properly, which is a bummer :)
On another note, does anyone have a good tip on how to store Integer Array values in a bank? As an example - Kills[9] has the kills of 10 different players, each stored in its own array. (Player 1 in Kills[0] Player 2 in Kill[1] etc.) I know that a loop of some kind probably does the trick. I am just not sure how to do it as I am a bit newbish when it comes to using loops.
@Matheusx: Go
For the loop you want, I would suggest something along the lines of:
For each i (a generic integer value) 1 to 10, do: Set variable - kills[i-1] = kills of player (i).
This isn't exactly how it's written though.
Oki, here's another issue:
Something here (only here, don't pay attention to variables and "picked integer") is wrong. I wonder what... Explanation: I need to kill (Hunger[(Picked integer)])) of randomly chosen units which belong to the selected player. Any idea?
@FunBotan: Go "Picked unit" is wrong.
The unit that changes each loop run is in your "Untitled variable 001". So you need to kill the unit that variable refers to.
"Picked ..." belongs to things that iterate but do not take a variable. Read the action's tooltip to understand what it does.
I would suggest mapmakers to not use the functions that fill the stuff into "picked" as it can create bugs with waits, loops within loops, etc. I would use "For each X" instead and give it a local variable.
edit:
But that function won't do what you want it to do as you are killing 2 units of that player on the map which are not random.
how to achieve what you want:
1. save all units for the player on the entire map in a local variable (variable that is defined in the trigger/function/action definition) with "unit group" as type
2. For each integer 'A' from '0' to 1 with increment of '1' do:
- Kill unit ( Random unit from 'unitGroup' )
I hope you understand it and are able to recreate that in the editor. If you experience problems, just ask. :)
@Ahli634: Go
[facepalm] Looks like i'm an epic noob yet... Great thanks, Ahli)))
Ok, another noob (or not) question:
How do i restore unit's xp from the bank when game's loaded?
A remark: this should give the same xp to any hero selected by player.
Searched the forum for similar issues but those answers which i found seem to complicated for me...
Thanks in advance.
@FunBotan: Go
You would have to store unit xp from the game before and then recall it every game. When a unit is saved via banks the only think that is actually really saved is the unit type not its info
@FunBotan: Go
There is way to get the experience level (how much exp a unit has) so you could probably use that to set the bank.
Also, there is a way to change the exp points if units, so you could probably use that with the bank to give units the same points as the unit had in a previous game.
@Spoolofwhool:
@hobbidude:
The only way to change unit's xp via triggers i know is with effects, but u can only create effects giving the unit a definite amount of xp, so for this i'll have to either make 100500 effects or call an effect 100500 times for each unit, which will obviously cause lags... Thank u both men, but i already know everything u've written here and wanna know smth else...
@FunBotan: Go
You are making it far too much work. You seem to think you'll need to make 100,500 different effects to set XP to the right level, or one effect at 1 experience to run up to 100,500 times. No, how about being more clever about it, make 1 Effect be worth 1k XP, another 100 XP, another 10 XP, another 1 XP. Doing this, could load up your saved XP to a variable, let's say XPAmount, and just go through a few loops to get through it(pseudo-code below, the logic will in fact work):
Make sense? I use something like this for all the stats on my project, no reason it can't work for this problem either.
I'd be nice if my problem got solved >_> Projectron doesn't look like he's comming here anymore...
@FunBotan: Go
You may want to recheck your information there funbutan as your clearly mistaken. There is an exact single line of action that allows you to set unit experience to whatever value you want instantly. Do your research dude.
@wolkec: Go I can solve any issue you have but what exactly are you trying to achieve. Are you looking to have 2 players have the same max supply or rather have two players working off the same set of supply. I see you using supplies made which would mean when plyon/depots are made which in turn change max pop.
Not really sure about the syncing of supply besides maybe making dummy hidden units for one player that eat up supply when another player on the team makes a unit. I'm really not sure how useful such a thing might be, but it is your project, not mine.
As for shared Research, I might use a long list of variables, or a somewhat big array of integers. Could do something like research[40], have element 0 be infantry weaps, 1 be infantry armor, 2 be some researched ability, whatever. Then when someone completes some research, can go through a big switch statement depending on what the research is which will assign the value to the proper element of the array, then call a TechUpgrade function/action definition/whatever which sets the tech levels of everything using that array. I'll try to make a basic picture of it here:
Player 3 Completes Research on Something:
Trigger with event research is completed is called:
Trigger sets research[n] to the level of the research event that just happened.
Trigger calls TechUpgrade Action Definition:
TechUpgrade sets ups using the research array for all active players.
I would greatly recommend testing this with 4 or 5 upgrades first before going all out with it, just so you know you got the logic right.
@hobbidude: Go
Lol hobbidude I was wondering about that when I showed an example of using effects and loops. I just decided not to have any veterancy connected to my heroes, so a player could hide their level if they liked, so had absolutely no experience messing with that, lol.
@Deadzergling:
Thanks man, that's, at last, what i asked for!
I can"t understand, how destroy block 1x1 in this map
http://depositfiles.com/files/rbgb5uyjb
Please do this trigger on this map and link in this threed
I'm trying to have two players act as one. I'm trying to sync up the supplies to player 1 (so he gets extra supplies when i change the ownership of units)
anyone figured it out >_>
Like Player 1 creates a supply depot. Add 8 supply to player two as well? something like that?