Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-23-2010, 05:30 PM
Jman9912 Jman9912 is offline
Registered User
Join Date: Jun 2001
Location: North Carolina
Posts: 114
Jman9912 is on a distinguished road
Send a message via AIM to Jman9912
Item system

Alright guys. I need to start the daunting task of coding an item system. I've gone over the couple of examples in the forum already. Pretty complex. Right now, I am focusing on storing an item and it's quantity.

Any tips, input, etc would be greatly appreciated it.
Reply With Quote
  #2  
Old 02-23-2010, 05:40 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
If it's just a simple weapon-script based item system.

PHP Code:
function addItem(itemnamequantity) {
  
player.addweapon(itemname);
  
clientr.item.(@itemname) += quantity;

Otherwise you're going the MUDLib route, and Ziro has one posted in the code gallery.
__________________
Quote:
Reply With Quote
  #3  
Old 02-23-2010, 05:53 PM
Jman9912 Jman9912 is offline
Registered User
Join Date: Jun 2001
Location: North Carolina
Posts: 114
Jman9912 is on a distinguished road
Send a message via AIM to Jman9912
It's gonna be sort of a MUDlib
Reply With Quote
  #4  
Old 02-23-2010, 06:26 PM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
Until you're a fairly experienced scripter you'd probably do best to use the one Ziro posted. Actually, it's always best to use something already made unless you, for whatever reason, have some reason that it is necessary to have a new system. (Different design specifications, etc)
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #5  
Old 02-23-2010, 06:31 PM
Jman9912 Jman9912 is offline
Registered User
Join Date: Jun 2001
Location: North Carolina
Posts: 114
Jman9912 is on a distinguished road
Send a message via AIM to Jman9912
That's true. But I can read and work with my own code easier than someone elses. I'll check Ziro's out again, but i'm not sure that I want all that it has.
Reply With Quote
  #6  
Old 02-23-2010, 06:39 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
I think there needs to be a more scripter-friendly item system released (A plain one, with the fundamental and 'base' functions included), so others can easily add their own stuff to it.
__________________
Reply With Quote
  #7  
Old 02-23-2010, 07:05 PM
Immolate Immolate is offline
Indigo
Join Date: Dec 2009
Posts: 322
Immolate is on a distinguished road
Quote:
Originally Posted by Chompy View Post
I think there needs to be a more scripter-friendly item system released (A plain one, with the fundamental and 'base' functions included), so others can easily add their own stuff to it.
I had one made on my own server that was fairly simple but at the same time allowed a lot of flexibility. Shame I lost the backups I'll start rescripting with public release intended.
Reply With Quote
  #8  
Old 02-23-2010, 07:07 PM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Quote:
Originally Posted by Jman9912 View Post
That's true. But I can read and work with my own code easier than someone elses. I'll check Ziro's out again, but i'm not sure that I want all that it has.
I think you should go off of coreys' advice, however, instead of directly using Ziro's item system, simply model yours after his and then when you get stuck, take a peak at how he did it.
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #9  
Old 02-23-2010, 07:14 PM
Jman9912 Jman9912 is offline
Registered User
Join Date: Jun 2001
Location: North Carolina
Posts: 114
Jman9912 is on a distinguished road
Send a message via AIM to Jman9912
Quote:
Originally Posted by Tigairius View Post
I think you should go off of coreys' advice, however, instead of directly using Ziro's item system, simply model yours after his and then when you get stuck, take a peak at how he did it.
Thats not a bad idea at all. I think that's what i'll do.
Reply With Quote
  #10  
Old 02-23-2010, 10:04 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Speaking of which, I should really clean up and release the newest version of it, the one on the forums is extremely outdated and inefficient comparing to it.
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #11  
Old 02-23-2010, 11:00 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Assuming you go with a MUDLIB a few things to keep in mind:
  • Is it going to be a full MUDLIB? In other words, are you going to have it possible to dynamically create new instances of unique items, or are items static and created once, then players have a quantity of that item?
  • How are you going to store the item data? If you go with a full MUDLIB, your best bet is probably text files, but there are also other options like SQL which may work for you. If you go with a non-MUDLIB and just use text files (or other storage) for items, you will need a way to store the amount of items players have (SQL, client flags both work well)
  • Are you going to cache the item database in memory? This improves performance, but is only really possible when not using a full MUDLIB.
  • If you go with a full MUDLIB, how will you handle stacking? For example, if you create 5 platinum coins, these should technically be 5 unique objects, so they can't stack in your inventory.
  • How will you deal with getting item data clientside? Will you send it all on login or send it as needed and store it clientside then?
__________________
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 09:23 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.