Non-threaded

Forums » Advanced Editor Forum » Read Thread

Get help from the experts on variables, scripts, items, and other scary things.

Multiplying and Percentages in Scripting

2 years ago

Hello everyone! I am learning how to script and I am trying to multiply a variable using the script these are the things I have tried so far.

%VARIABLE := %VARIABLE + 400%

%VARIABLE := %VARIABLE x 4

I am now stumped. Any advice would be greatly appreciated. 

Multiplying and Percentages in Scripting

2 years ago
I don't believe percentages are supported, but you can do multiplication and division for the same effect.

Using an x is not how you do multiplication.

If you read the article called Basics of Scripting, it will reveal to you...well you know. What the title says.

Multiplying and Percentages in Scripting

2 years ago

Thanks for the info. I skipped the basic one. More fool me.

 

Multiplying and Percentages in Scripting

2 years ago
You cannot use percents or decimals in the system (as it rounds off) but can get the same results, using the proper math.

For example, a cursed sword does only 75% damage: %Damage := 2D6 * 100 / 133

Or Gain 50% more Hit Point: %HP := %HP * 15 / 10

Multiplying and Percentages in Scripting

2 years ago

Yeah I am slowly finding ways around the percentage issue. Thanks for the advice guys it been really helpful. I just need to put more thought into my scripting and stop being lazy.