Hi! Welcome to the forum for Platinum Arts Sandbox Free 3D Game Maker. I currently have the forums locked as I am attempting to properly update them.

In the meantime please join the new Discord Server!

If you have any questions please e-mail me through the Platinum Arts website.

Script trouble - door unlocking.

Having issues not related to a specific Sandbox game mode? Get help here!
Please also read the rules for support when posting support requests.
Failure to comply with the forum rules may result in your topic being locked without resolution.
Locked
Phantom_Spider
Member
Member
Posts: 3
Joined: November 23rd, 2009, 6:59 am
Name: Phantom Spider
IRC Username: Phantom_Spider

Script trouble - door unlocking.

Post 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"]]
User avatar
Mike
Administrator
Administrator
Posts: 871
Joined: May 24th, 2009, 12:52 pm

Re: Script trouble - door unlocking.

Post 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
Sign up for our Newsletter to keep up to date with the Sandbox news!
We also have a facebook page, facebook group, myspace page and a twitter page[/b][/color]!
Phantom_Spider
Member
Member
Posts: 3
Joined: November 23rd, 2009, 6:59 am
Name: Phantom Spider
IRC Username: Phantom_Spider

Re: Script trouble - door unlocking.

Post 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 :)
Phantom_Spider
Member
Member
Posts: 3
Joined: November 23rd, 2009, 6:59 am
Name: Phantom Spider
IRC Username: Phantom_Spider

Re: Script trouble - door unlocking.

Post by Phantom_Spider »

When I get this working properly I'll happily make a tutorial though :D
Locked