Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #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
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:42 AM.


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