Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Fluffy needs some fine tuning. (https://forums.graalonline.com/forums/showthread.php?t=13047)

freddyfox 09-27-2001 05:03 AM

Fluffy needs some fine tuning.
 
Quote:

// NPC made by Tgf_guy
// NPC improved by Tyne

//Basic Animal Template Version 0.1

timeout = .05;

if (created) {timeout = 0.05;timereverywhere;}
if (playerenters) {show;this.mode = 0;}
if (timeout)
{
//Moving
if (this.mode == 0)
{
if (this.dir == 0) {y=y-.5;}
if (this.dir == 1) {x=x-.5;}
if (this.dir == 2) {y=y+.5;}
if (this.dir == 3) {x=x+.5;}

// Animation
if (this.dir == 0)
{
if (this.frame == 0) setgif squirrel1.gif;
if (this.frame == 1) setgif squirrel2.gif;
}
if (this.dir == 1)
{
if (this.frame == 0) setgif squirrel7.gif;
if (this.frame == 1) setgif squirrel8.gif;
}
if (this.dir == 2)
{
if (this.frame == 0) setgif squirrel3.gif;
if (this.frame == 1) setgif squirrel4.gif;
}
if (this.dir == 3)
{
if (this.frame == 0) setgif squirrel5.gif;
if (this.frame == 1) setgif squirrel6.gif;
}
if (this.frame >1) {this.frame = 0;}

if (this.changedir > 50)
{
this.dir=int(random(0,4));
this.changedir = 0;
}
this.changedir ++;
this.frame ++;
} // End of mode checking
}

if(onwall(x + 0,y)) {this.dir=int(random(0,1));}
if(onwall(x -0,y)) {this.dir=int(random(1,4));}
if(onwall(x,y +2)) {this.dir=int(random(0,2));}
if(onwall(x,y -0)) {this.dir=int(random(2,4));}

if (was*hit) {hide;this.mode = 1;}
Tyne helped me with it, but the onwall is still a little rusty. The animal sometimes will go straight through a wall.

How can I fix it so that he doesn't?

Merlin 09-27-2001 05:07 AM

if (this.mode==0) {
if (!onwall) {

SSj_Link 09-27-2001 05:09 AM

Hmm Might Not Be Right....
 
I might be able to help but not much,

maybe if it was like


if (onwall(x,y)) {
this.oldx




or somethin like that, like in the skateboard script

Merlin 09-27-2001 05:12 AM

Re: Hmm Might Not Be Right....
 
Quote:

Originally posted by SSj_Link
I might be able to help but not much,

maybe if it was like


if (onwall(x,y)) {
this.oldx




or somethin like that, like in the skateboard script

what do you mean?

Xaviar 09-27-2001 05:12 AM

*ADVERTISEMENT*
Yes, folks, on Babylon, not only will our animals be alot neat-o-er than that, but they're alot more efficient too!! :D
*ADVERTISEMENT*

freddyfox 09-27-2001 05:13 AM

Quote:

Originally posted by Merlin
if (this.mode==0) {
if (!onwall) {

Thanks for the suggestion, but it just freezes fluffy in place when he hits a wall.

freddyfox 09-27-2001 05:15 AM

Re: Re: Fluffy needs some fine tuning.
 
Quote:

Originally posted by Kaimetsu
Remember to run it on the NPC Server, of course.
Oy, how do I do that?

I'm not up to date with all of the NPC Server jazz.

freddyfox 09-27-2001 05:24 AM

Re: Re: Re: Re: Fluffy needs some fine tuning.
 
Quote:

Originally posted by Kaimetsu


Okay, I've made my changes and it should work now. To make it an NPC Server thingy, just use the NPC Control. I don't know exactly how it works because I've never used it, but I'm sure it's straightforward.

Thanks Kai.

...I suppose I'll eventually have to learn how NPC Server works.

SSj_Link 09-27-2001 05:25 AM

Err
I odnt remember all of it,
but it puts you back to your Oldx instead of letting you go over the wall, Im sure you could easily convert it

-Freaky-


All times are GMT +2. The time now is 08:04 PM.

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