Hiya,
So it’s been a while since I’ve posted and I’m going to try to fill in as much relevant information as possible. In all honesty i don’t know whats going to be needed so I might put to much or to little here.
Let me start by explaining what I have and what is going on in my game. I have two bases (A B). Within each base’s control script there is a custom class which holds all the basic stats of any minion that base creates. The base creates a minion and in doing so sends that stats list to the minion for construction. The minions stats now have those numbers. The minion starts going off to do whatever command I’ve given it. All that works great. The thing I don’t get is when the minion takes damage the damage is also being applied to the Statslist of the base that created that minion. So if a minion gets created with two wounds and takes two wounds the minion dies, but the two wounds are also being applied to the base that created it. Subsequently all further units created by that base would have a wound count of 0. As more units are skirmishing their initial wound counters go further and further into the negatives.
Other than when a unit is created the base and the minion have no connection to each other that I can find. I have no clue how the negative to the wound is being applied to the base. I’m guessing this is not enough to find the problem but in all honesty I have no clue where to look. Any code the internet might need to help me figure this out I can happily provide.
Custom class for minion stats
[System.Serializable]
public class Statslist {
public int movementSpeed, attackSpeed, swings, evade, power, toughness, wounds;
}
Base control script, the ‘commands’ is a variable I set up that points to the minions control script so I don’t have to keep typing it out.
public Statslist builtMinionStats;
....
public void createMinion(){
...
//Generic Stats
commands.Construct(controllingPlayer, builtMinionStats);
....
Minion control script
public Statslist minionStats;
....
//Build stats
public void Construct(int sentControllingPlayer, Statslist sentStats){
controllingPlayer = sentControllingPlayer;
minionStats = sentStats;
}
public void Wounded(){
minionStats.wounds--;
if(minionStats.wounds<=0 dieing==false){
dieing=true;
Death();
}
}
One thing I just noticed was that even existing minions created from the same base change their stats, not just new minions