Jump to content


Photo

Question on making a "shop"


  • Please log in to reply
4 replies to this topic

#1 Carl Lawl

Carl Lawl

    GMC Member

  • New Member
  • 43 posts

Posted 23 December 2011 - 07:44 PM

I need to impliment some sort of shop for my RPG soon but I'm stumped on how I could do it efficiently.
I'd like to have multiple vendors or different items but try and do it all within one object!
What would be the best way to go about setting the items of each shop without using a million objects and without using a txt/ini file that is easier editted?
  • 0

#2 Noele

Noele

    GMC Mentor

  • GMC Member
  • 2347 posts
  • Version:GM8.1

Posted 23 December 2011 - 07:59 PM

You will need to use arrays or data structures or it becomes complex and messy. If you know little about arrays then learning about them would be a good place to start. A shop holds a stock, thus it is little different from an inventory. Players will also hold things they buy - so that is another inventory.

Handling these using arrays or data structures is the most efficient - unless you plan of holding in excess of 32,000 different items.
  • 0

#3 Carl Lawl

Carl Lawl

    GMC Member

  • New Member
  • 43 posts

Posted 23 December 2011 - 10:42 PM

Ok so what if I had a switch or something that contained what style of vendor it is (armour, weapons, potions etc) ive already got the items stored for each, but I wanted to use 1 object is there a way to set which one it will be for each object? Like room creation code or anything like that?
  • 0

#4 Ting_Thing

Ting_Thing

    GMC Member

  • GMC Member
  • 202 posts

Posted 24 December 2011 - 12:04 AM

but I wanted to use 1 object is there a way to set which one it will be for each object? Like room creation code or anything like that?

Are you asking how to use one object for different purposes? You want to know how one instance from an object can be used as the armor and another instance from the same object can be used as weapons, etc?
  • 0

#5 Carl Lawl

Carl Lawl

    GMC Member

  • New Member
  • 43 posts

Posted 24 December 2011 - 10:54 AM


but I wanted to use 1 object is there a way to set which one it will be for each object? Like room creation code or anything like that?

Are you asking how to use one object for different purposes? You want to know how one instance from an object can be used as the armor and another instance from the same object can be used as weapons, etc?


What? No, I'm asking about making shops and having different vendors under one object...

Lets say I make obj_thisisgoingtobeashoppeoplecanbuystufffrom

then I play a few of these in a room, is there anyway to set it to a specific vendor (ie weapons vendor, armour vendor, potions vendor) maybe using a variable that gets set in the room creation code? Ive never used room creation code so I don't know!
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users