Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Server (https://forums.graalonline.com/forums/forumdisplay.php?f=14)
-   -   script question. (https://forums.graalonline.com/forums/showthread.php?t=15311)

Bravo_LAT-Admin 10-24-2001 03:11 AM

script question.
 
// NPC made by Pikaz (RC)

if (playerenters) {
this.berrycount=4;
drawunderplayer
}
if (playertouchsme) {
}

timeout=2;
if (timeout&&this.berrycount<4)
{
this.berrycount=this.berrycount+1;
if (this.berrycount=4)
{setimg bushred4.gif}
if (this.berrycount=3)
{setimg bushred3.gif}
if (this.berrycount=2)
{setimg bushred2.gif}
if (this.berrycount=1)
{setimg bushred1.gif}
if (this.berrycount=0)
{setimg bushred0.gif}
timeout=2;
}
if (actionberry&&this.berrycount>0) {
this.berrycount=this.berrycount-1;
if (this.berrycount=4)
{setimg bushred4.gif}
if (this.berrycount=3)
{setimg bushred3.gif}
if (this.berrycount=2)
{setimg bushred2.gif}
if (this.berrycount=1)
{setimg bushred1.gif}
if (this.berrycount=0)
{setimg bushred0.gif}
if (playerdir==0) { putleaps 0,playerx+0.5,playery-1; };
if (playerdir==1) { putleaps 0,playerx-2,playery+1; };
if (playerdir==2) { putleaps 0,playerx+0.5,playery+2.5; };
if (playerdir==3) { putleaps 0,playerx+3,playery+1; };
setstring client.berrycount,#v(strtofloat(#s(client.berrycou nt))+1);
}
//#CLIENTSIDE
if (created)
{
setgif bushred4.gif
}

i am having trouble getting this to work online. Any one have any tips. it doesn't seem to be performing the actionberry.

ZORG1986 10-24-2001 03:56 AM

Does it work offline?
because that
setstring client.berrycount,#v(strtofloat(#s(client.berrycou nt))+1);
Looks wrong on first glance.....

Bravo_LAT-Admin 10-24-2001 03:58 AM

yep
 
yepperz works fine offline.

KJS 10-24-2001 06:37 AM

#1 I dont think you can have putleaps, playerdir, playerx, playery server side I think they have to be clientside

#2 if (this.berrycount=0)

shouldn't it be

if (this.berrycount==0)

I am saying that for all the if thens

BocoC 10-24-2001 07:02 AM

Don't forget to add a semi-colon after ALL commands. And, I don't think timeout=2 should be out of a loop. If that npc gets activated before the 2 seconds are up, then it will reset the timeout to 2. Better put the timeout=2 in an if (playerenters) or in an if (created) clause.

Bravo_LAT-Admin 10-24-2001 07:07 AM

// NPC made by Pikaz (RC)
if (created)
{
this.berrycount=4;
}
if (playerenters) {
this.berrycount=4;
drawunderplayer;
}
timeout=2;
if (timeout&&this.berrycount<4)
{
this.berrycount=this.berrycount+1;
timeout=2;
}
if (actionberry&&this.berrycount>0) {
this.berrycount=this.berrycount-1;
setstring client.berrycount,#v(strtofloat(#s(client.berrycou nt))+1);
}
//#CLIENTSIDE
if (actionberry&&this.berrycount>0)
{
if (playerdir==0) { putleaps 0,playerx+0.5,playery-1; };
if (playerdir==1) { putleaps 0,playerx-2,playery+1; };
if (playerdir==2) { putleaps 0,playerx+0.5,playery+2.5; };
if (playerdir==3) { putleaps 0,playerx+3,playery+1; };
}
timeout=2;
if (timeout)
{
if (this.berrycount==4)
{setimg bushred4.gif}
if (this.berrycount==3)
{setimg bushred3.gif}
if (this.berrycount==2)
{setimg bushred2.gif}
if (this.berrycount==1)
{setimg bushred1.gif}
if (this.berrycount==0)
{setimg bushred0.gif}
timeout=2;
}
if (created)
{
setgif bushred4.gif
}

ok here i switched it to this. now the image bushred0.gif keeps showing up even though i have it set as this.berrycount=4 at the begining. Also if hnage it to if (this.berrycount>-1) i get the leaps but this.berrycount doesn't subtract any or does the string add to it self.(of course as stated above this all does work offline)

PresShinP2P 10-24-2001 10:30 PM

needless to say you dont need strtofloat(#s(string)) only strtofloat(str)

methinks

BocoC 10-25-2001 06:19 AM

Pikaz, just send me the script and I will fix it up for you. PM my board account with a zip of the level the script is in, and all the images you use for it.


All times are GMT +2. The time now is 09:17 AM.

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