DustyPorViva |
05-06-2013 04:51 PM |
Quote:
Originally Posted by xXziroXx
(Post 1717584)
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,0x114, 0xD3, 0xD4,0x268,0x269,0x3CE,0x3CF,
0xE2,0x124, 0xE3, 0xE4,0x267,0x26A,0x232,0x233,
0x111,0x112,0x1AA,0x113,0x277,0x27A,0x242,0x243,
0x121,0x122,0x1BA,0x123,0x287,0x28A,0x1CF,0x107,
0xB9, 0xBA, 0xAE, 0xAF,0x297,0x29A,0x1DF,0x117,
0xC9, 0xCA, 0x98, 0x99,0x359,0x35C,0x22E,0x22F,
0xD9, 0xDA,0x12E,0x12F,0x3CE,0x3CF,0x160, 0xCF,
0xE9, 0xEA, 0xBE, 0xBF,0x1AC,0x1AC,0x170, 0xDF,
0xF9, 0xFA,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.y + 1);
}
temp.nx = player.x;
temp.ny = player.y;
temp.sx = temp.sy = 0;
temp.i = 1;
temp.jumpcliff = tiles[player.x+1.5+vecx(d)*2,player.y+2+vecy(d)*2] in clifftiles || tiles[player.x+1.5+vecx(d)*2,player.y+2+vecy(d)*2] in except;
while (onwall2(jx+vecx(d)*((i-1>0?i-1:1)*2),
jy+((i-1>0?i-1:1)*(d == 0?-1:1)),
2,2)
|| CheckSqrTiles(jx+vecx(d)*((i-1>0?i-1:1)*2),
jy+((i-1>0?i-1:1)*(d == 0?-1:1)),
except)) {
temp.sx = jx + vecx(d)*(i*2);
temp.sy = jy + i*(d == 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 == null) player.act = PUSH;
return;
}
}
for (temp.j : 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 == null) player.act = PUSH;;
return;
}
}
}
if (i > 25) {
freezeplayer(0);
if (player.horseimg == null) player.act = PUSH;;
return;
}
}
i++;
if (i <= 2 || i > 25) {
freezeplayer(0);
if (player.horseimg == null) player.act = PUSH;
return;
}
player.lastpush = timevar2;
freezeplayer(.1);
player.act = JUMP;
nx = sx;
ny = sy-1;
if (player.carry != null) setani("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 = d == 2 ? .2 : .4;
if (player.dir == 0) temp.jp = -.4;
for (temp.j=0;j<((i-2)*2)+1;j++) {
freezeplayer(0.25);
player.x = jx + vecx(d)*j;
player.y = (jy-1) - (jp*j)*(d == 0?-1:1);
if (d == 0) showimg(0,"sprites.png",nx + 1,(player.y + .5) + 2.5 - j/20);
else if (d == 2) showimg(0,"sprites.png",nx + 1,(ny-1) + 3);
else showimg(0,"sprites.png",jx + 1 + vecx(player.dir)*j,(jy-1) + 2.5 + (j*.5));
changeimgpart(0,24,0,16,8);
changeimgvis(0,0);
if (player.y => ny && d > 0) {
player.y = ny;
break;
} else if (player.y <= ny && d == 0) {
player.y = ny;
break;
}
jp -= (d in {0,2}) ? .1 : (0.75/(i+((i-5)*.65)));
sleep(0.05);
}
player.x = nx;
player.y = 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;
}
|