Thread: Levitation
View Single Post
  #1  
Old 03-07-2009, 07:35 PM
Novice Novice is offline
Developer
Join Date: Dec 2008
Posts: 90
Novice is an unknown quantity at this point
Send a message via MSN to Novice
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");"

Last edited by Novice; 03-07-2009 at 08:20 PM..
Reply With Quote