Ultimate Noob Coding

I’m not entirely sure what I did wrong, but I figured it out :joy:

1 Like
*if (blue)
  *goto_scene blue_party
*if not(blue)
  *goto_scene red_party
2 Likes

There are some IFs that use simple numbers in the stat page to express something like relationship points (as opposed to the usual bar graph).

Ex:
Friendly: 5
Flirt: 2

This probably sounds simple, but can someone tell me how I can do this?

1 Like

Yes, all you need to do is write

Status:

Friendly: ${friendship_points}
*line_break
Flirt: ${charisma_points}
*line_break 
etc...
3 Likes

Thanks! That makes a lot of sense, actually

2 Likes

So, what I’m trying to do is compare a variable to itself (duh) and see if there is a change, then if there is a change, use that change to cause some *if text to appear.

Currently, the only way I know how to do this would be…

*if (Var <= blah)
*goto blah
*else
*goto blah2

*label blah
*set blah +5
*goto blahblah

*label blahblah

TEXT

*label blah2

DIFFERENT TEXT

But this isn’t particularly efficient (I think) and also isn’t really comparing the change in the variable, just seeing if it fits a certain parameter beforehand. Is there a better way to do this?

Edit:

For added context, I am looking to see if the MC heals for this text. The healing is the important bit here as the actual health before or after healing is unimportant.

1 Like
*if (Var <= blah)
    HEAL TEXT
    *set blah +5
*else
    DIFFERENT TEXT

CONTINUATION TEXT

That’s how i would do it, no need for labels, just use intendentions!

4 Likes

I’d use two variables current_health and max_health.

Then you could do things like this.

The bandit attacks with his short sword.
*if (swordplay)
    You block him.
*if not (swordplay)
    His sword cuts your leg.
    *set current_health -5

*if (current_health < max_health)
    You are wounded.
    *goto next_scene
*else
    You are unharmed.
    *goto next_scene
1 Like

Could you use this instead…

*if (Health < 100) [assuming your max is at 100]
  TEXT 
  *set Health +5
  *goto Blah
*else
  TEXT
  *goto Blah

… for less variables required? I’m mostly trying to simplify my code. I technically have a solution to this but it’s so damn tedious.

I don’t see why you can’t

1 Like

you may need an extra variable for this:

*temp old_hp

this variable will stores MC’s HP before healing process happens
then you compare with MC’s HP after the healing process

*if old_hp != mc_hp
**some text
*else
**some other text

1 Like

No?

Let’s say “Health” was instead mc_hp saved in startup right

the mc_hp variable is already tracking the current hit point value and *set mc_hp +5 updates this value when the healing process is applied.

The code is already checking current value of mc_hp against the maximum health value of 100. If mc_hp is less than 100, the healing process is applied, and continues to the Blah, showing that the healing process was successful. Otherwise, if mc_hp is not less than 100, the healing process is not applied, and continues to the Blah, showing that healing was like not necessary or something /going on with the story(as it was not needed)

1 Like

That’s what I’m looking to do. Specifically if the health changes rather than just if the MC is wounded or not.

1 Like
*stat_chart
     *if (ArmorWorn = Leathers)
       percent Leather
     *if (ArmorWorn = Metal)
       percent Metal
     *if (ArmorWorn = Composite)
       percent Composite
     percent Health
     percent Sanity

I’m trying to hide (stats screen) percentages, based on which armor is being worn since a character cannot wear three different armors at the same time (I know technically, yes they can, but c’mon…)

choicescript_stats line 37: invalid line; this line should start with ‘percent’, ‘text’, or ‘opposed_pair’
Press any key to continue . . .

But this is the error that it has given me.

Would I need to make three different charts instead, one for each armor? Plz halp

Basically, yeah

*if (ArmorWorn = “Leathers”)
*stat_chart
percent Leather
percent Health
percent Sanity
*if (ArmorWorn = “Metal”)
*stat_chart
percent Metal
percent Health
percent Sanity
*if (ArmorWorn = “Composite”)
*stat_chart
percent Composite
percent Health
percent Sanity

Hope that helps!

Also if you have any other questions feel free to @ me

1 Like

Oh yes that would work too

2 Likes

Thamk

sorry, but what does these three variables do (Leather, Metal, Composite) ?
you want to show defense value of each armor type in percent?

I think you only need two variables for whatever armor you wish to wear:

*temp armor_name “Dragon Scale Armor”
*temp armor_value 50

then according to the guide below, you can display its value and name in percent like this:
image

then when your armor changes or you wanna unequip it, you only have to change those two variables:

*set armor_name “Nothing”
*set armor_value 0

less IFs needed and no need to hide anything

1 Like

Actually, you can have more than one state chart, so you can split the part that changes.

*if (ArmorWorn = “Leathers”)
   *stat_chart
      percent Leather
*if (ArmorWorn = “Metal”)
   *stat_chart
      percent Metal
*if (ArmorWorn = “Composite”)
   *stat_chart
      percent Composite

*stat_chart
   percent Health
   percent Sanity

But, personally, I’d do something like:

*stat_chart
   percent {ArmorWorn}
   percent Health
   percent Sanity

@RascaldeesV2

Also, if I understood correctly, you want to do something every time the player heals, right? But you control when they heal, so I’m not sure what the problem is.

2 Likes

oh sorry didn’t read this part, before-after health is not important, okay cool

then you need boolean for healing, *temp is_heal false
then when healing process happens, *set is_heal true
then check
IF is_heal = true
** heal text
ELSE
** other text

no need to check MC’s HP at all, got it

2 Likes