I have made a small character creation (just to train) where at one point the player must choose his skills, with the following rules
- The default number of skills is 4, each skill cost one point
- Skills are limited by class
- The player can´t choose the same skills twice.
In order to avoid the player to choose same skills twice, the game first check the status for the current skills (per exemple, the $ sk for swords), which initialy is set false. If the variable is set as false it shows on the menu if also the class match. Once the skills have been selected, it´s status change to true, therefore no longer showing on the menu.
Overall the whole thing works, except if the player choose any classe beside fighter, because in this case, its possible to choose the same skill twice and I can´t exactly figure why. I believe is because I am using on the menu, a If sentence with lots of "or" s.
Here is the part of the code where skills are selected.
Code: Select all
e "choose your Skills"
$ sk = 4
$ sknormal = 4
$ skill =[]
$ sw = False
$ spe = False
$ ax = False
$ bw = False
$ mc = False
$ st = False
$ dg = False
if class1 == "Fighter":
$ sk +=1
$ sknormal +=1
if class1 == "Cleric":
$ sk -=2
$ sknormal -=2
if class1 == "Thief":
$ sk -=1
$ sknormal -=1
while skill >= sknormal:
e "current skill points left=[sk] and current skills [skill]"
menu:
"Sword" if sw == False and class1 == "Fighter" or class1 == "Barbarian":
$sk -=1
$skill.append("Sword")
$ sw = True
"Spear" if spe == False and class1 == "Fighter" or class1 == "Barbarian":
$sk -=1
$skill.append("Spear")
$ spe = True
"Bow" if bw == False and class1 == "Fighter" or class1 == "Barbarian" or class1 == "Thief":
$sk -=1
$skill.append("Bow")
$ bw = True
"Axe" if ax == False and class1 == "Fighter" or class1 == "Barbarian":
$sk -=1
$skill.append("Axe")
$ ax = True
"Mace" if mc == False and class1 == "Fighter" or class1 == "Barbarian" or class1 == "Cleric" or class1 == "Thief":
$sk -=1
$skill.append("Mace")
$ mc = True
"Staff" if st == False :
$sk -=1
$skill.append("Staff")
$ st = True
"Dagger" if dg == False :
$sk -=1
$skill.append("Dagger")
$ dg = True
if sk == 0:
e "current skill points left=[sk] and current skills [skill]"
jump Inventory1
