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 06-13-2007, 06:01 PM
PrinceOfKenshin PrinceOfKenshin is offline
That guy with a beard
PrinceOfKenshin's Avatar
Join Date: May 2004
Location: Ontario, Canada
Posts: 819
PrinceOfKenshin has a spectacular aura aboutPrinceOfKenshin has a spectacular aura about
NPCS, Classes Weapons.

Well i know this sounds stupid. But i never understood what goes where.

I know in Classes instead of having the script in a level you make a class and just call the class from the level.

And for weapons i know you add weapons to a player.

and NPCs are databases.


I also know that in NPCs you can store items. Such as a gun. (on atrius)
PHP Code:
AK47=AK47,gun,at_ak47-icon1.gif,automatic,clipinfo,1,AK47 
and in the classes you have all the information for the gun.

PHP Code:
this.gun.AK47 = {"AK47""at_ak47-""at-newbullet""Rifle Ammo"falsefalse0.30.11.5, -.10100.40.4, {{0,0},{-1.8,-.6},{0,0},{1.8,-.6}}, {{{.5,0},{-.5,0}}, {{-.7,-1.35},{-.5,-1}}, {{-.5,0},{.5,0}}, {{.7,-1.35}, {.7,-.7}}}}; 
And in the weapons you have the main script for the gun that makes it fire, reload and all that good stuff.

But i don't understand How i can add other things like a medkit (just an example.)

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?
__________________


Quote:
Game Master (Server): Greetings PrinceOfKenshin, there are new posts on the forums that demand your urgent attention! God speed, the fate of the world is in your hands. If you fail, middle earth will forever be in the darkness and your children will be enslaved by McKain.
Reply With Quote
  #2  
Old 06-13-2007, 06:20 PM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
Well, first of all the way the item systems are set up on Atrius is rather....stupid. Having first hand experience. You don't want to follow how anything is set up there.

But you'd be better off with the use of objects. And not holding information for each weapon in it's own respective class.

I'll be back with a better explanation in a few moments. I'm a bit busy atm.
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
  #3  
Old 06-13-2007, 06:33 PM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
Ok.

Now, what I was trying to touch up on earlier. Is it's better to use objects to store your information because objects are so flexible and pliable.

You can add objects to arrays, then the objects you have in arrays, can have objects as vars inside that object in an array. So in essence you can store many, many pieces of information starting with one object.

If you will, go download Inverness' two Object-Based Mudlibs he released on the forums. They're both quite confusing at times but very good learning tools if you're interested in objects.

IT's all really a matter of transfering variables of objects to other objects and then to strings and then all back again.

It's quite fun. :] If you'd like some one on one assistance you're free to AIM me.
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
  #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
  #5  
Old 06-13-2007, 08:53 PM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
Quote:
Originally Posted by Stefan View Post
Explanation
I need say no more. xD
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
  #6  
Old 06-14-2007, 01:21 AM
PrinceOfKenshin PrinceOfKenshin is offline
That guy with a beard
PrinceOfKenshin's Avatar
Join Date: May 2004
Location: Ontario, Canada
Posts: 819
PrinceOfKenshin has a spectacular aura aboutPrinceOfKenshin has a spectacular aura about
Thanks a lot Stefan that was a really good explanation = )
__________________


Quote:
Game Master (Server): Greetings PrinceOfKenshin, there are new posts on the forums that demand your urgent attention! God speed, the fate of the world is in your hands. If you fail, middle earth will forever be in the darkness and your children will be enslaved by McKain.
Reply With Quote
  #7  
Old 06-14-2007, 07:39 AM
TheJames TheJames is offline
Atrius Manager
TheJames's Avatar
Join Date: Dec 2004
Posts: 581
TheJames can only hope to improve
Haha... Wowzers. I think me and Mike should tweak our Inventory system now! . Thanks Stefan
__________________
Contact me on Skype: "skype.sam.lorenz"

James,
Manager of Atrius
Reply With Quote
  #8  
Old 06-14-2007, 01:48 PM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
No, you should make it an object based mudlib.
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
  #9  
Old 06-14-2007, 02:34 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
Quote:
Originally Posted by killerogue View Post
No, you should make it an object based mudlib.
Depends
__________________
Reply With Quote
  #10  
Old 06-14-2007, 04:55 PM
TheJames TheJames is offline
Atrius Manager
TheJames's Avatar
Join Date: Dec 2004
Posts: 581
TheJames can only hope to improve
Mudlibs arnt all they are cracked up to be, our DB is perfectly fine now
__________________
Contact me on Skype: "skype.sam.lorenz"

James,
Manager of Atrius
Reply With Quote
  #11  
Old 06-14-2007, 05:52 PM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
Actually, yes they are. It isn't all it's cracked up to be to YOU. Because you probably couldn't get it to work Mr. Switcheroo.
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
  #12  
Old 06-14-2007, 08:14 PM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Quote:
Originally Posted by killerogue View Post
Actually, yes they are. It isn't all it's cracked up to be to YOU. Because you probably couldn't get it to work Mr. Switcheroo.
Mudlibs are nice but aren't always appropriate. Some people use systems that would be much more efficient without them.
__________________
Do it with a DON!
Reply With Quote
  #13  
Old 06-14-2007, 08:51 PM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
Mudlibs aren't even used properly on Graal, according to Skyld. But from my own experienced Mudlibs normally control EVERYTHING in a normal MMORPG game.
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
  #14  
Old 06-15-2007, 02:15 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Object-based is the way to go for efficiency. If only we had custom object types that could be alot better.

I have yet to find that perfect unifying system unfortunately.

Also, something I just noticed, when using getVarNames() it got the function too, nearly pulled out my hair in frustration.
Quote:
Originally Posted by zokemon View Post
Mudlibs are nice but aren't always appropriate. Some people use systems that would be much more efficient without them.
Examples?
__________________
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 03:42 PM.


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