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.

Quick and dirty hands-on approach to PAS-RPG

Learn more on how to use Sandbox, or submit your own tutorials or resources.
User avatar
wildflower
Member
Member
Posts: 76
Joined: August 11th, 2011, 5:10 am
Name: Sandie

Quick and dirty hands-on approach to PAS-RPG

Post by wildflower »

Latest update: oct 22 2011

:!: This is NOT the official way of making an RPG, if you like to learn the official way of doing this, take a look at Hiratos guide : http://www.sandboxgamemaker.com/wiki/in ... G_tutorial


I'm trying to create a HowTo to the RPG-mode, mostly because I want to learn more about PAS (2.7), and I'll just throw it here, in case someone else might find it useful.
Unfortunately there are some huge gaps in my basic knowledge of PlatinumArtsSandbox (PAS), so if anyone have corrections and/or something else to add, feel free to comment.
My "research" consist of several pages of unreadable scribbles on coffee-stained bits of paper in a pile next to my keyboard, so theres bound to be some errors, but I hope that I have at least covered the basics to get someone started with PAS.
I have never been one to spend hours looking through the manual myself, and I prefer to just dive in and solve the problems as they come along, so without further ado, here it is, my "Quick and dirty hands-on approach to PAS-RPG".

RPG-mode
To start PAS in RPG-mode, first you have to edit the launcher to make PAS run in RPG mode, this is done different on Linux, Mac and Windows:

Linux:
In the file sandbox_unix, line 8 should be SANDBOX_MODULE="rpg"

Mac:
TODO

Win:
TODO

Mapbuilding

When you start PAS, choose [togle editmode] and then [new map].
Default size is 10, large maps equals long load times and unless you're planning to build a large city, I recommend staying with the default option for now.
You can always enlarge the map later with the command mapenlarge (doubles the dimensions of the current map).

Mapbuilding is pretty straightforward and theres lots of great examples on youtube if you want tips on how to build the world.
You can edit the .platinumarts/packages/rpg/mapname-art.cfg to add textures and mapmodels, but if you want to add more complex things, you have to use scripts.

Scripting

PAS comes with a game called default (by Hirato), you can use this as a template for your game, just copy and then rename the folder /data/rpg/default to /data/rpg/awesomegame and the file /data/rpg/default.cfg to /data/rpg/awesomegame.cfg. Now you have a complete structure of folders to build your game in.

In the top of the file hierarchy theres the file awesomegame.cfg, Use this as a template for your own game and add your own maps like this:

Code: Select all

r_preparemap "awesomemap" 0
r_preparemap "greatmap" 1
r_preparemap "greatestmapever" 2

//variables
firstmap awesomemap
gameversion 1
compatversion 1

exec data/rpg/hud_standard.cfg
This will load the map awesomemap (/packages/base/rpg/awesomegame.ogz) when you start the game, and from there you can transport the player to greatmap or gretestmapever.
It also sets the variables firstmap, gameversion and compatversion and loads the hud, but more about that later.

If you copied and renamed the folder, you should now have the following folders in awesomegame:

ammo // TODO
containers // TODO
critters // NPC's and monsters (model, name, etc.)
cutsceenes // TODO
effects // TODO
factions // friend or foe
items // scripted items (model, name, etc.)
mapscripts // maps
obstacles // TODO
platforms // TODO
recipies // TODO
scripts // Scripts for everything
statuses // TODO
triggers // Triggers (model, name, etc.)

and the files:

player.cfg // player model, name, etc.
tips.cfg // text to display during load and gameplay
variables.cfg // game variables like quest-status

Mapscripts folder

The folder mapscripts contain every map used in the game (0.cfg being the first, 1.cfg the second and so on), the file 0.cfg (awesomemap) could look something like this:

Code: Select all

r_mapscript_signal load [
    r_spawn_creature self 20 0 // NPC1
    r_spawn_creature self 21 1 // NPC2

    r_spawn_trigger self 10 0 // Wood door

    r_spawn_item self 30 0 // Healing plant
    r_spawn_item self 31 1 // Mana mushroom
    r_spawn_item self 32 2 // Silverspoon
]
So if you go to your map and in edit mode click F3, choose new entity, select it with your mouse and click ".", edit the line so it says "spawn 0 0 20" and you'll have a NPC1 on your map, and so on (you can also select spawn and assign the tag in the F3 menu).

Critters folder

