Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

Variables affecting variables.

10 years ago

Ok, it was rather simple figuring out how to have links affecting variables. But how would I make that effect depend on another variable?

Say if I put in a choice that will make the character lose some HEALTH. I want to make it so that the more ENDURANCE he has the less HEALTH he loses. Is this possible?

Variables affecting variables.

10 years ago

Yeah, that's possible. How much health do you want to make them lose? 

 

Variables affecting variables.

10 years ago

Say a guy is going to lose 50 HP with no endurance. If there's 10 endurance I want him to lose 10% less( so -5 =45) , if he has 20 then I want him to lose 20% less (-10= 40) etc.

Variables affecting variables.

10 years ago

IF %END = 0 THEN

%HP := %HP - 50

IF %END = 10 THEN

%HP := %HP - 45

IF %END = 20 THEN

%HP := %HP - 40

IF %END = 30 THEN

%HP := %HP - 35

IF %END = 40 THEN

%HP := %HP - 30

IF %END = 50 THEN

%HP := %HP - 25

IF %END = 60 THEN

%HP := %HP - 20

IF %END = 70 THEN

%HP := %HP - 15

IF %END = 80 THEN

%HP := %HP - 10

IF %END = 90 THEN

%HP := %HP - 5

IF %END = 100 THEN

%HP := %HP - 0

There you go. Should sound comprehensible enough. END = Endurance, and HP = Health. 

Variables affecting variables.

10 years ago

Thanks for the response, but is there a way to make it so I don't have to type this every time? Maybe a shorter version, something like

HP=Current HP - (X * (100-END))

(x being however much damage the character is supposed to take)

Variables affecting variables.

10 years ago

IF %END = 0 THEN

%HP := %HP - (%X * (100/%END))

IF %END = 10 THEN

%HP := %HP - (%X * (100/%END))

IF %END = 20 THEN

%HP := %HP - (%X * (100/%END))

IF %END = 30 THEN

%HP := %HP - (%X * (100/%END))

IF %END = 40 THEN

%HP := %HP - (%X * (100/%END))

IF %END = 50 THEN

%HP := %HP - (%X * (100/%END))

IF %END = 60 THEN

%HP := %HP - (%X * (100/%END))

IF %END = 70 THEN

%HP := %HP - (%X * (100/%END))

IF %END = 80 THEN

%HP := %HP - (%X * (100/%END))

IF %END = 90 THEN

%HP := %HP - (%X * (100/%END))

IF %END = 100 THEN

%HP := %HP - (%X * (100/%END))

Variables affecting variables.

10 years ago

Alright, and how should I go about making it so that if a player clicked a choice on page 10, one of the choices on page 11 will not be available to him?

Variables affecting variables.

10 years ago

Variable restriction.

Variables affecting variables.

10 years ago

Can you explain that a bit more? I do not want to make the choice based on current variables. Think of it this way:

I'm asking the player 2 questions, and I want to disable the answers for the second question that would conflict with the answers from the first one (so if the question would be something like "what's your greatest strength" and the first answer is "I am very good at magic" the answer to the second question which could be "and what is your greatest weakness" can not be "I have never been too adept at casting".

Variables affecting variables.

10 years ago

You're saving their answer inside a variable, right?
 

Variables affecting variables.

10 years ago

Well actually the answers are just supposed to change certain variables (their stats).

Variables affecting variables.

10 years ago

Save the answers into variables, then just look at that to determine what answers to hide.

Variables affecting variables.

10 years ago

%HP := %HP - ((100 - %END) + %DMG)