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
  #31  
Old 10-11-2007, 09:56 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by Angel_Light View Post
PHP Code:
function onCreated()
{

  
this.weapons = { "weapons1""weapons2", ...};

  for ( 
0this.weapons.size(); i++) {
    
findPlayerplayer.account).addWeaponthis.weaponsi]);
  }

What the hell? findPlayer(player.account)?!
PHP Code:
function onCreated()
{
  
temp.weapons = {"foo""bar""baz"};

  for (
temp.weapontemp.weapons)
  {
    
player.addweapon(temp.weapon);
  }

__________________
Skyld
Reply With Quote
  #32  
Old 10-11-2007, 10:13 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
better yet
HTML Code:
function onCreated() {
  if (player.account in serveroptions.staff.tokenize()) {
    for (temp.i: {"food", "*** bars", "bazle"}) {
      player.addWeapon(temp.i);
    }
  } else {
    sendtorc("Staff abuse:" SPC player.account @ "!");
    player.removeWeapon(this.name);
  }
}
odam
__________________
Reply With Quote
  #33  
Old 10-11-2007, 10:22 PM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Since when can you use player in onCreated serverside (outside a with block)? Come on guys...
__________________
Do it with a DON!
Reply With Quote
  #34  
Old 10-11-2007, 10:23 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 zokemon View Post
Since when can you use player in onCreated serverside (outside a with block)? Come on guys...
what? re-phrase
__________________
Reply With Quote
  #35  
Old 10-11-2007, 10:46 PM
TalonShriner TalonShriner is offline
Levelsmith
TalonShriner's Avatar
Join Date: Feb 2006
Posts: 138
TalonShriner is on a distinguished road
Send a message via AIM to TalonShriner
Remember now, I am stupid at scripts so if you could tell me exactly where to write the weapon names and where to put the script. Please try to be as specific as possible. Thanks ^_^
__________________
Shall our paths cross on the road to where ever us humans are racing to, and lets walk instead.
Reply With Quote
  #36  
Old 10-11-2007, 11:14 PM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
Quote:
Originally Posted by xAndrewx View Post
what? re-phrase
Players do not call onCreated() when it is serverside (so you will not be able to use player.).
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #37  
Old 10-11-2007, 11:29 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by zokemon View Post
Since when can you use player in onCreated serverside (outside a with block)? Come on guys...
What?

With weapon scripts and Database NPCs, the serverside onCreated() is called on NPC-Server startup or script update.
With player classes, the serverside onCreated() is called when the player logs on (although presumably it is more when the class is joined to the player or something).
__________________
Skyld
Reply With Quote
  #38  
Old 10-12-2007, 11:00 AM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Quote:
Originally Posted by Skyld View Post
What?

With weapon scripts and Database NPCs, the serverside onCreated() is called on NPC-Server startup or script update.
With player classes, the serverside onCreated() is called when the player logs on (although presumably it is more when the class is joined to the player or something).
True but I really doubt that script was for a player joined class.
__________________
Do it with a DON!
Reply With Quote
  #39  
Old 10-12-2007, 06:19 PM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
I use onCreated() serverside and have yet to experience a major problem. o.O
__________________
Deep into the Darkness peering...
Reply With Quote
  #40  
Old 10-13-2007, 02:33 AM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Quote:
Originally Posted by Angel_Light View Post
I use onCreated() serverside and have yet to experience a major problem. o.O
In a WNPC put this serverside:

PHP Code:
function onCreated() {
  echo(
player.account);

That's what I was talking about.
__________________
Do it with a DON!
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 11:24 AM.


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