Now we have NPC1 on our map (don't forget to save), as you can see in the mapscript, the creature NPC1 points to a script 0, you'll find it in the folder critters called 0.cfg.

Code: Select all

r_char_mdl "rpg/characters/npcman"
r_char_name "NPC1 name"
r_char_base_level 5
r_char_script 1
r_char_faction 0
Model (r_char_mdl) and name (r_char_name) are self evident, it's the script (r_char_script) where all the fun begins, the file is 1.cfg in the folder scripts.

Scripts folder

Here is an example of the NPC1 script (1.cfg in the folder scripts):

Code: Select all

// NPC1

r_script_signal interact [ // When you interact with someone/something using the "e"-key, you invoke r_script_signal interact
    if (r_matchref player actor) [
        if (= (r_get_state self) $CS_DEAD) [ // Is the player dead?
            r_loop_inv self item [ // If dead, then loop through the inventory
                r_select_item (r_get_base item) [ //select the item's definition based on its index
                    echo (format "You found %1 x %2" (r_get_amount item) (r_item_name_get)) //prints the amount and the item's name
                ]
                r_additem player (r_get_base item) (r_get_amount item) // add to player inventory
                r_remove self (r_get_base item) (r_get_amount item) // remove from npc inventory
            ]
        ] [
            r_chat self 0 // If not dead, then invoke r_script_say to start the chat
        ]
    ]
]

r_script_signal spawn [ // What items and/or spells do NPC1 have
    r_additem self 8 25 // 25 Silver - defined in awesomegame/items/8.cfg
]

r_script_say "NPC1 greating" [ // invoked by r_script_signal interact // 0
    r_response "Player ask a question?" 1 // go to 1
    r_response "Player ends chat" -1 // end
]
r_script_say "NPC1 answer question" [ //1
    r_response "Player ask another a question?" 2 // go to 2
    r_response "Player ends chat" -1 // end
]
r_script_say "NPC1 answer another question" [ //2
    r_response "Player ends chat" -1 // end
]
Just like npc's items and triggers, the player configuration is scripted the same way. The file awesomegame/player.cfg points to the relevant player model and script.
So if we wanted to add a spell or just some money to the player inventory, we just add the apropriate items in the script, which in this case is scripts/0.cfg

And this line in your playerscript lets you know when you have earned enough experience to level up:
r_script_signal level [
echo (format "You have reached level %1 and have %2 point(s) to spend" (r_get_level player) (r_get_points player))
]

If you want your player or an npc to have a spell equipped when spawned:
r_equip self 1 0 // this will equip the item 1 in slot 0

Items folder

All spawnable items have a file in this folder. In our NPC1 script above, the npc have 25 item 8 (items/8.cfg)

Code: Select all

// Silver
r_item_name "Silver"
r_item_icon "silver.png" // the inventory icon (looks for the file in /data/rpg/hud/)
r_item_description "Silver" // description in inventory
r_item_mdl "rpg/objects/coin/silver"
r_item_worth 1
r_item_weight 0.1
r_item_script 7
The r_item_icon and r_item_description are for the inventory only.
Script 7.cfg is a default pickup script for when you interact with an item using the "e"-key.

Code: Select all

r_script_signal interact [ //
    r_signal "touch" actor self 0 //executes this item's touch slot on whoever tried to pick up this item
    if (!= (r_get_state actor) $CS_DEAD) [
        amnt = (r_get_amount self)
        r_pickup actor self
        if (!= $amnt (r_get_amount self)) [
            r_signal "pickup" actor self 0 //amount mismatch, actor picked up a few items
        ]
    ]
]
Triggers folder

Placing a trigger on the map is just like placing an npc, and if you look at the mapscript for awesomemap (0.cfg), it contain this line:
r_spawn_trigger self 10 0 // Wood door
So every time you place a spawn with tag 10, you get a wood door that is controlled by triggers/0.cfg

Code: Select all

r_trigger_name "Heavy Wooden Door" // The name of the trigger
r_trigger_mdl dan/door // model (packages/models/dan/door)
r_trigger_script 3 // the file that controls this trigger (in this case scripts/3.cfg)
In this case we just trigger the open-door animation with r_trigger self

Code: Select all

r_script_signal interact [ // Just like critters and items
    r_trigger self // trigger self (self being the door)
]
Variables

The file variables.cfg contain game variables like quest-status and is read with r_global_get, and can easily be used inside an if-else loop like this:

Code: Select all

if ( = (r_global_get $awesome_quest) 0) [ // is the value 0?
    r_response "The awesome quest is not started yet" -1 // Yes the value is 0
] [
    r_response "The awesome quest is started" -1 // No the value is not 0
]
You can also use r_global_set to set a new value to the variable like this: r_global_set $awesome_quest 1

HUD/GUI

There are a lot of cool skins for the hud in PAS, and in the folder data/rpg/hud/ you can place your own icons for items and such.
If you want to hack your GUI or just make small changes to the data shown, the nice stuff is in data/rpg/menus.cfg.
Last edited by wildflower on October 22nd, 2011, 5:46 am, edited 10 times in total.
User avatar
jSoftApps
Member
Member
Posts: 426
Joined: May 2nd, 2011, 10:02 pm
Name: J.R.
IRC Username: jSoftApps
Location: jSoft Apps Software Innovations HQ
Contact:

Re: Quick and dirty hands-on approach to PAS-RPG

Post by jSoftApps »

Looks pretty good, this should help any n00b with RPG mode
Good Job!
jSoft Apps Software Innovations - App, Games and More!
Visit our Website!

Image

jSoft Apps is now on indie db!
Image
java.x.beast
Member
Member
Posts: 194
Joined: August 10th, 2011, 2:35 pm
Name: Addis
IRC Username: javaxbeast
Location: Chicago, IL
Contact:

Re: Quick and dirty hands-on approach to PAS-RPG

Post by java.x.beast »

Wow, wildflower, I am speechless. First off, thank you for doing what many people have been to busy/lazy to do (me :D). I can obviously tell that you put a lot of work into this, and it is greatly appreciated. One thing though, for your triggers code, your comment is missing something. It doesn't search in packages/dan/door, it searches in packages/models/dan/door. Just saying this so that the others won't accidentally put their own custom models into packages. :D
Otherwise, it looks pretty good! I applaud you for taking your own personal, precious time to help the newcomers of Platinum Arts Sandbox.

Thanks,
CEO of Vulcanis Entertainment,
Addis Regassa
Age of Darkness
Maps: Image
Music: Image
Models: Image
Scripts: Image
Other: Image
Visit the company website: (In progress (Expected to be released in two weeks :uber:) 8-) :D 8-) )
Visit the company page on ModDB: Vulcanis Entertainment
java.x.beast wrote: I got them moves like JAGger!!!
User avatar
wildflower
Member
Member
Posts: 76
Joined: August 11th, 2011, 5:10 am
Name: Sandie

