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.

Scripting Help

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.
tivial
Member
Member
Posts: 5
Joined: September 24th, 2010, 7:58 pm
Name: joshua

Scripting Help

Post by tivial »

i am trying to make a game that takes place on a desserted island where you will need to gather different resources to survive and i was wording how would i go about writing the scripts??

ie: Gathering Limbs,bark, and vines from trees.
User avatar
PizzaLover101
Member
Member
Posts: 1751
Joined: October 23rd, 2009, 1:33 pm
Name: NAME
IRC Username: DaItsicle
Location: By a computer
Contact:

Re: Scripting Help

Post by PizzaLover101 »

Try this: http://sandboxgamemaker.com/wiki/index. ... pickupable
Hope this helps.
And welcome by the way!
Project 1: Da Chest Collector [TBD]
Project 2: Tis a secret [End of summer] announcement June 22 2011
Project 3: An even bigger secret!

http://pizzagametime.tk/
http://forums.pizzagametime.tk/
chocolatepie33
Support Team
Support Team
Posts: 2458
Joined: April 27th, 2010, 5:31 pm
IRC Username: CP

Re: Scripting Help

Post by chocolatepie33 »

In a bit, I have a whole thing on this... hold on...
Julius wrote:Contribute to http://www.opengameart.org NOW!
Save the wiki!
daltonds1
Member
Member
Posts: 368
Joined: September 13th, 2010, 12:26 am
Name: Dalton
IRC Username: Daltonds1
Location: Tomball, Texas

Re: Scripting Help

Post by daltonds1 »

Also.. You might want a inventory script.. Thats my TUT That he posted above:P

Heres the inv script

Add this at the top of your.cfg for your map if your map was called map (like saved name was map) Your config will be map.cfg

Code: Select all

newgui Inventory [
guibutton "Back" "cleargui 1"
guibar
guitext ( format "You have %1 Coins." $money )
guitext ( format "You have %1 treasures" $treasure )
guitext ( format "You have %1 Barrels" $barrel )
]

newgui main [
   guilist [
      guilist [
         guibutton "Inventory" "showgui Inventory"
      ]
   ]
   guibar
   @main
]
Now if you want to add more
You will add this with your quest

apples = 0

then of course

Code: Select all

level_trigger_2 = [
    apples = (+ $apples 1)
    echo "You picked up a Apple!"
]
That will also be what you add to make it pickupable
chocolatepie33
Support Team
Support Team
Posts: 2458
Joined: April 27th, 2010, 5:31 pm
IRC Username: CP

Re: Scripting Help

Post by chocolatepie33 »

Never mind, Dalton put it up... But actually, maybe I will put it up... Sorry, I made this before everyone else posted...

The way to do this would be with a script, you can make one by saving your map, re-loading it, and hitting F6 when you're in edit mode. Or you could externally make a .cfg with the mapname. Either way works.

You would start by adding a level trigger in-game, this would be an invisible mapmodel, you can add one by selecting a spot, hitting ` (above TAB) and typing: "newent mapmodel -1". Once this is done, you would select it and hit F3 and change the trigger type to 12 (a trigger that occurs once) and the level trigger to a #. Then your .cfg code would be like this:

Code: Select all

on_start = [
firewood-pieces = 0
vines = 0
rope = 0
]

level_trigger_1 = [firewood-pieces = ( + $firewood-pieces 1 ) ]
level_trigger_2 = [vines = ( + $vines 1 ) ]
level_trigger_3 = [ if ( > $vines 3 ) [ showgui npc1-1 ] ]
newgui npc1-1 [
guitext "you have enough vines for a rope."
guibar
guibutton "Make a rope?" [ vines = ( - $vines 4 ) rope = ( + $rope 1 ) ]
guibutton "Nah, just wait." [cleargui]
] "Yourself" 

newgui inventory [
guitext ( format "You have %1 vines." $vines ) 
guitext ( format "You have %1 firewood-pieces." $firewood-pieces ) 
guitext ( format "You have %1 length(s) of rope." $rope )
]

newgui main [
        guilist [
           guilist [
              guibutton "inventory" [showgui inventory]
           ]
        ]
        guibar
        @main
     ]
level trigger 1 adds a piece of firewood, 2 same for vines, 3 checks to see if you have 4 vines and asks if you want to make a rope. choosing yes removes 4 vines, but adds a rope. the inventory section creates an inventory showing how many items you have. You could use another if... statement to say "if you have at least 1 vine, then show it. otherwise, no text" within the inventory. The next part adds on the inventory to the main menu.

If I'm wrong, please correct me.

EDIT: Mine has an if statement script. So ha!
Julius wrote:Contribute to http://www.opengameart.org NOW!
Save the wiki!
tivial
Member
Member
Posts: 5
Joined: September 24th, 2010, 7:58 pm
Name: joshua

Re: Scripting Help

Post by tivial »

ok so now all i have to do is create an action button and plug it into the script??
chocolatepie33
Support Team
Support Team
Posts: 2458
Joined: April 27th, 2010, 5:31 pm
IRC Username: CP

Re: Scripting Help

Post by chocolatepie33 »

ehh... Whaddya mean by an action button?
Julius wrote:Contribute to http://www.opengameart.org NOW!
Save the wiki!
daltonds1
Member
Member
Posts: 368
Joined: September 13th, 2010, 12:26 am
Name: Dalton
IRC Username: Daltonds1
Location: Tomball, Texas

Re: Scripting Help

Post by daltonds1 »

What you mean action button?

Just add this in your config file

Code: Select all

on_start = [
apples = 0
money = 0
barrel = 0
]

newgui Inventory [
guibutton "Back" "cleargui 1"
guibar
guitext ( format "You have %1 Coins." $money )
guitext ( format "You have %1 treasures" $treasure )
guitext ( format "You have %1 Barrels" $barrel )
]

newgui main [
   guilist [
      guilist [
         guibutton "Inventory" "showgui Inventory"
      ]
   ]
   guibar
   @main
]
if you want to add something else to the inv

add this
itemname = 0 add that under barrel
then add this
guitext ( format "You have %1 Barrels" $itemname )
changing item name to what you put DONT remove the $
User avatar
PizzaLover101
Member
Member
Posts: 1751
Joined: October 23rd, 2009, 1:33 pm
Name: NAME
IRC Username: DaItsicle
Location: By a computer
Contact:

Re: Scripting Help

Post by PizzaLover101 »

You have three files per map. You have the .ogz, the art.cfg and the .cfg, The rest of the .bak files don't matter. Go into your mapname.cfg files and paste it in. Then make a mapmodel, trigger type 12 so you can pick it up, and then a trigger number so it will recognize when you pick it up and It'll go into your inventory
Project 1: Da Chest Collector [TBD]
Project 2: Tis a secret [End of summer] announcement June 22 2011
Project 3: An even bigger secret!

http://pizzagametime.tk/
http://forums.pizzagametime.tk/
tivial
Member
Member
Posts: 5
Joined: September 24th, 2010, 7:58 pm
Name: joshua

Re: Scripting Help

Post by tivial »

Thanks all this has been realy informational. but i understand how to make things pickupable i want to be able to get the bark streight from the tree.
Locked