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 05-12-2012, 01:01 AM
Fysez Fysez is offline
Banned
Join Date: Apr 2012
Posts: 89
Fysez has a little shameless behaviour in the past
Removing weapons on login?

How can I remove player weapons on login?
This is what I have, and it doesn't work:

PHP Code:
 function onActionServerSide() {
    
findPlayer.removeWeapon("bow");

Reply With Quote
  #2  
Old 05-12-2012, 01:06 AM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
Quote:
Originally Posted by Fysez View Post
How can I remove player weapons on login?
This is what I have, and it doesn't work:

PHP Code:
 function onActionServerSide() {
    
findPlayer.removeWeapon("bow");

The login function is:

PHP Code:
function onActionPlayerOnline(){


within the Control-NPC.

'findplayer("account")' is a function which takes the specified account string parameter and returns the player object if it exists, it is not necessary within onActionPlayerOnline however as there is already the 'player' object to use.

I would also imagine the parameter for removeweapon is case sensitive, which probably means you should have 'removeweapon("Bow");'.
Reply With Quote
  #3  
Old 05-12-2012, 01:19 AM
Fysez Fysez is offline
Banned
Join Date: Apr 2012
Posts: 89
Fysez has a little shameless behaviour in the past
Quote:
Originally Posted by ffcmike View Post
The login function is:

PHP Code:
function onActionPlayerOnline(){


within the Control-NPC.

'findplayer("account")' is a function which takes the specified account string parameter and returns the player object if it exists, it is not necessary within onActionPlayerOnline however as there is already the 'player' object to use.

I would also imagine the parameter for removeweapon is case sensitive, which probably means you should have 'removeweapon("Bow");'.
PHP Code:
 function onActionPlayerOnline(){ 
removeweapon("Bow");

This does not work.
I've tried it in (even though they don't need to be) Class, NPC-Database, Level NPC, and Weapon (though weapon won't help) and it does not work.
Reply With Quote
  #4  
Old 05-12-2012, 01:27 AM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
It specifically has to be the Control-NPC, which is listed among database NPCs.

Try:

PHP Code:
function onActionPlayerOnline(){ 
  
player.removeweapon("Bow");
  echo(
player.account SPC "logged in");

in order to determine whether the function is even occurring.
Reply With Quote
  #5  
Old 05-12-2012, 01:32 AM
Fysez Fysez is offline
Banned
Join Date: Apr 2012
Posts: 89
Fysez has a little shameless behaviour in the past
Quote:
Originally Posted by ffcmike View Post
It specifically has to be the Control-NPC, which is listed among database NPCs.

Try:

PHP Code:
function onActionPlayerOnline(){ 
  
player.removeweapon("Bow");
  echo(
player.account SPC "logged in");

in order to determine whether the function is even occurring.
Did not work either.
Reply With Quote
  #6  
Old 05-12-2012, 01:35 AM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
Quote:
Originally Posted by Fysez View Post
Did not work either.
Then I imagine you're putting it in the wrong place or else if the function was at least occurring a message would be shown within RC. The Control-NPC is listed at the bottom of the database NPCs list.
Reply With Quote
  #7  
Old 05-12-2012, 01:39 AM
Fysez Fysez is offline
Banned
Join Date: Apr 2012
Posts: 89
Fysez has a little shameless behaviour in the past
Question

Quote:
Originally Posted by ffcmike View Post
Then I imagine you're putting it in the wrong place or else if the function was at least occurring a message would be shown within RC. The Control-NPC is listed at the bottom of the database NPCs list.
It goes:
Classes
Database-NPC
Weapons

I put it in "Classes" and "Database-NPC".
Also, I see nothing named specifically "Control-NPC"
Reply With Quote
  #8  
Old 05-12-2012, 01:40 AM
Fysez Fysez is offline
Banned
Join Date: Apr 2012
Posts: 89
Fysez has a little shameless behaviour in the past
Quote:
Originally Posted by Fysez View Post
It goes:
Classes
Database-NPC
Weapons

I put it in "Classes" and "Database-NPC".
Also, I see nothing named specifically "Control-NPC"
Nevermind... I completely looked over it.
Reply With Quote
  #9  
Old 05-12-2012, 01:42 AM
Fysez Fysez is offline
Banned
Join Date: Apr 2012
Posts: 89
Fysez has a little shameless behaviour in the past
Still does not work.
Even in the correct area.
I see it works for other items, I found. But not the bow...?

Last edited by Fysez; 05-12-2012 at 01:45 AM.. Reason: Forgot a peice
Reply With Quote
  #10  
Old 05-12-2012, 03:34 AM
BlueMelon BlueMelon is offline
asdfg
BlueMelon's Avatar
Join Date: Sep 2008
Posts: 1,481
BlueMelon is a splendid one to beholdBlueMelon is a splendid one to beholdBlueMelon is a splendid one to beholdBlueMelon is a splendid one to behold
public function onPlayerLogin(pl)
{
pl.removeweapon("weaponname");
}
__________________
http://i.imgur.com/OOJbW.jpg
Reply With Quote
  #11  
Old 05-12-2012, 10:25 AM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Might be a little easier to put them all in an array instead of using multiple removeweapon() functions. It doesn't really make a difference, but it looks nicer.

PHP Code:
function onCreated() {
  
this.weapons_rem = {
    
"-System",
    
"-Other",
    
"Weapons/Here"
  
};
}

function 
onActionPlayerOnline() {
  for (
weapons this.weapons_rem) {
    
player.removeweapon(weapons);
  }

Reply With Quote
  #12  
Old 05-12-2012, 11:11 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by Emera View Post
Might be a little easier to put them all in an array instead of using multiple removeweapon() functions. It doesn't really make a difference, but it looks nicer.

PHP Code:
function onCreated() {
  
this.weapons_rem = {
    
"-System",
    
"-Other",
    
"Weapons/Here"
  
};
}

function 
onActionPlayerOnline() {
  for (
weapons this.weapons_rem) {
    
player.removeweapon(weapons);
  }

I don't see the need to permanently store the weapons array, and you should *REALLY* give your weapons string a temp header.
__________________
Follow my work on social media post-Graal:Updated august 2025.
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 02:00 PM.


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