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.
In the meantime please join the new Discord Server!
If you have any questions please e-mail me through the Platinum Arts website.
Shop Example Script
- johnno56
- Member
- Posts: 158
- Joined: June 12th, 2009, 4:06 am
- Name: John
- Location: Melbourne, Australia
Re: Shop Example Script
GoBologna120,
Please correct me if I am wrong.
Maybe you could use the following to detect no money?
if ( < $money 1 ) guitext "Sorry. You have no money."
Just a guess...
J
Please correct me if I am wrong.
Maybe you could use the following to detect no money?
if ( < $money 1 ) guitext "Sorry. You have no money."
Just a guess...
J
May your journey be free of incident.
Live long and prosper.
Live long and prosper.
- GoBologna120
- Member
- Posts: 167
- Joined: June 10th, 2009, 3:07 pm
- Name: Tim
- IRC Username: GoBologna
- Location: Nowhere in particular.
Re: Shop Example Script
Well, the shopkeeper usually only tells you if you don't have enough money. I'd think you'd know if you were broke. 


Yay. ^_^
- slyver1988
- Member
- Posts: 10
- Joined: June 25th, 2009, 5:16 pm
- Name: patrick
- Contact:
Re: Shop Example Script
hey help me i wanna try things out... but were i put this scrips??
srry i dont use scripts much xD
i putted it in my .CFG but i only see the invitory
how i get shopkeeper and text ^^

srry i dont use scripts much xD
i putted it in my .CFG but i only see the invitory

how i get shopkeeper and text ^^
---->folow my project at http://www.youtube.com/slyver1988 it will be great and i keep you up to date with all new adds<----
- GoBologna120
- Member
- Posts: 167
- Joined: June 10th, 2009, 3:07 pm
- Name: Tim
- IRC Username: GoBologna
- Location: Nowhere in particular.
Re: Shop Example Script
The coins must be set to level_trigger_1 and the shopkeeper must be set to level_trigger_2. Also, the coin is trigger type 12 and the shopkeep is type 11.

Yay. ^_^
Re: Shop Example Script
I don't know how to script that much if at all but. couldn't you just run a script that asks for the players inventory and if they have the currency thats used at that shop? Like my really bad example:GoBologna120 wrote:It's good to know that I'm contributing something.![]()
The only thing I'm not sure of at the moment is how to have the shopkeeper tell you if you don't have enough money.
(check player inventory for "blah blah")
(if player has "blah blah" let them buy it)
("else" play message: I'm sorry but you don't have enough money for this item)
(end sub)
-
- Member
- Posts: 25
- Joined: June 22nd, 2009, 7:10 pm
- Name: Jacob DeBoer
Re: Shop Example Script
I've got something for you. I redid some things, so just put this back in your cfg. It's mostly your work anyway
It's just like the old one, but if you can't afford something, the shopkeeper will tell you, and you can either say goodbye or continue shopping.

Code: Select all
"on_start" = [
money = 0
pie = 0
sword = 0
treasure = 0
]
"level_trigger_1" = [ money = ( + $money 5 )
echo "You got 5 moneys."
]
"level_trigger_2" = "showgui Shopkeeper"
newgui Shopkeeper [
guitext "What're ya buyin, stranger?" chat
guibar
guilist [
guibutton "Pie: 10 moneys" [
if ( > $money 9 ) [
money = ( - $money 10 )
pie = ( + $pie 1 )
] [showgui NotEnough]
]
guibar
guibutton "Sword: 20 moneys" [
if ( > $money 19 ) [
money = ( - $money 20 )
sword = ( + $sword 1 )
] [showgui NotEnough]
]
guibar
guibutton "Treasure: 40 moneys" [
if ( > $money 39 ) [
money = ( - $money 40 )
treasure = ( + $treasure 1 )
] [showgui NotEnough]
]
]
]
newgui NotEnough [
guitext "Sorry, you don't have enough moneys." chat
guibar
guilist [
guibutton "I'll buy something else." "showgui Shopkeeper"
guibar
guibutton "Goodbye." "cleargui"
]
] "Shopkeeper"
newgui Inventory [
guibutton "Back" "cleargui 1"
guibar
guitext ( format "You have %1 moneys in your wallet." $money )
guitext ( format "You have %1 pies. Yum." $pie )
guitext ( format "You have %1 swords. Not that you can use them..." $sword )
guitext ( format "You have %1 treasures. Lucky you!" $treasure )
]
newgui main [
guilist [
guilist [
guibutton "Inventory" "showgui Inventory"
]
]
guibar
@main
]
-
- Member
- Posts: 3
- Joined: September 18th, 2009, 10:26 pm
- Name: Shane
Re: Shop Example Script
Heres the code to make it where the shopkeeper tells you u dont have enough gold if you havent figured it out yet. only prob is you have to type out another "newgui" but atleast theres a copy and paste option
!!!!
Ofcourse you can change what you want him to say, i just made it where it reminds me how much i have. Also you could take out the "ok" button if you use the keyboard to to exit menus.
And if you didnt want to have a new menu pop up you could always use
so that it would just show up as little text in the corner of the screen. Either way, well there ya go pretty simple.
oh! don't forget to put however many "]" you need. itll tell you if theres one missing.

Code: Select all
if ( < $money 10 ) "showgui ShopKeeper"
newgui ShopKeeper [
guitext ( format "You only have %1 gold." $money )
guibar
guibutton "ok" [
cleargui -1 ]
And if you didnt want to have a new menu pop up you could always use
Code: Select all
echo "You dont have enough gold"
oh! don't forget to put however many "]" you need. itll tell you if theres one missing.
Re: Shop Example Script
thank you this alone has thought me a lot 
EDIT: sorry for double post would this work. as a addon to yours
i say this because i don't know how to assing level trigger

EDIT: sorry for double post would this work. as a addon to yours
Code: Select all
]
"level_trigger_3" = "showgui chest" [money=(=+$money 5)
]
newgui chest [
guitext " wow you obtained 20 coins for your jounerny"
guibar
guilist[
guibutton "leave unlocked in hopes some kind stanger will refill it (i mean howd it get in there in the first place"
]
Last edited by Obsidian on November 11th, 2009, 1:09 am, edited 1 time in total.
Reason: merged double post -- in the future, please just edit your post
Reason: merged double post -- in the future, please just edit your post
- Creatorrookie
- Member
- Posts: 66
- Joined: September 22nd, 2009, 8:35 pm
- Name: John
Re: Shop Example Script
Does the shop script work in the sandbox rpg and 2.4?
The rookie in sandbox... 
