Designing a basic school
Posted: Sun Oct 14, 2012 2:24 pm
So I've been designing schools with OSDs on my world. Here I will include the basic implementation of the code for one of them. Everything runs on OSDs. When a player chooses to learn a skill, a playervar is set to a value. So that they're not able to learn said skill again. If they try, and OSD pops up telling they already know the skill. This is all decided with an if else statement. However, I've run into a problem. And I did on purpose. When I choose to forget said skill. The playervar is not reset. And so the server still thinks I know the skill. And I can't learn it again. The OSD pops up telling me I already know the skill, because the player var has not been reset.
How can I tell the server to reset the playervar in quiestion once choosing to forget the skill?
Apart from that, the script works perfectly.
How can I tell the server to reset the playervar in quiestion once choosing to forget the skill?
Apart from that, the script works perfectly.
Code: Select all
Event( "OSDSelect", "Drill:Lskill1" )
{
if($playervar1 = 1)
{
osdcreate(OSDLIST,"No1","Sorry")
osdadditem(OSDTEXT,"","Sorry, but you're already a Drillmaster. There's nothing new we can teach you. Perhaps you could teach us.")
osdadditem(OSDEXITBUTTON,"Exit","Leave the temple")
osdactivate()
}
else
{
*grantskill %PLAYER% Drillmaster
*msg %PLAYER% You are now a Drillmaster
$playervar1=1
}
}
Event( "OSDSelect", "Mush:Lskill2" )
{
if($playervar2 = 2)
{
osdcreate(OSDLIST,"No2","Sorry")
osdadditem(OSDTEXT,"","Sorry, but you're already a Mushroom Farmer. There's nothing new we can teach you. Perhaps you could teach us.")
osdadditem(OSDEXITBUTTON,"Exit","Leave the temple")
osdactivate()
}
else
{
*grantskill %PLAYER% Mushroom Farmer
*msg %PLAYER% You are now a Mushroom Farmer
$playervar2=2
}
}
Event( "OSDSelect", "Chance:Lskill3" )
{
if($playervar3 = 3)
{
osdcreate(OSDLIST,"No3","Sorry")
osdadditem(OSDTEXT,"","Sorry, but you're already a Chancellor. There's nothing new we can teach you. Perhaps you could teach us.")
osdadditem(OSDEXITBUTTON,"Exit","Leave the temple")
osdactivate()
}
else
{
*grantskill %PLAYER% Chancellor
*msg %PLAYER% You are now a Chancellor
$playervar3=3
}
}
Event( "OSDSelect", "Cook:Lskill4" )
{
if($playervar4 = 4)
{
osdcreate(OSDLIST,"No4","Sorry")
osdadditem(OSDTEXT,"","Sorry, but you're already a Cook. There's nothing new we can teach you. Perhaps you could teach us.")
osdadditem(OSDEXITBUTTON,"Exit","Leave the temple")
osdactivate()
}
else
{
*grantskill %PLAYER% Cook
*msg %PLAYER% You are now a Cook
$playervar4=4
}
}