flyinian
Member
I'm trying to get the damage value to randomly split its number between several enemy's health.
I've attempted to use choose and random functions but, wasn't successful.
I've also tried storing the unit's variables into another variable and using that in code.
I am trying to take the value that results from "Ptotalkill - Etotaldefense = "answer"" and subtract it from enemy unit 1 and enemy unit 2 randomly. If the "answer" was 10, unit 1 could be a 3 - unit 1 and unit 2 could be a 7 - unit 2. not going over the "answer" number and not using less of it. Keeping it random(how the "answer" is split between the units.). I also plan on having more than the two units.
Thank you.
I've attempted to use choose and random functions but, wasn't successful.
I've also tried storing the unit's variables into another variable and using that in code.
I am trying to take the value that results from "Ptotalkill - Etotaldefense = "answer"" and subtract it from enemy unit 1 and enemy unit 2 randomly. If the "answer" was 10, unit 1 could be a 3 - unit 1 and unit 2 could be a 7 - unit 2. not going over the "answer" number and not using less of it. Keeping it random(how the "answer" is split between the units.). I also plan on having more than the two units.
GML:
if(Etotalunits > 0 && Ptotalkill > Etotaldefense)
{
Etotalunits -= Ptotalkill - Etotaldefense; // original line of code that takes away from the enemy's total units
// " enemyunit1 & unit2" -= Ptotalkill - Etotaldefense; // The "new" line of code that I want it to take away from the enemy's unit 1 & unit 2. The " enemyunit1 & unit2" are a visual representation for demonstration.
};