I am one of the Map editors for Marine Arena and I am having a headache of a time with this.
Is there an easy way to stop resources from transferring to your an ally when a player leaves?
If there is I would love to know about it.
Our roundabout approach. :
We have an existing variable for our leaderboard that tracks total minerals a player has earned throughout the game.
So when a player leaves we have a trigger that picks integer 1-8 (for players 1-8) and checks that they are an ally of the player who left.
If so then it will set their minerals back to what they should be, calculated by (total earned variable - player minerals spent score).
The problem is that its not working right and ends up setting incorrect minerals.
CODE:
General - Pick each integer from 1 to 8, and do (Actions).
Actions.
General - If (Conditions) then do (Actions) else do (Actions).
If.
(Player (Triggering player) treats player (Picked integer) as Ally (Mutual)) == True.
Then.
Player - Modify player (Picked integer) Minerals: Set To (LB Bounty Earned Value[(Picked integer)] - (Player (Picked integer) Minerals Spent score)).
NOTES:
LB Bounty Earned Value[(Picked integer)] is our custom variable which is the sum of all minerals earned by any means. It is an array of 8 for players 1-8 (question: In galaxy editor would an array[8] have indexes 0-7 , 0-8 , 1-8 ?)
Should I use picked player instead of picked integer?
I feel like it shouldn't matter but perhaps its a known bug or incompatibility that is causing it to not work correctly?
should work as intended. that code runs when a player leaves right?
maybe you should debug your code by showing a debug message of the player's mineral spent score? i somehow have this gut feeling that could be your source of error since technically thats not a variable is it. Its the one the game uses for melee maps yes?
another thing to note is in melee map, if someone leaves the game, his/her income goes to the team. Make sure it doesnt as this might screw up your mineral tracking.
I haven't messed up with things like this, yet. But why do you not try it the other way: If a player leaves, let his resources be shared be his team members ... and than subtract his resources (divided by number of active team members) from their resouces again.
Keeping track of gathered and spent resources the whole game, this sounds too complicate and too fault-prone form me.
LOL i wish that would work.
that's what we tried 1st... the resources transfer before a trigger can remove them.
So i did what one of you suggested and added comments to print the variables and math.
I found that the culprit is "Player Spent Score" ... no matter how much stuff i buy it remains 0...
anyone know how this variable works? (its the built in one)
I made all players be enemies and then I added Teamchat Alliance Aspect for every player. If you need non-agression or regular resource trading this may be enabled in the same way as well. The list of possible "Alliance Apsects" is quite long.
Code is as follows, assuming human players are 1 to 4:
Hrrrrmmm, from what I see it should be working, but is a little more efficient way to do it using picked players. Go something like this:
Variable: i = 0 <Integer>
Player Group - Pick each player in (Allies of player (Triggering player)) and do (Actions)
Variable - Modify i: + 1
Modify player (Picked player) Minerals: Set To ((LB Bounty Earned Value[(i)] - (Minerals Spent Score[(i)])
Not sure why you had Player on your original with minerals spent, may be your issue
That should work, assuming your arrays are getting properly updated, that would be my next thing to check if it was me.
@JosinJJ: Go
should work as intended. that code runs when a player leaves right?
maybe you should debug your code by showing a debug message of the player's mineral spent score? i somehow have this gut feeling that could be your source of error since technically thats not a variable is it. Its the one the game uses for melee maps yes?
another thing to note is in melee map, if someone leaves the game, his/her income goes to the team. Make sure it doesnt as this might screw up your mineral tracking.
@JosinJJ: Go
I haven't messed up with things like this, yet. But why do you not try it the other way: If a player leaves, let his resources be shared be his team members ... and than subtract his resources (divided by number of active team members) from their resouces again.
Keeping track of gathered and spent resources the whole game, this sounds too complicate and too fault-prone form me.
The game will pick up and execute triggers before dispersing minerals, I believe. Thus why you can see yourself leaving a game.
Do "If a player leaves a game" -> "Set Leaving Player Minerals to 0"
Does not matter: There is no difference between
But if the minerals can be set to 0 before they are shared ...
... this would be the easiest solution.
I just got this working for Icecrusher TD 2:
I made all players be enemies and then I added Teamchat Alliance Aspect for every player. If you need non-agression or regular resource trading this may be enabled in the same way as well. The list of possible "Alliance Apsects" is quite long.
Code is as follows, assuming human players are 1 to 4:
In income wars i replaced the default minerals system with custom minerals completely