Quick and dirty hands-on approach to PAS-RPG

Learn more on how to use Sandbox, or submit your own tutorials or resources.
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

Postby java.x.beast » October 13th, 2011, 4:51 pm

Hey, sorry for being the stupid one here, but can someone explain the r_loop_inv command? Also, CP, I understand Hirato's tutorial. The addendum helped a lot. Thanks for those great tuts, Hirato and wildflower!
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!!!

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

Postby arcones » October 13th, 2011, 5:45 pm

Correct me if I'm wrong Hirato.

Java, you're invoking a loop of the inventory. However, each time it "finds" the item it'll add a new stat instead of overwriting the other one. Then it'll also get the proper amount as well. At least, from looking at it that's what I see.
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

Postby Hirato » October 13th, 2011, 8:54 pm

wildflower wrote: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
]


You probably do not want to give the player the raw indices, so the following would probably be a better script

Code: Select all

r_loop_inv self item [ // loop through the inventory of self, iteratively assigning the items to item
    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
]
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

Postby wildflower » October 14th, 2011, 5:27 pm

Hirato wrote:You probably do not want to give the player the raw indices, so the following would probably be a better script


I'm sorry to say that I have no idea why it's bad to give raw indices, but since you actually know what you are talking about (in stark contrast to me), I'll go with your solution ;)

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

Postby chocolatepie33 » October 14th, 2011, 5:34 pm

java.x.beast wrote:Also, CP, I understand Hirato's tutorial. The addendum helped a lot. Thanks for those great tuts, Hirato and wildflower!



Hmmm... Looks like I should take another look at that section.
Julius wrote:Contribute to http://www.opengameart.org NOW!

Save the wiki!

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

Postby java.x.beast » October 14th, 2011, 6:01 pm

I think I get the "r_loop_inv" command now. Correct me if I'm wrong, but are we not supposed to replace "item" with the name of the item? If so, I understand! If not, I'm stupider than Dumb and Dumber put together.
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
lzrstrm
Member
Member
Posts: 122
Joined: September 21st, 2011, 8:26 pm
Location: Canada

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

Postby lzrstrm » October 14th, 2011, 6:51 pm

I`m Still Confused About This
:(
Current Project
The Shadow People

Image
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

Postby java.x.beast » October 14th, 2011, 7:05 pm

I'm working on a video tutorial. It'll be out soon enough.
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

Postby wildflower » October 14th, 2011, 7:29 pm

java.x.beast wrote:I think I get the "r_loop_inv" command now. Correct me if I'm wrong, but are we not supposed to replace "item" with the name of the item? If so, I understand! If not, I'm stupider than Dumb and Dumber put together.


No you don't have to replace anything for this to work, every time the loop finds an item it is defined as "item", so when you later call "r_get_amount item" you get the amount of "item", to simplify:

Look in inventory for items, if an item is found, call it "item" so you can reference it later as "item"
remove "item" from npc
add "item" to player
repeat (when the loop goes through second time and a new item is found, it becomes "item")

creeperfan5236
Member
Member
Posts: 2
Joined: December 31st, 2011, 9:37 am
Name: jay

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

Postby creeperfan5236 » December 31st, 2011, 6:35 pm

so how would I reset the map without changing the folders in my directory?

EDIT: If you didnt get what I ment, I ment if I made a new game, it would go to PlatinumArtsSandbox2.7.1\my_stuff\data\rpg\saves, not PlatinumArtsSandbox2.7.1\data\rpg\games...so I dont know what to do :|


Return to “Tutorials and Resources”

Who is online

Users browsing this forum: No registered users and 2 guests