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-09-2008, 06:45 AM
pokeSMOT pokeSMOT is offline
Registered User
Join Date: Jun 2006
Posts: 35
pokeSMOT is on a distinguished road
Adding Weapons to All Accounts?



function onCreated()
{
addweapon weapon1;
addweapon weapon2;
//etc...
}

Would something like this work for if I wanted to add a set number of "weapon" scripts to all accounts when they first log on? Or is there a better, more efficient way of doing this?
Reply With Quote
  #2  
Old 02-09-2008, 06:49 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
You're mixing a GS2 function definition with GS1 commands, please don't.

ActionPlayerOnline is called in the Control-NPC when a player logs in, you would do:
PHP Code:
function onActionPlayerOnline() {
  
addweapon("weapon1");
  
addweapon("weapon2");

This script would go in the Control-NPC.
__________________
Reply With Quote
  #3  
Old 02-09-2008, 06:58 AM
pokeSMOT pokeSMOT is offline
Registered User
Join Date: Jun 2006
Posts: 35
pokeSMOT is on a distinguished road
Okay, sounds good.. I'm going to try that.

EDIT: LOL! Uhh, that froze my whole Graal client, and when I looked on RC, the npcs have not been added.
Perhaps I did something wrong? I swear I have that script word-for-word
Reply With Quote
  #4  
Old 02-09-2008, 07:06 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
Weapon names would be case sensitive, also make sure the script is serverside in the Control-NPC.

It should not freeze your client unless something clientside in one of your weapon scripts is doing it.
__________________
Reply With Quote
  #5  
Old 02-09-2008, 07:11 AM
pokeSMOT pokeSMOT is offline
Registered User
Join Date: Jun 2006
Posts: 35
pokeSMOT is on a distinguished road
"Serverside in the control npc" = Huh?

I just grabbed a blank "W" npc form and input what you said to. but what do you mean by having it serverside in the control npc?
Reply With Quote
  #6  
Old 02-09-2008, 07:19 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
-______________________________________-

Open the Database NPC's list and edit the script of the Control-NPC.
The button for the Database NPC's is left of the weapons button in RC.
__________________
Reply With Quote
  #7  
Old 02-09-2008, 07:21 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
I always add something like this to Control-NPC

PHP Code:
function onActionPlayerOnline()
{
  
temp.weapons = {"something""somethingelse""pies""are""nice"};
  
temp.classes = {"pie-eating""pie-making","pie-throwing"};
  for (
temp.weapons)
    
player.addweapon(t);
  for (
temp.classes)
    
player.join(t);

You could use this. vars created in the onCreated/Initialised but people could then change the var to add an abusive weapon

Last edited by Twinny; 02-09-2008 at 07:32 AM..
Reply With Quote
  #8  
Old 02-09-2008, 07:26 AM
pokeSMOT pokeSMOT is offline
Registered User
Join Date: Jun 2006
Posts: 35
pokeSMOT is on a distinguished road
Quote:
Originally Posted by Inverness View Post
-______________________________________-

Open the Database NPC's list and edit the script of the Control-NPC.
The button for the Database NPC's is left of the weapons button in RC.

Works like a dream ^_^ Thankya
Reply With Quote
  #9  
Old 02-09-2008, 05:11 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
If it helps, I made an "advanced" NPC-Control script in the code gallery which uses files (like the login message) to control classes, weapons, etc.

Here's a link if you want it.

http://forums.graalonline.com/forums...ad.php?t=77750

Might help your server get down some of the basics.
__________________
Reply With Quote
  #10  
Old 02-09-2008, 05:40 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Quote:
Originally Posted by Inverness View Post
-______________________________________-
My my, Julia Roberts, your smile is bigger than usual today.
Reply With Quote
  #11  
Old 02-09-2008, 10:56 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
Quote:
Originally Posted by DustyPorViva View Post
My my, Julia Roberts, your smile is bigger than usual today.
For some reason I doubt he was smiling.
__________________
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 05:04 PM.


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