Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-07-2013, 08:48 PM
khortez khortez is offline
PrototypeX
khortez's Avatar
Join Date: Dec 2008
Posts: 91
khortez will become famous soon enough
having a problem with onActionPlayerOnline event - help

i've been trying to do stuff such as add weapons etc as soon as players login. but for some reason serverside and clientside that event hasn't done it for me. can someone tell me what i'm doing wrong with it? thanks
Reply With Quote
  #2  
Old 07-07-2013, 08:54 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 behold
Hmm, I think this is what you're looking for:

PHP Code:
function onPlayerLogin(temp.pl) {
  echo(
temp.pl);

You should be seeing your account name on RC whenever you login. After you can confirm that, I'd go ahead and add temp.pl.addweapon("wep");. Is this what you were looking for?
__________________
Reply With Quote
  #3  
Old 07-07-2013, 08:57 PM
khortez khortez is offline
PrototypeX
khortez's Avatar
Join Date: Dec 2008
Posts: 91
khortez will become famous soon enough
Quote:
Originally Posted by Tim_Rocks View Post
Hmm, I think this is what you're looking for:

PHP Code:
function onPlayerLogin(temp.pl) {
  echo(
temp.pl);

You should be seeing your account name on RC whenever you login. After you can confirm that, I'd go ahead and add temp.pl.addweapon("wep");. Is this what you were looking for?
yeah thanks. lemme try it.
Reply With Quote
  #4  
Old 07-07-2013, 08:58 PM
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
Make sure you're using onActionPlayerOnline() in the Control-NPC. onPlayerLogin() can be used in different NPCs/weapons/etc however.
Reply With Quote
  #5  
Old 07-07-2013, 09:06 PM
khortez khortez is offline
PrototypeX
khortez's Avatar
Join Date: Dec 2008
Posts: 91
khortez will become famous soon enough
so onActionPlayerOnline is only used for the control-NPC?
Reply With Quote
  #6  
Old 07-07-2013, 09:16 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by khortez View Post
so onActionPlayerOnline is only used for the control-NPC?
Yes.
__________________
Reply With Quote
  #7  
Old 07-07-2013, 09:24 PM
khortez khortez is offline
PrototypeX
khortez's Avatar
Join Date: Dec 2008
Posts: 91
khortez will become famous soon enough
Quote:
Originally Posted by cbk1994 View Post
Yes.
i see; just stating this then, the wiki has it like this:


Explanation:

it is invoked when a player logs on. Can be put in weapon NPCs and DBNPcs.


Example

if used in a weapon/GUI-script:

*example*


http://gscript.graal.net/onActionPlayerOnline

also onPlayerLogin doesn't even exist there
Reply With Quote
  #8  
Old 07-07-2013, 11:38 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Pretty certain that wiki article is incorrect. I don't think the player object is passed as a parameter, either (player will be in scope; for onPlayerLogin it won't be in scope and will be passed).

In weapons and NPCs (including Control-NPC), you can use onPlayerLogin(pl). If I'm not mistaken, you can only use onActionPlayerOnline() in Control-NPC.

edit: yes, just tested, everything above is correct, the wiki article is wrong
__________________
Reply With Quote
  #9  
Old 07-07-2013, 11:40 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
You can't really trust that list regarding available stuff. You can get a list though by doing the following:

Use 'Run' and type in the following:

HTML Code:
Path:\To\Your\Graal\Client\Graal6.exe -listscriptfunctions
(your .exe file might have another name, you should fix that one then)

After that check your Graal folder. There should be a file called scriptfunctions_client.txt. That list includes all (I believe) currently available functions
__________________
MEEP!
Reply With Quote
  #10  
Old 07-07-2013, 11:44 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by callimuc View Post
That list includes all (I believe) currently available functions
Only client functions, and not necessarily all events. I don't think that list will include serverside events like onActionPlayerOnline.
__________________
Reply With Quote
  #11  
Old 07-07-2013, 11:46 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
Quote:
Originally Posted by cbk1994 View Post
Only client functions, and not necessarily all events. I don't think that list will include serverside events like onActionPlayerOnline.
My bad, but I believe it's enough for most of the purposes
__________________
MEEP!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 09:31 AM.


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