Graal Forums  

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 09-17-2010, 06:47 PM
Soala Soala is offline
Ideas on Fire
Soala's Avatar
Join Date: Jun 2007
Location: In my head
Posts: 3,208
Soala is a jewel in the roughSoala is a jewel in the rough
Level transition fade in/out

You probably went on Ruins lately, and saw the level transition effects (fade in/out). A lot of people are asking me how it was made, so I decided to simply share it. Might be useful for people later on!

Class (named level_link)
PHP Code:
function onCreated() {
  
this.setshape(1this.w*16this.h*16);
  
this.blockagain();
}

//#CLIENTSIDE
function onCreated() {
  
this.setshape(1this.w*16this.h*16);
  
this.blockagain();
}

function 
onPlayerTouchsMe() {
  if (
this.touched) return;
  
temp.data = {this.lvlthis.lvlxthis.lvly};
  
interfaceVisuals.fadelevel(temp.data);
  
this.touched true;
  
setTimer(3);
}

function 
onTimeout()
  
this.touched false
interfaceVisuals is our wNPC handling all the visuals, along with the fade in/out effects, here are the bits of it for the fade effect
PHP Code:
public function fadelevel(lvldata) {
  
client.freezed true;
  
fadeOut(lvldata);
}
  

function 
fadeIn() {
  for(
temp.1temp.>= -0.30temp.-= 0.30) {
    
findimg(this.poly).alpha temp.i;
    
sleep(0.05);
  }
  
hideimg(this.poly);
  
this.poly 0;
  
client.freezed false;
}

function 
fadeOut(lvldata) {
  
temp.data lvldata;
  
client.warpdata lvldata;
  if (
this.poly == 0this.poly drawScreenPoly(); 
  for(
temp.0temp.1.35temp.+= 0.35) {
    
findimg(this.poly).alpha temp.i;
    
sleep(0.05);
  }
  
setani("your idle gani name"0);
  
sleep(0.25);
  
triggerserver("gui""interfaceVisuals""warpplayer"0);
  
sleep(0.5);
  
fadeIn();


Here's an example of level npc you can use in order to use the link and level transition:
PHP Code:
this.join("level_link");
this.6;
this.1;
//#CLIENTSIDE
this.6;
this.1;
this.lvl "level name it links to.nw";
this.lvlx 24;
this.lvly 1
this.w is the link's width and this.h the link's height (in tiles of course)

Credits to Axel (account: Contrast, go +rep him if you want!) for making it, and to Tig who gave us some hints on how GK's was made. Enjoy

Last edited by Soala; 09-17-2010 at 07:15 PM..
Reply With Quote
 


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:18 PM.


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