calani
02-24-2007, 01:00 AM
People have done this before.
I just can't figure out how they managed it, and its rather annoying.
Anyway, here's my dilemma:
I have a ladder class that attaches players to it when they get nearby (inside x-1..x+1 and y-.5..y+8) and lets them move on the ladder until they go past one of the ends, then it detaches them. This works perfectly.
However, when I lay a second ladder, the first stops attaching, but the second works just fine. If I lay a third, that one works fine, but the second one stops working. I'm using attachplayertoobj(0,id) so I'm not sure why it only works for the most-recently layed ladder. Bugging the crap out of me, too.
Anyway, here's the class:
// 2x8 ladder
//setshape=2,12
//in=-.5,8
function onCreated() {
setshape(1,2*16,12*16);
}
function onActionRemove() {
destroy();
}
//#CLIENTSIDE
function onCreated() {
message("Don't touch, m'kay? ("@[email protected]")");
setimg("");
showimg(1,"zodiac_ladder.png",x,y+2);
findimg(1).layer=1;
blockagain();
setshape2(2,12,{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,});
setTimer(.05);
}
function onPlayerchats() {
if (player.chat=="removeladders") {
this.acctlist={"calani","jerret"};
for(i=0;i<this.acctlist.size();i++) {
if (player.account==this.acctlist[i]) {
message("removing...");
triggeraction(x+1,y+1,"Remove",NULL);
}
}
} elseif (player.chat=="detach") {
detachplayer();
player.x=x+1.5;
player.y=y-1.5;
}
}
function onTimeout() {
if (player.x in |x-1,x+1| && player.y in |y-.5,y+8|) {
if (player.attached==false) attachplayertoobj(0,id);
// do stuff
} else detachplayer();
// message(player.attached);
setTimer(.1);
}
ps: the acctlist is going poof when I finish my staff sys - I'll replace it with a db query to get the current list of staff with the right to lay ladders
I just can't figure out how they managed it, and its rather annoying.
Anyway, here's my dilemma:
I have a ladder class that attaches players to it when they get nearby (inside x-1..x+1 and y-.5..y+8) and lets them move on the ladder until they go past one of the ends, then it detaches them. This works perfectly.
However, when I lay a second ladder, the first stops attaching, but the second works just fine. If I lay a third, that one works fine, but the second one stops working. I'm using attachplayertoobj(0,id) so I'm not sure why it only works for the most-recently layed ladder. Bugging the crap out of me, too.
Anyway, here's the class:
// 2x8 ladder
//setshape=2,12
//in=-.5,8
function onCreated() {
setshape(1,2*16,12*16);
}
function onActionRemove() {
destroy();
}
//#CLIENTSIDE
function onCreated() {
message("Don't touch, m'kay? ("@[email protected]")");
setimg("");
showimg(1,"zodiac_ladder.png",x,y+2);
findimg(1).layer=1;
blockagain();
setshape2(2,12,{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,});
setTimer(.05);
}
function onPlayerchats() {
if (player.chat=="removeladders") {
this.acctlist={"calani","jerret"};
for(i=0;i<this.acctlist.size();i++) {
if (player.account==this.acctlist[i]) {
message("removing...");
triggeraction(x+1,y+1,"Remove",NULL);
}
}
} elseif (player.chat=="detach") {
detachplayer();
player.x=x+1.5;
player.y=y-1.5;
}
}
function onTimeout() {
if (player.x in |x-1,x+1| && player.y in |y-.5,y+8|) {
if (player.attached==false) attachplayertoobj(0,id);
// do stuff
} else detachplayer();
// message(player.attached);
setTimer(.1);
}
ps: the acctlist is going poof when I finish my staff sys - I'll replace it with a db query to get the current list of staff with the right to lay ladders