Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

Variables

8 years ago

How do you make it so that when variable ARMOR, goes down to 0, it starts to subtract variable HEALTH. I need help on this. But it doesn't subtract unless ARMOR reaches zero.

Variables

8 years ago

Few ways. Pseudocode, but easy enough to figure out.

Take damage of 5

Armour := Armour - Damage

If Armour = <0 THEN Health := Health + Armour

Armour := 0

So, when the armour is at a negative number, it'll minus from health. Armour -5, Health 100, then Health 95, reset armour to 0. Take damage again, armour -10, health becomes 85, reset armour back to zero.

Variables

8 years ago

Ok thanks, where do I put this in?

Variables

8 years ago

Umm, you'd want to use global scripting for such things. So, every new page it'll fire if it hits these conditions. Also keeps you from having to make it into every page that it'll take effect.

Variables

8 years ago
Assuming you already have the scripts worked out for calculating the damage once the armor is at zero...

IF %ARMOR < 1 THEN %HEALTH := %HEALTH - %VARIABLE

Where %VARIABLE is whatever variable you are using to calculate the damage once the armor is zero.

EDIT: But you're going to need to influence the ARMOR variable in some manner if you let the player repair it or buy new armor. Also, this is assuming that the armor blocks all damage, rather than only a portion.

Variables

8 years ago

Could I make one of you co-author and type it in? I really don't know how to do that. Also there will be like 5 armor sets, so they can get more armor.

@Bucky @lavatus

Variables

8 years ago
I don't have the time to go in and do it for you, but I might be able to help you get the rest of the scripting you need so you can just copy paste it in where it's needed.

Do you want the armor to block all damage? Or reduce it by a fraction? If you want it reduced by a fraction, how much?

Variables

8 years ago

All damage but there will be different armor sets you can buy.

Variables

8 years ago
Ok, then I'd do this.

These are your variables.

ARMOR - hit points on your armor

DAMAGE - raw damage of the enemy attack

ENEMY - enemy health

ATTACK - raw damage of player's attack

HEALTH - player health

This is your global script.

IF %ARMOR < 1 THEN %HEALTH := %HEALTH - %DAMAGE

IF %HEALTH < 1 THEN $DEST := @P(Insert the page number you want the dead people to go to, without the parenthesis)

Your individual link scripts are going to be something along the lines of...

%ENEMY := %ENEMY - %ATTACK

%ATTACK := 2D4

IF %ARMOR > 0 THEN %ARMOR := %ARMOR - %DAMAGE

%DAMAGE := 2D4

Obviously, you can change the %ATTACK and %DAMAGE formula to whatever you want each type of attack you do. Maybe an attack with a sword has a higher ceiling of attack but a lower floor compared to a spear. Or attacking with a sword deals more damage outright, but leaves you more vulnerable to receiving damage in turn. It's your game, play with it.

Just to be sure you understand, the 2D4 means 2 rolls of a 4 sided die, which means the amount could be anywhere from 2-8. In turn, 5D2 would mean 5 rolls of a two sided die, which means the amount could be anywhere from 5-10.

For each type of armor you'll want to add individual link scripts for however many points that type of armor is worth, such as, %ARMOR := 10 or however many points of damage you want the armor to absorb before it's broken.

Variables

8 years ago

But I only have variables ARMOR and HEALTH

Variables

8 years ago
Then add more...

Variables

8 years ago

Like a lot, that will be too much

Variables

8 years ago
  Rename Variable SCORE - - 0 Yes
Delete Variable Rename Variable YTEMP1 - - 0 Yes
Delete Variable Rename Variable YTEMP2 - - 0 Yes
Delete Variable Rename Variable YTEMP3 - - 0 Yes
Delete Variable Rename Variable YTEMP4 - - 0 Yes
Delete Variable Rename Variable YTEMP5 - - 0 Yes
Delete Variable Rename Variable Z1CON - - 0 Yes
Delete Variable Rename Variable Z1HTH - - 0 Yes
Delete Variable Rename Variable Z1OBLIV - - 0 Yes
Delete Variable Rename Variable Z1PREP - - 0 Yes
Delete Variable Rename Variable ZCH1A - - 0 Yes
Delete Variable Rename Variable ZCH2A - - 0 Yes
Delete Variable Rename Variable ZZKILLS - - 0 Yes

 

Learn to love variables, and to use a bunch of them. THey're incredibly useful for this kind of thing, and there's no good reason to not have a bunch of em. First 5, for instance, are 5 temps that I use for unimportant things, but just to change the text or flavour after a decision. The rest are more permanent ones that change as the story progresses.

In short, use a bunch as bucky suggested, it's the only way to actually make the editor dance, instead of slog.

Variables

8 years ago

So basically you're saying:

1) I want these specific videogame-like attributes in my story

2) actually learning how to do this is way beyond me

3) even copying a script someone else wrote for me is too much work

It sounds like you don't want to put any effort at all into this:  more than two variables is "too much" for you, and your immediate request was to make someone else a co-author so they could do all the work for you.  

 

Variables

8 years ago
Make sure you've switched to the advanced editor.