Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Hat NPC -WHY? (https://forums.graalonline.com/forums/showthread.php?t=23600)

darkriders_p2p 02-12-2002 05:36 AM

Hat NPC -WHY?
 
This is my script.Plz tell meh whats wrong and maybe how to fix it.I think its the disabledefmovement OR triggeraction.
// NPC made by SeeD Captain /\/\ãxïmus Ðärkrïdër
if (playertouchsme) {
toweapons Hat NPC;
i=0;
}
if (weaponfired) {
set browsing;
disabledefmovement;
triggeraction playerx,playery,browsing,;
}
if (actionbrowsing) {
i=0;
showimg 200,hat#v(i).png,playerx,playery-2.5;
changeimgpart 200,96,0,55,55;
}
if (keydown(1)&&browsing) {
i++;
showimg 200,hat#v(i).png,playerx,playery-2.5;
changeimgpart 200,96,0,55,55;
}
if (keydown(3)&&browsing) {
i--;
showimg 200,hat#v(i).png,playerx,playery-2.5;
changeimgpart 200,96,0,55,55;
}

LiquidIce00 02-12-2002 05:53 AM

few things to make it better..
u should use this. variables and use this.browsing=1 instead of set browsing..
dont use flags unless ur like databasing something

darkriders_p2p 02-12-2002 07:49 AM

ok thanx,I know that won't make the script work,anymore help?

TDK_RC6 02-12-2002 09:13 AM

first off use keydown's in a timeout event, and dont use triggeraction

do like this

if (weaponfired) {
if (this.hatbrowsin==0) {
this.hatbrowsin=1;
timeout=.1;
} else { this.hatbrowsin=0; }
}

darkriders_p2p 02-12-2002 09:29 AM

so would you say this?
if (weaponfired) {
if (this.hatbrowsin==0) {
this.hatbrowsin=1;
timeout=.1;
} else { this.hatbrowsin=0; }
}
if (keydown(1)&&timeout)&&this.hatbrowsin==1) {
i--;
showimg 200,hat#v(i).png,playerx,playery-2.5;
changeimgpart 200,96,0,55,55;
}
if (keydown(3)&&timeout)&&this.hatbrowsin==1) {
i++;
showimg 200,hat#v(i).png,playerx,playery-2.5;
changeimgpart 200,96,0,55,55;
}
or would the keydown part go before the else {this.hatbrowsin;}
:confused:

TDK_RC6 02-12-2002 09:53 AM

it would be like this:

if (timeout&&this.hatbrowsin==1) {
//keydown evens here
timeout=.1; }

darkriders_p2p 02-12-2002 10:35 AM

hmmm....I am stupid.Is this it?
if (weaponfired) {
if (this.hatbrowsin==0) {
this.hatbrowsin=1;
timeout=.1;
} else { this.hatbrowsin=0; }
if (timeout&&this.hatbrowsin==1) {
if (keydown(1)&&timeout&&this.hatbrowsin==1) {
i--;
showimg 200,hat#v(i).png,playerx,playery-2.5;
changeimgpart 200,96,0,55,55;
timeout =0.1;
}
if (keydown(3)&&timeout&&this.hatbrowsin==1) {
i++;
showimg 200,hat#v(i).png,playerx,playery-2.5;
changeimgpart 200,96,0,55,55;
timeout =0.1;
}
}
}

TDK_RC6 02-12-2002 10:53 AM

dont include the time and hatbrowsin thing in the keydowns


so it would be

if (timeout&&this.hatbrowsin==1) {
if (keydown(1)) {
i--;
etc., etc.

nyghtGT 02-12-2002 01:11 PM

Quote:

Originally posted by Kaimetsu
Also, please use the code tags so we can see the indentation. It makes things so much easier to read :)
makes em look a bit pertiful even if you suck at scripting too ...

neomaximus2k 02-12-2002 02:50 PM

Quote:

Originally posted by Kaimetsu
Also, please use the code tags so we can see the indentation. It makes things so much easier to read :)
Yeah i second it, Maximus interesting script, but can be improved in may ways. afraid i aint got the time to post the upgrades on here, might send them to you later

TDK_RC6 02-12-2002 08:01 PM

personally i used a gani for mine


but hey, whatever you want

darkriders_p2p 02-13-2002 02:47 AM

thanx for the help but the script doesn't work at all,the keydowns don't register when I press them.

TDK_RC6 02-13-2002 02:51 AM

do this
NPC Code:

