And npcserver wins in a knockout! I need help. I can't get one of my scripts to work on npcserver. Ok. Now for a little background.
I was surfing the boards one day when I found some people criticizing Brandon (Bravo Online owner) and saying he should add a bowling alley to Bravo. I thought, "Hey! What a neat idea!" So I told Brandon I would make one. I got the preliminarly stuff down, and it worked ok in offline mode, so I thought I should test it out on the Bravo Npcserver before I finish the script up and add in all the little details. Low and behold! I can't pick up the bowling ball. I tried and I tried, but this is frustrating. So, anyone out their willing to help?
Here is the current code for the bowling ball. Sorry for being pretty messy, but here goes:
NPC Code:
// NPC made by Boco
if (playertouchsme) {
setstring this.owner,#a;
replacegani idle,bravo_bowling_idle;
replacegani walk,bravo_bowling_walk;
timeout=0.05;
}
if (timeout) {
with (getplayer(#s(this.owner))) {
if (keydown(6) && playerx in |5,18| && playery in |0,47| && level.reset_a=false) { //37
disabledefmovement;
setani idle,;
Run();
} else { timeout=0.05; }
}
}
function Run() {
GetPower();
ThrowBall();
GoToPins();
Reset();
}
function GetPower() {
for (i=0;i<1;i+=0.05) {
if (keydown(6) && !this.kd) {
this.dis+=1;
set this.kd;
}
if (!keydown(6)) { unset this.kd; }
sleep 0.05;
}
}
function ThrowBall() {
setani bravo_bowling_throwball,;
for (i=0;i<this.dis;i+=0.5) {
playery-=0.5;
sleep 0.05;
if (keydown(1) && !this.kdl) { this.spin-=0.025; set this.kdl; }
if (keydown(3) && !this.kdr) { this.spin+=0.025; set this.kdr; }
if (!keydown(1)) { unset this.kdl; }
if (!keydown(3)) { unset this.kdr; }
}
replacegani walk,walk;
replacegani idle,idle;
}
function GoToPins() {
x=int(playerx+1);
y=int(playery-1);
for (this.i=playery;this.i>2;this.i--) {
y--;
x+=this.spin;
nx=x;
ny=y;
if (y<10) { triggeraction x+0.5,y+0.5,pinstruck,#v(nx),#v(ny); }
sleep 0.05;
}
Reset();
}
function Reset() {
enabledefmovement;
setstring this.owner,;
show;
x=18;
y=38;
this.dis=0;
this.spin=0;
}
//#CLIENTSIDE
if (created) {
setimgpart bravo_bowlingball0.gif,0,0,16,16;
}
Ok. Now for an explanation of the variables:
level.reset_a Sets when the pins are being reset so the player can't throw the ball
this.dis Distance the player moves when throwing
this.spin Applies a spin affect
this.owner Account of active user. This was added when I tried the 'with' command to make the script work
this.kd Stands for Key Down
this.kdl Stands for Key Down Left
this.kdr Stands for Key Down Right
Please help me. I think the problem associates to the replacegani command, because I checked out the status of the NPC on NPC Control. I saw that this.owner was set correctly, but seemed to crash on replacegani and not call timeout=0.05. Anyone care to help? I tried to be as descriptive as possible. Thanks.