caine150 Posted August 14, 2009 Share Posted August 14, 2009 Ok, I am creating a door that once activated will display a message like this: "Voiceless it cries, wingless flutters, toothless bites mouthless mutters...Who am I?" "Bat""Wraith""Wind""Fire" When the player chooses the correct answer, the door is unlocked and you can continue to the next room. But when the player chooses the wrong answer he/she is struck by lightning as a penalty. The problem that I am having is in the wrong answers. Once struck by the lightning the MessageBox is closed. When you try to activate the door to try again, nothing happens, the Riddle screen does not show forcing the player to reload a previous game... I am stuck, below is the code that I am using, hope someone can help...Thanks!!! ~Script Below~ ScriptName RiddleDoor Short controlvarShort button Begin OnActivate If (controlvar == 0 ) MessageBox "Voiceless it cries, wingless flutters, toothless bites, mouthless mutters...What am I?", "Bat", "Wraith", "Wind", "Fire" Set controlvar to 1 ElseIf ( controlvar > 1 ) Activate EndIfEnd Begin GameMode If ( controlvar == 1 ) Set button to GetButtonPressed If ( button== -1 ) Return ElseIf ( Button == 2 ) MessageBox "The Master accepts your answer" Set controlvar to 2 Else MessageBox "You have answered incorectly, be punished..." Cast Mg05FingerSpell15 player Set controlvar to -1 EndIf ElseIf ( controlvar == 2 ) Activate Set controlvar to 3 EndIfEnd Link to comment Share on other sites More sharing options...
Vagrant0 Posted August 14, 2009 Share Posted August 14, 2009 Try this instead, changes are marked in bold. ScriptName RiddleDoor Short controlvar Short button Begin OnActivate If (controlvar == 0 ) MessageBox "Voiceless it cries, wingless flutters, toothless bites, mouthless mutters...What am I?", "Bat", "Wraith", "Wind", "Fire" Set controlvar to 1 ElseIf ( controlvar > 1 ) Activate EndIf End Begin GameMode If ( controlvar == 1 ) Set button to GetButtonPressed If ( button== -1 ) Return ElseIf ( Button == 2 ) MessageBox "The Master accepts your answer" Set controlvar to 2 Else MessageBox "You have answered incorectly, be punished..." Cast Mg05FingerSpell15 player Set controlvar to [b]0[/b] EndIf ElseIf ( controlvar == 2 ) [b] setopenstate to 1[/b] Set controlvar to 3 EndIf End Basically, you weren't resetting the script when a wrong answer was selected. The use of setopenstate is a bit more reliable (and prevents the activate block from running twice) since you have both an activate block and a gamemode block which calls activate, creating a momentary, and unnecessary, loop. Link to comment Share on other sites More sharing options...
caine150 Posted August 14, 2009 Author Share Posted August 14, 2009 Ok, thanks allot this was very helpful! And simple! Link to comment Share on other sites More sharing options...
Recommended Posts