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
  #1  
Old 06-15-2001, 03:40 AM
Brady Brady is offline
Registered User
Join Date: Jun 2001
Location: Phoenix
Posts: 21
Brady is on a distinguished road
Send a message via ICQ to Brady
A walker guy

Just a little guy you can control with on and off commands, has a sword (S) and bow (D)
NPC Code:

//Open Source NPC scripted by Brady (Baddies)
//Feel free to use the script in any way that you want.
if (created) {
setstring this.mode,0;
enabledefmovement;
showcharacter;
this.speed=.5;
swordpower=1;
}
if (created || timeout) {timeout=.05}
if (playersays(on)) {this.mode=1;disabledefmovement;}
if (playersays(off)) {this.mode=0;enabledefmovement}
if (timeout && this.mode=1) {
if (keydown(0)) {dir=0;if (!onwater(x+1.5,y+2)) {setcharani walk,} else {setcharani swim,;};if (!onwall(x+1.5,y+.7)) {y-=this.speed}}
if (keydown(1)) {dir=1;if (!onwater(x+1.5,y+1.5)) {setcharani walk,} else {setcharani swim,;};if (!onwall(x+.2,y+2)) {x-=this.speed}}
if (keydown(2)) {dir=2;if (!onwater(x+1.5,y+2)) {setcharani walk,} else {setcharani swim,;};if (!onwall(x+1.5,y+3.2)) {y+=this.speed}}
if (keydown(3)) {dir=3;if (!onwater(x+1.5,y+1.5)) {setcharani walk,} else {setcharani swim,;};if (!onwall(x+2.8,y+2)) {x+=this.speed}}
if (keydown(4)) {setcharani shoot,wbow1.gif;sleep .35;timeout=.05;shootarrow dir;}
if (keydown(5)) {setcharani sword,;sleep .35;timeout=.05}
if (!keydown(0) && !keydown(1) && !keydown(2) && !keydown(3) && !keydown(5) && !onwater(x+1.5,y+1.5)) {setcharani idle,}
}

__________________
Need a reliable webhost?

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 12:42 PM.


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