Need help with coding(*if and true/false)


What I’m trying to do here is to make the npc’s stats only to show up right after you meet them.This is what I got so far,

At Startup.txt
*create Damian = “false”

Now the mc just met Damian.
*set Damian = “true”

At choicescript_stats
*if Damian = "true"
percent Damian_Relationship

I really hope you can understand what I’m trying to say here.Appreciate the help.

*create Damian = "false"

should be (with thanks to @Szaal)

*create damian false

this is how choicescript works, kind of different from conventional coding languages

basically, the equal sign “=” isn’t used when setting/creating variables.

in addition, the inverted commas " " should only be used for strings(like names, for example)
and Damian_Relationship should be created in the startup.txt as well, since it’s a separate stat on its own, too

other than these, I find nothing out of place here.


Will try this,thank you for your time


I didn’t use any boolean variables however the way you create them they should be string variables and it should work like this.


*create Damian "false"

MC meets Damian:

*set Damian "true"

and in the choicescript_stats:

     *if Damian = "true"
           percent Damian_Realationship

I myself prefer to use just like a computer 0 or 1 for this. But this is just personal preference. Also if you just leave out the “” it should be fine too.


A snippet from my small project

*if (cloakedstranger > 0)
	Unknown Cloaked Figure
		percent cloakedstranger Encounter

If you use % relationship for npcs, you can put a code like that one to your choicescript_stats.txt

If the player is yet to meet the npc (relationship = 0), no %relation bar will show up. And vice versa.

But I think your code should work just fine.

Oh, and[quote=“UmbraLamia, post:2, topic:23486”]
*create Damian = “false”

should be

*create damian false
With the condition check

*if damian
  percent Damian_Relationship

Pay attention to the capitalized letter as well, as variables shouldn’t contain capitals, AFAIK