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 07-05-2013, 04:05 PM
i8bit i8bit is offline
Registered User
Join Date: Jul 2013
Posts: 146
i8bit is an unknown quantity at this point
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.
Reply With Quote
  #2  
Old 07-05-2013, 04:10 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
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);
  }

__________________
Quote:
Reply With Quote
  #3  
Old 07-05-2013, 05:09 PM
i8bit i8bit is offline
Registered User
Join Date: Jul 2013
Posts: 146
i8bit is an unknown quantity at this point
Quote:
Originally Posted by fowlplay4 View Post
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?
Reply With Quote
  #4  
Old 07-05-2013, 06:04 PM
Tim_Rocks Tim_Rocks is offline
a true gentlemen
Tim_Rocks's Avatar
Join Date: Aug 2008
Location: USA
Posts: 1,863
Tim_Rocks is a splendid one to beholdTim_Rocks is a splendid one to beholdTim_Rocks is a splendid one to beholdTim_Rocks is a splendid one to beholdTim_Rocks is a splendid one to behold
Quote:
Originally Posted by i8bit View Post
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.
__________________
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 06:44 PM.


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