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 08-09-2010, 06:14 PM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
catch player leaving level

is there some type of if command or work around to catch if a player is going into a link, or leaving a lv? Need the opposite of onPlayerEnters basically.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #2  
Old 08-09-2010, 06:21 PM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
onPlayerLeaves(), serverside only
Reply With Quote
  #3  
Old 08-09-2010, 06:23 PM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Not seein what I'm doin wrong, but player.chat ="fadeout" and echo will not happen


PHP Code:
function onCreated() {
  
this.levelfade "armageddon-spar-main";
}
function 
onPlayerLeaves() {
  if (
player.level.starts(this.levelfade)) {
    
triggerClient("gui"name"leftScreen");
    echo(
"fade out");
  }
}
//#CLIENTSIDE
function onCreated() {
  
this.levelfade "armageddon-spar-main";
}
function 
onActionClientSide() {
  if (
params[0] == "leftScreen") {
    
player.chat "fade out";
  }
}
function 
onPlayerEnters() {
  if (
player.level.starts(this.levelfade)) {
    
player.chat "fade in";
  }

__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...



Last edited by sssssssssss; 08-09-2010 at 06:53 PM..
Reply With Quote
  #4  
Old 08-09-2010, 07:24 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
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
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
player is not an accessible object in that function.

PHP Code:
function onPlayerLeaves(temp.pl)
  echo(
temp.pl.account SPC "just left level" SPC this.level.name "!"); 
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #5  
Old 08-09-2010, 07:40 PM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
ah, duh! xD thanks.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #6  
Old 08-09-2010, 07:43 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
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
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Quote:
Originally Posted by sssssssssss View Post
ah, duh! xD thanks.
Actually, I'm wrong. The function isn't called for wNPCs, and from the looks of things, that's what you're trying to use.
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #7  
Old 08-09-2010, 07:46 PM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
From what I heard from Axel, onPlayerLeaves gets called after the player actually left. You'd need to make custom level links to do the fade effect.
__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
Reply With Quote
  #8  
Old 08-09-2010, 08:10 PM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
Wouldn't it be nice if we could do something like

PHP Code:
player.onLevelSwitch = function (e) {
  
e.stop();
  
  
blackness.tween('opacity'0.201);

  
schedule(0.2, function () {
    
player.level e.link.newLevel;
    
player.e.link.newX;
    
player.e.link.newY;
    
blackness.tween('opacity'0.210);
  });
}; 
Yes, that was a weird mesh of JavaScript and GS2.
Reply With Quote
  #9  
Old 08-09-2010, 08:18 PM
Liberated Liberated is offline
not doing alot
Liberated's Avatar
Join Date: Feb 2008
Posts: 1,366
Liberated has a spectacular aura about
Tig should know right? He made a similar system for GK didn't he?
__________________
Quote:
Originally Posted by Tigairius View Post
I promise when I get rich I'll send you an iPhone. I'll send everyone an iPhone.
Reply With Quote
  #10  
Old 08-09-2010, 08:21 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
Kingdoms has custom level links, e.g. levels won't fade out when using actual level links on Kingdoms.
__________________
Reply With Quote
  #11  
Old 08-09-2010, 09:21 PM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Quote:
Originally Posted by Liberated View Post
Tig should know right? He made a similar system for GK didn't he?
Quote:
Originally Posted by cbk1994 View Post
Kingdoms has custom level links, e.g. levels won't fade out when using actual level links on Kingdoms.
Yep, I actually refuse to use default linking in any of my projects because I find that it's insecure, glitchy, and difficult to manage.

I always use custom linking joined to a class. That way if I want to edit the linking process later, I can do so. Also, it prevents several glitches.

An example of a custom link on one of my most recent projects:
PHP Code:
function onCreated() {
  
this.setShape(16432);
  
this.warplevel "newlevel.nw";
  
this.warpcoordinates = {3020};
  
this.dir 2;
}
join("warpfield"); 
When the player touches the warp field facing this.dir's direction, it schedules an event to warp the player in 0.125 seconds and sends a trigger to a clientside weapon that triggers a fading of the screen for 0.1 seconds. Then, also in the clientside weapon, onPlayerEnters() un-fades the screen.
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #12  
Old 08-10-2010, 05:58 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
So if I use that function, I should script it all in a dbnpc or something?

Also, is there any threads on custom level links, didn't see them, although I'm tired and could have skipped right though it I suppose. Wouldnt know where to start to make custom level links, but would like to!
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


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:30 AM.


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