0 votes
by (370 points)
I don't know any code for that.Can anyone help me?

1 Answer

0 votes
by (8.9k points)
It's hard to give you advice without knowing how your code for characters is set up.  If you post your existing code we will be able to help you more easily.
by (370 points)
I don't even know the code
by (8.9k points)
Okay, I'll help you work this out.  What character are you talking about?
by (370 points)
A high school kid.He has a skinny body and his chance of getting sick is quite high.But as he started working out i want the chance to be lower
by (8.9k points)
edited by

Okay, here's how I'd do this!  First I'd create an object to represent the character.

<<set $skinnyHighSchoolKid to {}>>

Next I'd give him a variable that tracked his strength from 1 (low) to 10 (high).  He'd start at 1.

<<set $skinnyHighSchoolKid.strength to 1>>

When he worked out, I'd increase his strength by 1, allowing it to get to a maximum of 10.

<<set $skinnyHighSchoolKid.strength += 1>>
<<if $skinnyHighSchoolKid.strength gt 10>>
  <<set $skinnyHighSchoolKid.strength to 10>>

Each time I wanted to check if the character got sick, I'd create a random number from 1-10, and if the number were higher than his strength, I would set a new variable that made him sick.

<<set _sicknessChance to random(1,10)>>
<<if _sicknessChance gt $skinnyHighSchoolKid.strength>>
  <<set $skinnyHighSchoolKid.sick to true>>

Finally I'd use <<if>> statements to make the sickness have an effect in the game.

Amanda invites you to the beach to play volleyball.

<<if $skinnyHighSchoolKid.sick>>
  But you're too sick to go, so you [[stay home]] instead.
  You can [[go to the beach with Amanda]] or [[stay home]].

To recover from his sickness, we'd just change the variable.

<<set $skinnyHighSchoolKid.sick to false>>  You're feeling better now.