Percentages of a variable

It shouldn’t do - they’re loosely typed in that sense. To confirm, the values you are checking in the debugger are under Global Variables, and not Scene Variables?

[edit]
If the values are correct, is there anywhere else in your events you changing the width of the health bar object?

If they’ve explicitly set a type on the variable, it could be an issue.

I’ve not messed with strict typing since it’s been added, but I think it will make the values invalid when an integer is needed.

@mx_sunshine if your HP_current is manually set to a string, you might need to do ToNumber(GlobalVariableString(HP_current))

But I’d also just change it from a string variable to a number to be safe (or delete it and re-add it so it’s not strict typed).

No, the “strict typing” only means that the IDE doesn’t guess the type of your variables but needs to know the type when editing them, at runtime the variables can still change types without problems.

(Regardless, if the variable is a number I would recommend storing it as such not as a string :p)

Good to know!

(mx_sunshine, ignore my above post)

100% sure they’re global values, and nothing else is messing with those values as far as I know. (Sorry for late reply, forums decided I reached my reply limit)

I would still bet it’s something with your variable names in your expression.

Try a basic test, change the width of Health_bar to (180 * (100/80))

If that works to set the width 144, then it’s your variables.

If it doesn’t work at all, then you’re using the wrong object type for that event, I guess?

2 Likes

To follow up on what @Silver-Streak just wrote, if setting the width using that expression works, then check the variable names are correct. It’s case sensitive, and any spaces before or after the name will be considered a mismatch.

1 Like

Ended up having to do with the size of the bar in the object setting page, if you will. All fixed now and works perfectly, thank you! :slight_smile: