Calculating variables


#1

Hey,
In my game I want the player to have a maxuimum carrying weight. I want this number to be (Strength x Endurance). Strength and Endurance are two diffrent variables (no need to help me create them, I know how to do that). How can I create the "Maximum Carrying Weight" variable?

thanks


#2

There are instructions on how to combine two variables in different ways here, in a tutorial that @Lglasser created.

Did you want to multiply the variables, or add them? You can do either, and then use them like this:

*set maximum_carrying_weight (strength + endurance)

or

*set maximum_carrying_weight (strength * endurance)

There's an example of a maths string here as well. I hope that helps!


#3

*set varxy (var * var1)

looks like @Fiogan beat me to the punch. She is much swifter at code then me.


#4

Thanks! That helped alot!


#5

I'd have thought if that maximum carrying weight changes, it'd be something like

*set maximum_carrying_weight ({strength} + {endurance})

I'm not sure though if that's different from what @Fiogan has said. I've not actually tried that out to even see if it works.

Hrm yeah both seems to do the same in the Ide.


#6

Thank God for the search function :sweat_smile: I knew this was possible, but I couldn't remember the command for the life of me.

Thank you, @Fiogan!