Page 1 of 1

Script trouble - door unlocking.

Posted: January 3rd, 2010, 9:09 am
by Phantom_Spider
Thanks to your help and software I have managed to create a semi-complete game in which the objective is to collect all the coins from the different levels to unlock the last level.
Thanks for everything :D
I have some script that's giving me a bit of trouble though, and I was wondering if you could help me out please?
I have a script that asks you to collect ten coins and when you do it unlocks a door to the next part.
The trouble is when talking to the console the door is unlocked - even if you don't collect any coins.
I've tried placing the "trigger 23 1" in the npc1-4 but I cannot get it to work either way.
I know it's probably dead simple but it's really bugging me :P
Any help would be greatly appreciated.
Thanks for this.

Phantom_Spider

Code: Select all

coins = 0
level_trigger_2 = [
                coins = (+ $coins 1)
                echo "You picked up a coin!"
]
level_trigger_3 = [showgui npc1-1]
level_trigger_4 = [showgui Troll]
level_trigger_5 = [showgui Dragon]
level_trigger_6 = [showgui Secret_Room]
pickedcoins1 = 0
coinquests = 0
newgui npc1-1 [
                if (= $pickedcoins1 2) [
                                guitext "Coins recieved! If you have" chat
                                guitext "forgotten where the room is; check the" chat
                                guitext "corner of the bathroom." chat
                ] [
                                guitext "Please insert 10 coins." chat
                ]
                guibar
                if (< $pickedcoins1 2) [
                                if (= $pickedcoins1 0) [
                                                guibutton "What for?" "showgui npc1-2; pickedcoins1 = 1; coinquests = (+ $coinquests 1)" chat
                                ] [
                                                if (> $coins 9) [
                                                                guibutton "I've got the coins you wanted" [pickedcoins1 = 2; showgui npc1-4; trigger 23 1; coins = (- $coins 10)] chat
                                                ] [
                                                                guibutton "I've got the coins you wanted" [showgui npc1-3] chat
                                                ]
                                ]
                ]
                guibutton "Good bye" [echo "Castle Guide: Bye!"] chat
] "Castle Guide"
 
newgui npc1-2 [
                guitext "I require 10 coins, if you get them for me" chat
                guitext "I will tell you of the secret room." chat
                guibar
                guibutton "I'll go look for a few then, I'll be back soon" [echo "Castle Guide: Take your time!"] chat
] "Castle Guide"
 
newgui npc1-3 [
                guitext (format "I require 10 coins, you only have %1." $coins) chat
                guitext "Keep looking, they're hidden well." chat
                guibar
                guibutton (format "WTF!  %1 more?" (- 10 $coins)) chat
] "Castle Guide"
 
newgui npc1-4 [
                guitext "Coins recieved, the secret room" chat
                guitext "is in the corner of the bathroom. Enjoy!" chat
                guibar
                guibutton "Great, thanks!" [echo "Castle Guide: No problem!"]
] "Castle Guide"
level_trigger_23 = [if (= $triggerstate -1) [echo "The door is locked"] [echo "The doors screeches violently as it flies open"]]

Re: Script trouble - door unlocking.

Posted: January 3rd, 2010, 10:18 am
by Mike
Before I look at your code (since that stuff hurts my brain :D) here is some stuff that might be helpful:
viewtopic.php?f=15&t=114
viewtopic.php?f=15&t=102

What trigger type are you starting the door at? Maybe you should try making it trigger type 11 to start off with. Have you seen this list?
http://sandboxgamemaker.com/platinumart ... _mapmodel_

I think we need a volunteer to make a key unlocking doors tutorial :D Take care and let us know how it goes!
-mike

Re: Script trouble - door unlocking.

Posted: January 6th, 2010, 5:52 am
by Phantom_Spider
Thanks I've taken a look at the links you posted but I can't find anything that helps :\
And yes it is set to 11 :)

Re: Script trouble - door unlocking.

Posted: January 6th, 2010, 5:56 am
by Phantom_Spider
When I get this working properly I'll happily make a tutorial though :D