Legacy GM weapon damage won't change from default (solved)

alexde5th

Member
For some reason, the variable will always stay at 14, which is also the default value when first created. No matter what weapon type is selected, the damage will always stay at 14. This is in the step event.
Script code that handles damage based on weapon type.
Code:
if (weptype = 3)
    {
    switch(type)
        {
        case 0: round(WepDamage = 14); break;
        case 1: round(WepDamage = 21); break;
        case 2: round(WepDamage = 29); break;
        case 3: round(WepDamage = 37); break;
        case 4: round(WepDamage = 46); break;
        case 5: round(WepDamage = 53); break;
        case 6: round(WepDamage = 68); break;
        case 7: round(WepDamage = 75); break;
        case 8: round(WepDamage = 89); break;
        case 9: round(WepDamage = 102); break;
        }
    }
 

Paskaler

Member
The round(WepDamage = 14) statement does nothing. Remove the round and the parantheses around the WepDamage = 14. Do this for all of the cases.

The way it is now, Game Maker checks to see if WepDamage = 14 and returns either 1 or 0(true or false) and then that value gets rounded and the result isn't stored anywhere.

If you actually want to round the damage(I don't see the reason why you'd do so here). You need to put WepDamage = round(14). You'd do this for all the cases.
 
Last edited:

alexde5th

Member
The round(WepDamage = 14) statement does nothing. Remove the round and the parantheses around the WepDamage = 14. Do this for all of the cases.

The way it is now, Game Maker checks to see if WepDamage = 14 and returns either 1 or 0(true or false) and then that value gets rounded and the result isn't stored anywhere.

If you actually want to round the damage(I don't see the reason why you'd do so here). You need to put WepDamage = round(14). You'd do this for all the cases.
Holy 💩💩💩💩, I just realized my error there. I feel stupid for not seeing that as an issue.
Thanks for pointing that out.
 
Top