Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > NPC Server
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 06-27-2001, 08:37 AM
BocoC BocoC is offline
Registered User
BocoC's Avatar
Join Date: Jun 2001
Location: Washington State, USA
Posts: 980
BocoC is on a distinguished road
Send a message via AIM to BocoC Send a message via Yahoo to BocoC
Cool My script vs. npcserver

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.
__________________
-Boco

FLKJH$TRFG*$(&%>FMG >REN<>F ;.kjsd
  #2  
Old 06-27-2001, 10:31 AM
Er1c Er1c is offline
Registered User
Er1c's Avatar
Join Date: Mar 2001
Location: Chicago, IL
Posts: 791
Er1c is on a distinguished road
I believe (but am not sure) that the replacegani command needs to be clientside... that NPC would work much better as a weapon. Maybe make a ball and when you touch it you get the bowling weapon, and when you bowl it destroys, so that you can make a ball-return system.
__________________
Eric Kraft
  #3  
Old 06-27-2001, 11:27 AM
BocoC BocoC is offline
Registered User
BocoC's Avatar
Join Date: Jun 2001
Location: Washington State, USA
Posts: 980
BocoC is on a distinguished road
Send a message via AIM to BocoC Send a message via Yahoo to BocoC
Cool

Doesn't the 'with' command make the enclosed commands client-side? Like:
NPC Code:

with (getplayer(#a)) {
do stuff;
}


Isn't the do stuff; client-side if it is in a 'with' argument?
__________________
-Boco

FLKJH$TRFG*$(&%>FMG >REN<>F ;.kjsd
  #4  
Old 06-28-2001, 11:14 PM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
no.
  #5  
Old 06-30-2001, 03:41 AM
Guest
Posts: n/a
It's not very clientside when it is loading the account from the database =\
  #6  
Old 06-30-2001, 03:48 AM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
I guess the bowling thing should be
made client-side. Make it work in offline mode,
use showimg instead of an npc that is moved.

Only the pins might need to be scripted
for server-side, let the ball do a triggeraction
when it hits the pins and when the server gets it
(put an npc that uses setshape there)
then you calculate how many pins are falling
and display it.
 


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:39 PM.


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