View Single Post
  #4  
Old 06-13-2007, 08:05 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Quote:
Originally Posted by PrinceOfKenshin View Post
I don't know if i should put it in all three (npc,class,weapons) or just weapons and npc. Can someone explain this to me?
Those are not really the same:
NPCs and Weapons are objects. Objects can have attributes (script variables) and can have a script.

Classes (in Graal) are a collection of script functions which you can attach to an object by letting the object join the class. So you expand the script of the object.

Items are mainly a collection of script variables to know what items the player has and how they look like. They are most of the time stored in script variables of the player (clientr.)

To make an item system you also need to define the item templates - a list of items which can be created. These are most of the time defined in the script variables of a db npc. When you add an item to a player you then copy the item template or only copy important data, e.g. copy the icon of the weapon, but don't copy the strength since you only need it on serverside.

More advanced item systems store items separately from the player, e.g. in files. When loading those item files then you can create an own object for each item (new TStaticVar) and load the item variables into the script variables of that object. You can then also let the item object join classes, e.g. you create classes for weapons and food items and add in both classes a function apply() which then either changes the look of the player when applying the weapon, or adds food points when applying the food.

For clientside things you still need weapons. Most of the time each item template has an own weapon (sword, axe, dagger etc.). On the old classic servers each item was actually a weapon, in modern servers the weapons are managed by a System script which activates the right weapon script depending on which item you have equipped. That way you can reuse the "Sword" weapon for different sword items.

Last edited by Admins; 06-13-2007 at 11:02 PM..
Reply With Quote