Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-25-2006, 08:08 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
Resetting Player Attributes

Create a new database called
'Control_PlayerReset'
Inside that database, add in this script:

HTML Code:
public function doPlayerReset(playerAccount, resetNumber)
{ 
  if (temp.playerAccount in this.(@ "v" @ temp.resetNumber @ "-accounts"))
  {
    return false;
  }

  this.(@ "v" @ temp.resetVersion @ "-accounts").add(temp.playerAccount);
  sendtorc("/reset " @ temp.playerAccount);
  
  this.trigger("update", ""); 
}
Once you've added both of those two in, add in the Control-NPC [Or in a player-login sequence if there is one!] this script

HTML Code:
//Change the second value to the reset value for a quick reset
Control_PlayerReset.doPlayerReset(player.account, 1);
__________________

Last edited by Skyld; 09-25-2006 at 08:19 PM..
Reply With Quote
  #2  
Old 09-25-2006, 09:07 PM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
function onPlayerLogin() is called on DBs at log in :O
Reply With Quote
  #3  
Old 09-25-2006, 09:56 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
Quote:
Originally Posted by Yen View Post
function onPlayerLogin() is called on DBs at log in :O
Via a class etc
__________________
Reply With Quote
  #4  
Old 09-25-2006, 10:08 PM
KuJi KuJi is offline
Banned
Join Date: Apr 2004
Location: Staten Island, New York
Posts: 2,202
KuJi will become famous soon enough
Send a message via ICQ to KuJi Send a message via AIM to KuJi Send a message via MSN to KuJi Send a message via Yahoo to KuJi
Uhh.. I make it save into a textfile via savevars (with the version + account)

MAINLY due to npc restart.. /savenpcs doesn't always work and people end up getting double-reset0rized =o
Reply With Quote
  #5  
Old 09-26-2006, 01:57 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 Yen View Post
function onPlayerLogin() is called on DBs at log in :O
Isnt it only called in the Control-NPC?
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #6  
Old 09-26-2006, 02:26 AM
KuJi KuJi is offline
Banned
Join Date: Apr 2004
Location: Staten Island, New York
Posts: 2,202
KuJi will become famous soon enough
Send a message via ICQ to KuJi Send a message via AIM to KuJi Send a message via MSN to KuJi Send a message via Yahoo to KuJi
Quote:
Originally Posted by xXziroXx View Post
Isnt it only called in the Control-NPC?
PHP Code:
function onPlayerLogin(temp.plyr)
{

would work in any database npc.. and even in weapons/scripts. (clientsided aswell)
ex:

PHP Code:
function onPlayerLogin(temp.plyr)
{
  if (
temp.plyr != NULL)
  {
    
player.chat format("%s has logged on!"temp.plyr); // I think?
  
}

Reply With Quote
  #7  
Old 09-26-2006, 02:39 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
Well look at that! I learned something new!
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #8  
Old 09-26-2006, 08:30 AM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
Quote:
Originally Posted by KuJi View Post
Uhh.. I make it save into a textfile via savevars (with the version + account)

MAINLY due to npc restart.. /savenpcs doesn't always work and people end up getting double-reset0rized =o
''this.trigger("update", "");''
I've heard that this actually saves the database. Well, that's what I saw in an Era Database NPC
__________________
Reply With Quote
  #9  
Old 09-26-2006, 04:34 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by KuJi View Post
PHP Code:
function onPlayerLogin(temp.plyr)
{

would work in any database npc.. and even in weapons/scripts. (clientsided aswell)
ex:

PHP Code:
function onPlayerLogin(temp.plyr)
{
  if (
temp.plyr != NULL)
  {
    
player.chat format("%s has logged on!"temp.plyr); // I think?
  
}

PHP Code:
function onPlayerLogin(pl) {
  if(
pl.account != NULL) {
    
player.chat format("%s has logged on!"pl.account);
  }

is the proper way to do it
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #10  
Old 09-26-2006, 09:03 PM
KuJi KuJi is offline
Banned
Join Date: Apr 2004
Location: Staten Island, New York
Posts: 2,202
KuJi will become famous soon enough
Send a message via ICQ to KuJi Send a message via AIM to KuJi Send a message via MSN to KuJi Send a message via Yahoo to KuJi
Quote:
Originally Posted by ApothiX View Post
PHP Code:
function onPlayerLogin(pl) {
  if(
pl.account != NULL) {
    
player.chat format("%s has logged on!"pl.account);
  }

is the proper way to do it
o hmm..
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 07:21 PM.


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