Graal Forums  

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #16  
Old 01-28-2002, 06:00 AM
lordhelmut lordhelmut is offline
Registered User
lordhelmut's Avatar
Join Date: Aug 2001
Posts: 710
lordhelmut is on a distinguished road
Send a message via ICQ to lordhelmut Send a message via AIM to lordhelmut Send a message via Yahoo to lordhelmut
i completely started over.

// NPC made by Lord Helmut
//255x144 width=63 height=48

if(created){
this.hearts=5;
this.speed=.1;
this.fdir=0;
this.fsprite=0;
this.fswimsprite=0;
setimgpart #f,0,0,63,48;
}
if(playerenters){
timeout=.05;
}

if(timeout){
if (random(1,40)<3) this.fdir=int(random(0,4));
if (this.fdir==0 && !onwall(x+2,y-.1)) y-=this.speed;

if (this.fdir==1 && !onwall(x-.5,y+1.5)) x-=this.speed;

if (this.fdir==2 && !onwall(x+2,y+3.1)) y+=this.speed;

if (this.fdir==3 && !onwall(x+4.1,y+1.5)) x+=this.speed;
if (this.fswimsprite==0) this.fsprite=0;
if (this.fswimsprite==1) this.fsprite=0;
if (this.fswimsprite==2) this.fsprite=1;
if (this.fswimsprite==3) this.fsprite=1;
if (this.fswimsprite==4) this.fsprite=0;
if (this.fswimsprite==5) this.fsprite=0;
if (this.fswimsprite==6) this.fsprite=2;
if (this.fswimsprite==7) this.fsprite=2;
this.fswimsprite++;
if (this.fswimsprite>=8) this.fswimsprite=0;
timeout=.05;
}

if (onwater(x+2,y+1.3)) {
if (this.fdir==2) {setgifpart b_piranah.png,63*1,48*0,63,48;}
if (this.fdir==0) {setgifpart b_piranah.png,63*0,48*0,63,48;}
if (this.fdir==1) {setgifpart b_piranah.png,63*3,48*0,63,48;}
if (this.fdir==3) {setgifpart b_piranah.png,63*2,48*0,63,48;}
}

it works fine accept...the fish sometimes swims onto land and for some reason it doesnt display fish sprites =( it should the fish swimming around really fast but it wont show the sprites of the tail moving
Reply With Quote
 


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 06:37 PM.


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