Can't create race (SOLVED)


#1

I’m having trouble with creating a race. This is fine;

You, The Seeker

*temp gender_text
*if gender = 0
 *set gender_text "Unknown"
 *goto chart
*elseif gender = 1
   *set gender_text "Male"
   *goto chart
*elseif gender = 2
   *set gender_text "Female"
   *goto chart
*label chart
*stat_chart
     text gender_text Gender

*line_break

*stat_chart
  opposed_pair Good
    Evil
  opposed_pair Tech
    Magic

*stat_chart
  percent Intelligence
  percent Charisma
  percent Strength
  percent Dexterity

*line_break

*stat_chart
  percent Gold

HOWEVER, whenever I attempt to add in race, it glitches.

*temp race_text
*if race = 0
 *set race_text "Unknown"
 *goto chart
*elseif race = 1
 *set race_text "Human"
 *goto chart
*elseif race = 2
 *set race_text "Elf"
 *goto chart
*elseif race = 3
 *set race_text "Half-elf"
 *goto chart
*elseif race = 4
 *set race_text "Dwarf"
 *goto chart
*elseif race =5
 *set race_text "Gnome"
*gotochart

*stat_chart
 text race_text Race

I tried many things, deleing label etc, but nothing seems to work! It either tells me there’s an error, or the show stuts button freezes my game! Help would be most appreciated!


#2

I’ve wrapped your code in [code][/code] tags.


#3

What is the error message you’re getting?


#4

Thank you! XD <3 Sorry for the inconvenience but I just started doing my first text-based RPG yesterday, so I’m pretty new to all of this!


#5

Usually it’s that the label chart is already in line (8 for example) and doesn’t need to be repeated. But when I delete it or…mess around with the stuff more my show stats button freezes the game when I click on it…I wish I could explain it better as I’ve been trying to add race in the whole day but…I guess I sort of hoped you guys who are more experienced would sort of know the problem just by looking at the code?

For additional information: I placed the race code after the gender one.

Hope this helps.


#6
*elseif race =5
 *set race_text "Gnome"
*gotochart

Your indentation is off here, and the command and parameter require a space between them.

If your game is freezing you probably have a loop somewhere. Check your goto statements carefully.


#7

Fixed it, thanks. But i’m still getting the issue.

I narrowed down the coding to see if this would work, but it also did not:


*temp race_text
*if race = 0
  *set race_text "Unknown"
  *goto chart
*elseif race = 1
  *set race_text "Human"
  *goto chart
*elseif race = 2
  *set race_text "Elf"
  *goto chart
*elseif race = 3
  *set race_text "Half-elf"
  *goto chart
*stat_chart
 text race_text Race

#8

What does the full code for your stats page look like with the race options added in?


#9

[b]You, The Seeker[/b]

*temp gender_text
*if gender = 0
 *set gender_text "Unknown"
 *goto chart
*elseif gender = 1
   *set gender_text "Male"
   *image male.jpg
   *goto chart
*elseif gender = 2
   *set gender_text "Female"
   *image female.jpg
   *goto chart
*label chart
*stat_chart
 text gender_text Gender

*line_break

*temp race_text
*if race = 0
  *set race_text "Unknown"
  *goto chart
*elseif race = 1
  *set race_text "Human"
  *goto chart
*elseif race = 2
  *set race_text "Elf"
  *goto chart
*elseif race = 3
  *set race_text "Half-elf"
  *goto chart
*stat_chart
 text race_text Race

*line_break

*stat_chart
  opposed_pair Good
    Evil
  opposed_pair Tech
    Magic

*stat_chart
  percent Intelligence
  percent Charisma
  percent Strength
  percent Dexterity

*line_break

*stat_chart
  percent Gold



#10

I think the problem is because the code for race_text is within the chart label. Everytime the game goes through those if-statements it refers back to the label chart, displays the gender, goes through the if-statements, refers back to the label chart, etc. If you put the race_text code before the *label command, like you did with gender, I think you should be fine


#11

Good eye, @Celtic_Rune.
There’s an issue of infini-loop with the *goto_chart command.

Usually, when a scene freezes, it’s a good chance that your code has at least one infini-loop error.


#12

Tried placing it above everything and it didn’t work… nor did a bunch of other replacements of the label chart. XD HOWEVER! I’m pretty sure this is the problem since the stat screen seemed to change quite a bit depending on where i’d place it…So, the question is; Where exactly should I place it? :smiley:

Sorry, like I said, I’m new to this…


#13

I assume your *label chart is used to contain all of the *stat_chart, am I correct?

If that’s the case, you might want to move the label down after the “race checks” and remove all the *goto chart.

You won’t need the *goto since the program will read the code thoroughly anyway.


#14

You know as I was looking at it I realised you might need multiple labels to make this work. I haven’t tested this code myself, but I think this should work? If you don’t make a separate label for the race_text code it will never trigger, as the game will go through the gender_text sequence, then skip straight to the stat_charts. By inserting this extra label you make sure that the game runs through both the gender_text and race_text code and only then displays the actual stat_charts

[b]You, The Seeker[/b]

*temp gender_text
*if gender = 0
 *set gender_text "Unknown"
 *goto race
*elseif gender = 1
   *set gender_text "Male"
   *image male.jpg
   *goto race
*elseif gender = 2
   *set gender_text "Female"
   *image female.jpg
   *goto race

*label race
*temp race_text
*if race = 0
  *set race_text "Unknown"
  *goto chart
*elseif race = 1
  *set race_text "Human"
  *goto chart
*elseif race = 2
  *set race_text "Elf"
  *goto chart
*elseif race = 3
  *set race_text "Half-elf"
  *goto chart

*label chart
*stat_chart
 text gender_text Gender

*line_break

*stat_chart
 text race_text Race

*line_break

*stat_chart
  opposed_pair Good
    Evil
  opposed_pair Tech
    Magic

*stat_chart
  percent Intelligence
  percent Charisma
  percent Strength
  percent Dexterity

*line_break

*stat_chart
  percent Gold

#15

THIS WORKED!!! THANK YOU SO MUCH! <3 :smiley: