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
  #29  
Old 05-06-2013, 04:51 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Quote:
Originally Posted by xXziroXx View Post
Hey Dusty. I think I remember you saying in some thread a while back that you had scripted a cliff jumping function, but was unwilling to share it at the time? I could be mistaken, but in case you did make one, is it anything you'd be willing to share now or even implement into this?
Well it was released actually, in the movement script of the server dump I posted here: http://forums.graalonline.com/forums...hlight=excited

PHP Code:
function CheckJump(d,except) {
  
hideimg(1);
  
temp.clifftiles = {
     
0xD2,0x1140xD30xD4,0x268,0x269,0x3CE,0x3CF,
     
0xE2,0x1240xE30xE4,0x267,0x26A,0x232,0x233,
    
0x111,0x112,0x1AA,0x113,0x277,0x27A,0x242,0x243,
    
0x121,0x122,0x1BA,0x123,0x287,0x28A,0x1CF,0x107,
     
0xB90xBA0xAE0xAF,0x297,0x29A,0x1DF,0x117,
     
0xC90xCA0x980x99,0x359,0x35C,0x22E,0x22F,
     
0xD90xDA,0x12E,0x12F,0x3CE,0x3CF,0x1600xCF,
     
0xE90xEA0xBE0xBF,0x1AC,0x1AC,0x1700xDF,
     
0xF90xFA,0x7CA,0x7CB,0x1BC,0x1BC,0x39F,0x39E,
    
0x7ED,0x7EE,0x7DA,0x7DB,0x153,0x154,0x3AF,0x3AE,
    
0x7FD,0x7FE,0x7FF,0x7FF,0x7FF,0x7FF,0x7FF,0x7FF
  
};

  if (
vecx(d) != 0) {
    
temp.jx int(player.x)+.5;
    
temp.jy int(player.y) + 1;
  } else {
    
temp.jx player.x;
    
temp.jy int(player.1);
  }

  
temp.nx player.x;
  
temp.ny player.y;
  
temp.sx temp.sy 0;
  
temp.1;
  
temp.jumpcliff tiles[player.x+1.5+vecx(d)*2,player.y+2+vecy(d)*2in clifftiles || tiles[player.x+1.5+vecx(d)*2,player.y+2+vecy(d)*2in except;
  while (
onwall2(jx+vecx(d)*((i-1>0?i-1:1)*2),
                 
jy+((i-1>0?i-1:1)*(== 0?-1:1)),
                 
2,2)
         || 
CheckSqrTiles(jx+vecx(d)*((i-1>0?i-1:1)*2),
                          
jy+((i-1>0?i-1:1)*(== 0?-1:1)),
                          
except)) {
    
temp.sx jx vecx(d)*(i*2);
    
temp.sy jy i*(== 0?-1:1);
    
i++;
    for (
temp.j=0;j<4;j++) {
      if ((
jumpcliff == true && CheckSqrTiles(sx,sy,clifftiles) == false && onwall2(sx,sy,1,1))
          || (
player.horseimg != null && onwater(sx+1,sy+1))) {
        
freezeplayer(0);
        if (
player.horseimg == nullplayer.act PUSH;
        return;
      }
    }
    for (
temp.npcs) {
      if (
j.gap != null) {
        if (
sx+1.5 in |j.x,j.x+j.gap[0]| && sy+2 in |j.y,j.y+j.gap[1]|) {
          
freezeplayer(0);
          if (
player.horseimg == nullplayer.act PUSH;;
          return;  
        }
      }
    }
    if (
25) {
      
freezeplayer(0);
      if (
player.horseimg == nullplayer.act PUSH;;
      return;
    }
  }
  
i++;
  if (
<= || 25) {
    
freezeplayer(0);
    if (
player.horseimg == nullplayer.act PUSH;
    return;
  }
  
player.lastpush timevar2;
  
freezeplayer(.1);
  
player.act JUMP;
  
nx sx;
  
ny sy-1;

  if (
player.carry != nullsetani("ce_carryjump",null);
  else if (
player.horseimg != null) {
    
player.attr[4] = "ce_horsejumpscript.gani";
    
setani("ce_ridejump",null);
  } else 
setani("ce_jump",null);

  
temp.jp == .2 .4;
  if (
player.dir == 0temp.jp = -.4;
  for (
temp.j=0;j<((i-2)*2)+1;j++) {
    
freezeplayer(0.25);
    
player.jx vecx(d)*j;
    
player.= (jy-1) - (jp*j)*(== 0?-1:1);

    if (
== 0showimg(0,"sprites.png",nx 1,(player..5) + 2.5 j/20);
    else if (
== 2showimg(0,"sprites.png",nx 1,(ny-1) + 3);
    else 
showimg(0,"sprites.png",jx vecx(player.dir)*j,(jy-1) + 2.5 + (j*.5));
    
changeimgpart(0,24,0,16,8);
    
changeimgvis(0,0);

    if (
player.=> ny && 0) {
      
player.ny;
      break;
    } else if (
player.<= ny && == 0) {
      
player.ny;
      break;
    }
    
jp -= (d in {0,2}) ? .1 : (0.75/(i+((i-5)*.65)));
    
sleep(0.05);
  }
  
player.nx;
  
player.ny;
  
freezeplayer(0);
  
ReturnIdle();
  
hideimg(0);
}

function 
CheckSqrTiles(cx,cy,tls) {
  
temp.istiles false;
  for (
temp.tl=0;tl<4;tl++) {
    if (
tiles[cx+tl%2,cy+int(tl/2)] in tls) {
      
istiles true;
      break;
    }
  }
  return 
istiles;

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 08:56 AM.


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