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.
arcones
Support Team
Support Team
Posts: 2734
Joined: January 13th, 2010, 12:42 pm
Name: Timothy
IRC Username: I use Steam
Location: Looking over your shoulder...
Contact:

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

Post by arcones »

Wow! That seems like something I would've done :P

Thanks for the tut, I plan or re-reading it and digging deeper thanks to this jumpstart!
Image
Want a user bar like this one? PM Leo!
Hirato
Developer
Developer
Posts: 689
Joined: May 30th, 2009, 1:23 pm
IRC Username: hirato

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

Post by Hirato »

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"
You are supposed to pass -grpg to the script so the script sets SANDBOX_MODULE to rpg for you to launch the game, aka ./sandbox_unix -grpg
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.
You are meant to use data/rpg/games/base as the base for your games, unless you intend to expand on the default game (eg a mod)

Code: Select all

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?
//  - The comment here is inaccurate, actor is the player, not 0
            r_signal "loot" actor self 0 // If dead, then invoke r_script_signal loot (where self is NPC1 and 0 is player)
        ] [
            r_chat self 0 // If not dead, then invoke r_script_say to start the chat
        ]
    ]
]

// - you should use r_loop_inv self ent [ ] if you intend to do looting like this and not manually check for every item
r_script_signal loot [ // invoked by r_script_signal interact
    if (= (r_get_amount self 25) 0) [ // do NPC1 have the 25 silver?
        r_remove self 8 25 // remove 25 silver from NPC1
        r_additem player 8 25 // add 25 silver to player
        echo "You loot 25 Silver" // message
    ] [
        echo "Nothing to loot" // message
    ]
]
You'll find two comments explaining what is wrong there
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
This is wrong, the player's script by default points to script 7 or so with the base game. The first script and mapscript (0.cfg) for sanity reasons should be empty and do nothing AT ALL TIMES. The same goes for the NPC's definitions. Even the old default game (temporarily removed, everything will be back soon) adhered to this.
You can add an attacksound with:
r_script_signal attacksound [
r_sound (concatword "marystorm/" (? $lefthand tornado airblast)) self
]
this signal was a temporary hack for rosestorm, I make no guarantee that it's going to stay or remain. Your script also really only caters to what is assumed with rosestorm, that the tornado is on the left and the 'airblast' is on the right.

Hud

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, but if you really want to hack your hud or just make small changes to the data shown, the nice stuff is in data/rpg/menus.cfg.
[/quote][/quote]

The hud would be modified by creating a custom set of HUD scripts derived from data/rpg/hud_standard.cfg or otherwise. data/rpg/menus.cfg is specifically for the GUIs

Now with all of that out of the way, why won't someone look at my tutorial? http://www.sandboxgamemaker.com/wiki/in ... G_tutorial :3c
Last edited by Hirato on October 12th, 2011, 9:37 pm, edited 1 time in total.
Reason: nesting quotes! w00t!
This is not a url, clicking it is pointless
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 »

no offense hirato, but your tutorial is kinda confusing... wildflower might be wrong, but hers is at least sort of understandable...

if you want to know what's confusing me, you don't really say which files to open and edit.
We can go about this in a few ways, but we'll start by first defining the NPC's script, the NPC, and then creating a place for him in the world. First off, go to your definitions directory (probably data/rpg/games/tutorial) and then enter the script subdirectory. You will not want to create a new configuration file and place it at the very end of the others (eg, if the last is named 7.cfg, name yours 8.cfg). In this file, we define how any entities using it will react and interact with the surrounding world. Since we don't want to bother with that, we will simply include the default NPC script.
What am I supposed to do there? Create 8.cfg (which you said NOT to do), or edit a previous one?
Julius wrote:Contribute to http://www.opengameart.org NOW!
Save the wiki!
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 »

Thanks for the corrections, theres a lot I have to go edit :D
I have several scripts in my RPG that use those things, but I'll update the howto as soon as I get through them.

btw. Thanks for the link to the tutorial, I have looked everywhere for that. Is it even linked in the main wiki?
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 »

chocolatepie33 wrote:wildflower might be wrong, but hers is at least sort of understandable...
sort of... :lol:
Hirato
Developer
Developer
Posts: 689
Joined: May 30th, 2009, 1:23 pm
IRC Username: hirato

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

Post by Hirato »

wildflower wrote:btw. Thanks for the link to the tutorial, I have looked everywhere for that. Is it even linked in the main wiki?
yes, it's on the RPG's page http://www.sandboxgamemaker.com/wiki/in ... ?title=RPG
I still have a lot of things to update on the script and configuration sections, but that area itself and the tutorial are up to date and compliant for 2.7.0
This is not a url, clicking it is pointless
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:
chocolatepie33 wrote:wildflower might be wrong, but hers is at least sort of understandable...
sort of... :lol:
@wildflower: Most definately! ;) Lucky for me, I've been developing the C+C designer with one thing in mind: Simplicity. Using WinForms DialogBoxes to transfer data between them and the main window. I may transfer a few things from the main window to a new form for design view. I've been trying to find a usable workaround for the .NET framework. If you find one, let me know.

Oh, and sorry for hijacking your post, wildflower. :oops:
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 »

I've made some changes to the original post and are trying to iron out any remaining errors, but there are some thing I don't quite understand.
Hirato wrote:You are supposed to pass -grpg to the script so the script sets SANDBOX_MODULE to rpg for you to launch the game, aka ./sandbox_unix -grpg
If I edit the file, doesn't it do the same thing?
Hirato wrote:You are meant to use data/rpg/games/base as the base for your games, unless you intend to expand on the default game (eg a mod)
Then a mod it is :D
I'll try to changes this later, but for now I'll just call it a mod.
you should use r_loop_inv self ent [ ] if you intend to do looting like this and not manually check for every item
Not sure I understand this... I get the concept, but I don't know how to use it in a script.
Would be cool to loop through the inventory in one line instead of two lines for every item.


Regarding your tutorial, I can't see it in the list of tutorials in the wiki, shouldn't it be on that list?
Hirato
Developer
Developer
Posts: 689
Joined: May 30th, 2009, 1:23 pm
IRC Username: hirato

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

Post by Hirato »

Regarding your tutorial, I can't see it in the list of tutorials in the wiki, shouldn't it be on that list?
as I said, it's in the RPG section of the wiki.

you should use r_loop_inv self ent [ ] if you intend to do looting like this and not manually check for every item
Not sure I understand this... I get the concept, but I don't know how to use it in a script.
Would be cool to loop through the inventory in one line instead of two lines for every item.

Code: Select all

r_loop_inv self item [
    r_additem player (r_get_base item) (r_get_amount item)
    r_remove self (r_get_base item) (r_get_amount item)
]
This is not a url, clicking it is pointless
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 »

Hirato wrote:

Code: Select all

r_loop_inv self item [
    r_additem player (r_get_base item) (r_get_amount item)
    r_remove self (r_get_base item) (r_get_amount item)
]
Thanks 8-) this saves me several lines of code in every npc-script.

EDIT:
I added a line to echo what is being looted and updated the howto with the new loot code.

Code: Select all

r_loop_inv self item [ // If dead, then loop through the inventory
    echo (format "You find %1 %2" (r_get_amount item) (r_get_name item)) // for every item echo amount and 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
]
Post Reply