Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   Levitation (https://forums.graalonline.com/forums/showthread.php?t=84563)

Novice 03-07-2009 07:35 PM

Levitation
 
This is a simple levitation script. Just a fun little toy.
PHP Code:

//Scripted by Novice

//#CLIENTSIDE
function onCreated() {
  
this.rep = {"walk","grab","pull","push","sit"};
  
this.air 0;
  
player.0;
}

function 
onWeaponFired() {
  if (
this.air == 0) {
    
this.air 1;
    for (
i=0i<this.rep.size(); i++)
      
replaceAni(this.rep[i],"idle");
    
setAni("idle",null);
  }
  else if (
this.air in {1,2})
    
this.air 0;
  
setTimer(0.05);
}

function 
onTimeOut() {
  if (
this.air != 0) {
    if (
player.== 2)
      
this.air 2;
    if (
player.== 1)
      
this.air 1;
    if (
this.air == 1)
      
player.+= 0.05;
    else if (
this.air == 2)
      
player.-= 0.05;
    
setTimer(0.05);
  } else {
    if (
player.0) {
      
player.-= 0.05;
      
setTimer(0.05);
    } else {
      for (
i=0i<this.rep.size(); i++)
        
replaceAni(this.rep[i],this.rep[i]);
    }
  }
}

function 
onPlayerDies() {
  if (
this.air != 0) {
    
this.air 0;
    
player.0;
    
setTimer(0);
    for (
i=0i<this.rep.size(); i++)
      
replaceAni(this.rep[i],this.rep[i]);
  }


You can also add/remove Ganis you want to change by adding to "this.rep", and change the Gani you want it to play instead of those in "this.rep" by changing "idle" to the one you want to play in "setAni("idle",null);" and "replaceAni(this.rep[i],"idle");"


All times are GMT +2. The time now is 06:18 PM.

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