flyinian
Member
I am trying to add randomization to my combat system and experimenting with different code styles.
When I use "var enemy" or "totalcounttarget" directly to adjust the value of "Count 1", it doesn't work.
If I use the "Count 1" directly, it works but, I lose the randomization for my combat system.
I'm not sure what i'm doing/not doing is causing my code to break.
Any help is appreciated.
Thank you.
When I use "var enemy" or "totalcounttarget" directly to adjust the value of "Count 1", it doesn't work.
If I use the "Count 1" directly, it works but, I lose the randomization for my combat system.
I'm not sure what i'm doing/not doing is causing my code to break.
GML:
var enemy = choose(EnemyList[? "Count 1"]);//,EnemyList[? "Count 2"],EnemyList[? "Count 3"]]); // I have more than one enemy to choose from, but for testing purposes I only have the one enabled.
if (EnemyList[? "totalcount"] != EnemyList[? "totalcountcheck"]) // meaning if the player attacks the enemy and the enemy lost troops.
{
EnemyList[? "totalcountdifference"] = EnemyList[? "totalcountcheck"] - EnemyList[? "totalcount"]; //This works as intended. This calculates my damage to be done to "Count 1".
EnemyList[? "totalcounttarget"] = enemy; // This holds the target for the damage to be done.
if(enemy > 0) // if "Count 1" is greater than 0, do the following code. If there is any enemy troops to be destroyed.
{
//code in question
//enemy -= EnemyList[? "totalcountdifference"]; // This doesn't work for effecting "Count 1".
// EnemyList[? "Count 1"] -= EnemyList[? "totalcountcheck"] - EnemyList[? "totalcount"]; // This one works for effecting "Count 1" but, I lose the random selection.
//EnemyList[? "totalcounttarget"] -= EnemyList[? "totalcountcheck"] - EnemyList[? "totalcount"]; // This doesn't work for effecting "Count 1" but, it does effect "totalcounttarget" value.
};
};
Thank you.