Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Adding Weapons to All Accounts? (https://forums.graalonline.com/forums/showthread.php?t=78643)

pokeSMOT 02-09-2008 06:45 AM

Adding Weapons to All Accounts?
 
:confused:

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?

Inverness 02-09-2008 06:49 AM

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.

pokeSMOT 02-09-2008 06:58 AM

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

Inverness 02-09-2008 07:06 AM

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.

pokeSMOT 02-09-2008 07:11 AM

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

Inverness 02-09-2008 07:19 AM

-______________________________________-

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.

Twinny 02-09-2008 07:21 AM

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 :frown:

pokeSMOT 02-09-2008 07:26 AM

Quote:

Originally Posted by Inverness (Post 1374282)
-______________________________________-

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

cbk1994 02-09-2008 05:11 PM

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.

DustyPorViva 02-09-2008 05:40 PM

Quote:

Originally Posted by Inverness (Post 1374282)
-______________________________________-

My my, Julia Roberts, your smile is bigger than usual today.

cbk1994 02-09-2008 10:56 PM

Quote:

Originally Posted by DustyPorViva (Post 1374318)
My my, Julia Roberts, your smile is bigger than usual today.

For some reason I doubt he was smiling.


All times are GMT +2. The time now is 04:22 AM.

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