Randomizing Appearance Details

I’m not sure if this is even possible, but I want to add an option for the player to skip character customization and play with a random appearance. Maybe I could assign each hair color/eye color, etc. a number and use *rand to generate a random characteristic, if that makes sense, but I honestly have no idea if that will even work.

Also, sorry if this has already been asked before, I couldn’t really find anything relevant. Thanks in advance.

Have you tried it? What makes you think it’s not possible? If you tried and struggled at a particular point, let us know so we can help. But it seems from your question that you already know how to do it.

4 Likes

You make a good point. I’ll test it out and come back if I can’t make any sense of it. Thanks.

I am a fool, turns out there were posts about this. If anyone needs extra help, I used this forum thread to make sense of what to do.

1 Like

Like this?

*temp r_skin 0
*temp r_hair 0
*temp r_hairc 0
*temp r_height 0

that at the top of the scene file, unless you do it before the story starts in startup or want to reuse it down the line.

Do you want to randomize your appearance?
*choice
 #Yes
  *rand r_skin 1 6
  *rand r_hair 1 3
  *rand r_hairc 1 6
  *rand r_height 1 3
  *goto set_r_appearance
#No
 *goto set_appearance

at the set_r_appearance you’d then assign the respective bits, or you can use the numbers for multireplace. E.g.:

@{r_hairc black|brown|ginger|blonde|white|no}

or something like that.

There’s also a way to do this via arrays and params afaik, but I am not familiar with them enough.

4 Likes

One annoying quirk of CScript is that it re-randomises everything if you go to the stats screen and come back, so you have to do the *rand commands before the choice is made!

*rand r_skin 1 6
*rand r_hair 1 3
*rand r_hairc 1 6
*rand r_height 1 3

Do you want to randomize your appearance?

*choice
  #Yes
    Your appearance has been randomised!
    *goto the_runway
  #No
    *goto set_appearance

Also, watch your indents!

2 Likes

True, but iirc you can also have it in the choice, and then have a page_break

Do you want to randomize your appearance?

*choice
  #Yes
    *rand r_skin 1 6
    *rand r_hair 1 3
    *rand r_hairc 1 6
    *rand r_height 1 3
    Your appearance has been randomised!
    *page_break
    *goto the_runway
  #No
    *goto set_appearance

that should keep the randomization, too

Unless the player excitedly clicks stats before they click Next, and then finds their appearance re-randomized before they cross the page break…

Probably best to tuck the *rands before the choice, like Will suggests.

1 Like

As @Havenstone said, the *rand needs to be before the choice, otherwise you open the stats screen, see that you’ve got red hair, exit out of stats screen, and then the game re-randomises you so you now have blonde hair and don’t realize until all the NPCs start calling you blonde!

I also once had an issue where I’d use *rand to determine if a player succeeded or failed at a task, and some players found that they could just enter and exit the stats screen until the game reported that they succeeded!

It’s only once you reach the next page that it’s locked in, so the best way to do it is to use the *rand command at least one page or one choice before where it’s actually referenced in the game.

1 Like

Ah.

Then another possible method should be doing the randomisation on startup and hiding it behind another variable that gets set to true/false at the choice.

1 Like

Yeah, this has worked pretty well for me. I almost always do my *rands at startup, or (for temp vars) at the top of the chapter file, and use some other approach to keep them from being obvious on the stat screen until the relevant moment. (Like only using r_skin etc. to affect text in the game rather than descriptions on the stat screen, or having the descriptions only appear on the stat screen once r_appearance_chosen has been set to true.)

1 Like

This is what it looks like the way that I do it:

It gets randomised before the choice, and only locked in when the choice is made.

1 Like