Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Catching cross server guilds on login? (https://forums.graalonline.com/forums/showthread.php?t=134269488)

scriptless 08-18-2014 05:37 AM

Catching cross server guilds on login?
 
This might be confusing but..

Is it possible, for example for me to set my nickname to my global guild when I login. And catch that on a server that has global guilds disabled? I wan't to try and get the guild before it takes it away. The reason is this could be nice if servers with scripted guilds could automatically reconnect after a player reconnects or gets disconnected.

I was thinking maybe theres a GUI control that can catch the event already? Can't remember.

shrimps 08-18-2014 06:42 AM

Ahh, for example if I'm on Zodiac with *shrimps (Steele) and I log into Kingdoms, I get to keep the *shrimps (Steele) with the Clan system on Kingdoms? Instead of having to put my tag back on?

scriptless 08-18-2014 03:11 PM

Quote:

Originally Posted by shrimps (Post 1730156)
Ahh, for example if I'm on Zodiac with *shrimps (Steele) and I log into Kingdoms, I get to keep the *shrimps (Steele) with the Clan system on Kingdoms? Instead of having to put my tag back on?

Or kingdom tag for example. Would be pretty cool. I only ask because I notice sometimes it takes a second before it removes my tag. So if theres a way to catch it that would be cool. Not sure if Nico would use it but other servers might.

Edit:

Apparently using onActionPlayerOnline() in the Control-NPC will works. But it could be confusing. I will explain.

PHP Code:

function onActionPlayerOnline(){
  echo(
"result:" SPC player.guild);


This is the code I used to test. I logged on my server and set my nick to Scriptless (Canavi) via script knowing it would remove my tag when I reconnected. When I reconnected the rc echo'd that nick and guild. So success. However, when I logged on GK and put my kingdom tag on then logged back onto my server it read my nickname as the last nickname used on my server. So anyone got any ideas on if it's possible to check what your last guild tag was while logging on a server before it gets removed?

Also, while I can read the variable to a client flag, I still cannot get it to automatically set the tag. :( Any ideas on that would be great.

Restraint 08-21-2014 02:45 AM

Did you try something like...

PHP Code:

function onPlayerLogout(pl) {
  
pl.clientr.lastGuild pl.guild;


combined with:

PHP Code:

function onPlayerLogin(pl) {
  
pl.guild pl.clientr.lastGuild;


If that doesn't work, try a simple delay on the onPlayerLogin, such as:

PHP Code:

function onPlayerLogin(pl) {
  
scheduleEvent("fixGuild"1pl);
}
function 
onFixGuild(pl) {
  
pl.guild pl.clientr.lastGuild;



scriptless 08-22-2014 03:50 AM

Quote:

Originally Posted by Restraint (Post 1730281)
Did you try something like...

PHP Code:

function onPlayerLogout(pl) {
  
pl.clientr.lastGuild pl.guild;


combined with:

PHP Code:

function onPlayerLogin(pl) {
  
pl.guild pl.clientr.lastGuild;


If that doesn't work, try a simple delay on the onPlayerLogin, such as:

PHP Code:

function onPlayerLogin(pl) {
  
scheduleEvent("fixGuild"1pl);
}
function 
onFixGuild(pl) {
  
pl.guild pl.clientr.lastGuild;



That would force a guild tag change when player logs on even if they want to use another tag. Which is a bad idea. This kinda worked. (Sorry didn't copy from my server tried typing it from memory)

Control-NPC
PHP Code:

function onActionPlayerOnline(){
  
player.clientr.lastguild player.guild;


WNPC
PHP Code:

function onPlayerNickChanges(obj){
  
obj.guild obj.clientr.lastguild;



Restraint 08-22-2014 05:03 PM

Ah okay. Didn't understand what you were trying to do.

So you want to always preserve the player's guild through nickname changes unless they set a new guild?

Then your function looks correct, minus giving players the ability to specify a new guild tag. What's wrong with it?


All times are GMT +2. The time now is 01:23 PM.

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