Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Control-NPC troubles (https://forums.graalonline.com/forums/showthread.php?t=134268417)

i8bit 07-05-2013 04:05 PM

Control-NPC troubles
 
Hello, I am trying to add some weapons, stats, and such to the player when they log in using the Npcscript: Control-NPC.

I was wondering what I need to insert to execute the actions I want it to preform?

PHP Code:

function onActionServerside()
{
 
//Do I need Something Here?
 
{
  
//Set stats and add the weapons
  
}
 } 

How it is with just the onActionServerside() doesn't work. I also tried triggering it through CLIENTSIDE but I don't think that worked.

fowlplay4 07-05-2013 04:10 PM

Wrong function:

PHP Code:

function onActionPlayerOnline() {
  
setupPlayer();
  
addWeapons();
}

function 
setupPlayer() {
  if (!
clientr.stat.level) {
    
clientr.stat.level 1;
    
// and so on..
  
}
}

function 
addweapons() {
  
temp.weps = {
    
"-System""andSoOn"
  
};
  for (
temp.weptemp.weps) {
    
player.addweapon(temp.wep);
  }



i8bit 07-05-2013 05:09 PM

Quote:

Originally Posted by fowlplay4 (Post 1720228)
Wrong function:

PHP Code:

function onActionPlayerOnline() {
  
setupPlayer();
  
addWeapons();
}

function 
setupPlayer() {
  if (!
clientr.stat.level) {
    
clientr.stat.level 1;
    
// and so on..
  
}
}

function 
addweapons() {
  
temp.weps = {
    
"-System""andSoOn"
  
};
  for (
temp.weptemp.weps) {
    
player.addweapon(temp.wep);
  }




Why couldn't I just do:

PHP Code:

function onActionPlayerOnline() {
if (
clientr.level <= 0)
{
 
clientr.level 1;
 
addweapon("-Control");
 }


wouldn't that do the same thing?

Tim_Rocks 07-05-2013 06:04 PM

Quote:

Originally Posted by i8bit (Post 1720232)
Why couldn't I just do:

PHP Code:

function onActionPlayerOnline() {
if (
clientr.level <= 0)
{
 
clientr.level 1;
 
addweapon("-Control");
 }


wouldn't that do the same thing?

That would work, the way fp4 did it is a little more organized; your way would get sloppy over time.


All times are GMT +2. The time now is 05:56 AM.

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