Re: Quick and dirty hands-on approach to PAS-RPG

Post by wildflower »

java.x.beast wrote:... for your triggers code, your comment is missing something. It doesn't search in packages/dan/door, it searches in packages/models/dan/door
Thanks :D
I have edited the path in the original post
java.x.beast
Member
Member
Posts: 194
Joined: August 10th, 2011, 2:35 pm
Name: Addis
IRC Username: javaxbeast
Location: Chicago, IL
Contact:

Re: Quick and dirty hands-on approach to PAS-RPG

Post by java.x.beast »

Glad to be of service. :D
Age of Darkness
Maps: Image
Music: Image
Models: Image
Scripts: Image
Other: Image
Visit the company website: (In progress (Expected to be released in two weeks :uber:) 8-) :D 8-) )
Visit the company page on ModDB: Vulcanis Entertainment
java.x.beast wrote: I got them moves like JAGger!!!
chocolatepie33
Support Team
Support Team
Posts: 2458
Joined: April 27th, 2010, 5:31 pm
IRC Username: CP

Re: Quick and dirty hands-on approach to PAS-RPG

Post by chocolatepie33 »

Copy->paste into MS Word-> Save as PDF. Now I have it forever. Yay!
Julius wrote:Contribute to http://www.opengameart.org NOW!
Save the wiki!
User avatar
Leo_V117
Support Team
Support Team
Posts: 1640
Joined: February 16th, 2010, 8:00 pm
Name: Leo
IRC Username: Leo_V117
Location: That one place...
Contact:

Re: Quick and dirty hands-on approach to PAS-RPG

Post by Leo_V117 »

Thanks for that wildflower, I managed to document the commands and whatnot. Gonna add them to ESB pretty soon. Especially to the C+C Interface, which is actually coming along pretty nicely. Again, Thanks wildflower!
static520
Member
Member
Posts: 3
Joined: October 10th, 2011, 5:11 pm
Name: Eddie

Re: Quick and dirty hands-on approach to PAS-RPG

Post by static520 »

You win the internet today wildflower!! :D
User avatar
wildflower
Member
Member
Posts: 76
Joined: August 11th, 2011, 5:10 am
Name: Sandie

Re: Quick and dirty hands-on approach to PAS-RPG

Post by wildflower »

Leo_V117 wrote:Thanks for that wildflower, I managed to document the commands and whatnot. Gonna add them to ESB pretty soon. Especially to the C+C Interface, which is actually coming along pretty nicely. Again, Thanks wildflower!
You're welcome, Any chance of a Linux version?
User avatar
Leo_V117
Support Team
Support Team
Posts: 1640
Joined: February 16th, 2010, 8:00 pm
Name: Leo
IRC Username: Leo_V117
Location: That one place...
Contact:

Re: Quick and dirty hands-on approach to PAS-RPG

Post by Leo_V117 »

wildflower wrote:
Leo_V117 wrote:Thanks for that wildflower, I managed to document the commands and whatnot. Gonna add them to ESB pretty soon. Especially to the C+C Interface, which is actually coming along pretty nicely. Again, Thanks wildflower!
You're welcome, Any chance of a Linux version?
Maybe, although it needs a .NET Framework replacement for Linux. You could always use WINE I guess... Until I atleast manage to replace .NET.
Post Reply