Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

Item going one of two pages depending on variable?

6 years ago

Say I have a spear and a variable called ARMDMG. If your arm is undamaged (ARMDMG = 0) the the item will go to a page where you throw and hit with the spear, but if arm is damaged (ARMDMG = 1) then the item goes to a page where you miss. Or something to that affect.

Is there a way to do that and if so how would I do it? Thanks for responses.

Item going one of two pages depending on variable?

6 years ago
You have a spear and...

Heh.

Actually, this is really, really simple. In this case, I would make two links that link to the two pages, both with the text "Throw spear" or whatever. Then you can use the conditional button there next to the link to make each link only appear with that specific variable value.

Item going one of two pages depending on variable?

6 years ago
If you used item scripting all you would have to do is:

IF %ARMDMG = 0 THEN $DEST := @P24
ELSE IF %ARMDMG = 1 THEN $DEST := @P24

Replace 24 with the actual page number it's supposed to send them to.

Item going one of two pages depending on variable?

6 years ago

Ogre11 yeah that's pretty obvious don't know why I didn't consider it. If I can't do the thing below then I'll probably do it this way.

Killa Robot, thanks for that. I think that could be very useful if I wanted to do some more complex stuff with this from the Random Variable tutorial and randomize it. Could I do something like this (with a damage to the enemy variable called ENMDMG)

IF ARMDMG = 0 THEN %ENMDMG := 4*random number

IF %ENMDMG > 8 THEN $DEST := 24.

Or something to that effect? (btw what does $ do?)

Basically what that is supposed to accomplish is, if the arm is undamaged, the enemy damage is given a number. Then the second line is, if that number is greater than 8, go to page 24.

Then I'd have a series of other IF/THEN's for all the available possibilities with different pages for each one. Is that possible? And if so am I on the right track?

Item going one of two pages depending on variable?

6 years ago
The $ just shows it's a system variable that does something specific. You see the same thing with $PAGETEXT etc.

$DEST is probably one of the most useful commands there is, it's the simplest way for hopping between chapters, and it's what allows you to easily have delayed consequences to choices. Ogre's suggestion works too but it's more finicky and requires more clicking...there's multiple ways to do most things though, it just depends on what works best for a specific scenario.

And yeah, your example seems doable.