PDA

View Full Version : Adding Weapons to All Accounts?


pokeSMOT
02-09-2008, 06:45 AM
: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:

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


function onActionPlayerOnline()
{
temp.weapons = {"something", "somethingelse", "pies", "are", "nice"};
temp.classes = {"pie-eating", "pie-making","pie-throwing"};
for (t : temp.weapons)
player.addweapon(t);
for (t : 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
-______________________________________-

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/showthread.php?t=77750

Might help your server get down some of the basics.

DustyPorViva
02-09-2008, 05:40 PM
-______________________________________-
My my, Julia Roberts, your smile is bigger than usual today.

cbk1994
02-09-2008, 10:56 PM
My my, Julia Roberts, your smile is bigger than usual today.

For some reason I doubt he was smiling.