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 08-17-2006, 05:27 AM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Gravity

Bah, I can't figure out what's wrong here. It started out as a clean looking script, but I had to add quite a few extra checks. Anyway, this is what I have now. Sometimes I am able to jump fine, other times it's a short jump. And sometimes when I land, I bounce, or go below the ground. I thought I had it all checked out. I don't want a free script, just tell me what I'm missing with this one
PHP Code:
// NPC made by Excalibur
//GS2 Grav
//#CLIENTSIDE
function onCreated()
{
  
client.no_wep=1;
  
player.dir=3;
  
this.direction=player.dir;
  
this.speed=.05;
  
settimer(.05);
}
function 
onTimeout()
{
  
//set the jump
  
if(keydown(0) && this.jump==&& onwall(player.x+1player.y+3.5))
  {
    
this.speed=.05;
    
this.jump=1;
    
this.count=50;
  }
  
//force fall
  
if(keydown(2))
  {
    if(!
onwall(player.x+1player.y+3.5))
    {
      
this.speed+=.5;
    }
  }
  
//move
  
if(player.dir==|| player.dir==2)
  {
    
player.dir=this.direction;
  }
  
this.direction=player.dir;
  if(
this.jump==1)
  {
    if(!
onwall(playerx+1,playery-.5) && this.count>0)
    {
       
player.y-=.5;
    }
    else
    {
      
this.count=0;
    }
    
this.count--;
    if(
this.count<=0)
    {
      
this.jump=0;
    }
  }
  if(!
onwall(player.x+1player.y+3.5))
  {
    
player.y+=this.speed;
    if(
this.speed<5)
    {
      
this.speed+=.05;
    }
  }
  else if(
onwall(player.x+1player.y+3.5))
  {
    
this.speed=.05;
  }
  
settimer(.05);

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 07:50 AM.


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