if (weaponfired) {
this.hb=1;
disabledefmovement;
timeout=.1; }
if (timeout&&this.hb==1) {
if (keydown(1)) { i--; }
if (keydown(3)) { i++; }
if (keydown(5)) { enabledefmovement; this.hb=0; }
// SHOWIMG STUFF HERE
// SHOWIMG STUFF HERE
// SHOWIMG STUFF HERE
// SHOWIMG STUFF HERE
// SHOWIMG STUFF HERE
timeout=.1; }


darkriders_p2p 02-13-2002 04:16 AM

thanx!
 
yesh this one works,I just have to make showimg smaller,or make it a gani,thanx for the help. :D
I probably will post more when I add more steps.

TDK_RC6 02-13-2002 04:59 AM

lol,

yeah i know, i just didnt feel like, was running short on time

sameasnow,betterhurry

darkriders_p2p 02-13-2002 05:52 AM

k
 
just a little problem,when I do hideimg when you use the S button (or keydown(5)) it doesn't hide the img,I am sure its right...
but you guys can probably tell me.
the showimg index is 200 and my hideimg index is 200.
Thats right,right?

TDK_RC6 02-13-2002 07:52 AM

you'll have to post the script for me to check

darkriders_p2p 02-13-2002 08:00 AM

nm I fixed it,I just added:
NPC Code:
if (this.hb==0) {
hideimg 200;
}


Pretty basic and I can't believe I couldn't think of that before

TDK_RC6 02-13-2002 08:34 AM

Quote:

Originally posted by darkriders_p2p
nm I fixed it,I just added:
NPC Code:
if (this.hb==0) {
hideimg 200;
}


Pretty basic and I can't believe I couldn't think of that before

okay, cool beans

darkriders_p2p 02-14-2002 06:57 AM

new options
 
Ok,I got the basic things done,now I need some help adding the following:
-When you select a hat to where and your already wearing it,it will go off.
-And the BIG one,instead of having them all,could you help me make it so you only get first 5 for free and the rest you buy?
this is the script so far:

NPC Code:
// NPC made by SeeD Captain /\/\ãxïmus Ðärkrïdër 
if (playertouchsme) {
toweapons Hat NPC;
}
if (weaponfired) {
this.hb=1;
setani idle,;
setplayerdir down;
disabledefmovement;
timeout=.1;
}
if (timeout&&this.hb==1) {
if (keydown(1)) {
i--;
}
if (keydown(3)) {
i++;
}
if (keydown(5)) {
hideimg 200;
setstring client.hat,hat#v(i).png;
setplayerprop #P1,#s(client.hat);
setani haton,#s(client.hat);
enabledefmovement;
timeout =0.1;
this.hb=0;
}
showimg 200,hat#v(i).png,playerx-.06,playery-2;
changeimgpart 200,95,0,48,48;
timeout=.1;
if (i<0) {
i=0;
}
if (this.hb==0) {
hideimg 200;
}
}


TDK_RC6 02-14-2002 10:23 AM

do something like this
[code]
if (keydown(4)) {
if (strequals(#P(0),)) {
setplayerprop #P(0),whateverhat;
setani hat-on,;
sleep .35;
break;
} else {
setani hat-off,;
sleep .35;
setplayerprop #P(0),;
break; }
}

TDK_RC6 02-14-2002 10:45 AM

didnt test that

had to write it fast so i can finish a level, sorry if it doesn't work

Saga2001 02-15-2002 01:08 AM

Quote:

Originally posted by TDK_RC6
didnt test that

had to write it fast so i can finish a level, sorry if it doesn't work

its ok your still worth your weight in fish.

TDK_RC6 02-15-2002 01:58 AM

Quote:

Originally posted by Saga2001


its ok your still worth your weight in fish.

my weight in fish, what does that mean??

darkriders_p2p 02-15-2002 02:47 AM

ya it doesn't work,I have no idea what was happening there,press down and something happened? I tried to fix it but I glitched it big time.

TDK_RC6 02-15-2002 02:57 AM

Quote:

Originally posted by darkriders_p2p
ya it doesn't work,I have no idea what was happening there,press down and something happened? I tried to fix it but I glitched it big time.
well, send me the script and i'll fix it so it works

[email protected]

Saga2001 02-15-2002 06:35 AM

Quote:

Originally posted by TDK_RC6


my weight in fish, what does that mean??

easy, your worth your weight in fish...duh!

TDK_RC6 02-15-2002 09:55 AM

how much does fish cost per pound??

Saga2001 02-15-2002 01:54 PM

Quote:

Originally posted by TDK_RC6
how much does fish cost per pound??
$12 about...


All times are GMT +2. The time now is 07:17 PM.

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