Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-27-2005, 05:30 PM
Foggy Foggy is offline
Can you dance to my beat
Foggy's Avatar
Join Date: May 2005
Location: N.Ireland, Larne
Posts: 80
Foggy is on a distinguished road
Send a message via AIM to Foggy Send a message via MSN to Foggy
Quote:
Originally Posted by Lance
He just told you.
Is this it then? And how do I make move and make sounds?

NPC Code:
// NPC made by FOGGY
if (created || timeout) {timeout=.05}
if (playersays(/in)) {this.mode=1;disabledefmovement;}
if (playersays(/out)) {this.mode=0;enabledefmovement}
if (timeout && this.mode=1) {
if (keydown(0)) {dir=0;if (!onwater(x+1.5,y+2)) {setcharani my_car,} 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 my_car,} 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 my_car,} 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 my_car,} else {setcharani swim,;};if (!onwall(x+2.8,y+2)) {x+=this.speed}}
if (!keydown(0) && !keydown(1) && !keydown(2) && !keydown(3) && !keydown(5) && !onwater(x+1.5,y+1.5)) {setcharani my_car,}
}

__________________
Reply With Quote
  #2  
Old 08-27-2005, 05:35 PM
Lance Lance is offline
dark overlord
Lance's Avatar
Join Date: Sep 2003
Location: Space Jam Mountain
Posts: 5,072
Lance is on a distinguished road
Quote:
Originally Posted by Foggy
Is this it then? And how do I make move and make sounds?

NPC Code:
// NPC made by FOGGY
if (created || timeout) {timeout=.05}
if (playersays(/in)) {this.mode=1;disabledefmovement;}
if (playersays(/out)) {this.mode=0;enabledefmovement}
if (timeout && this.mode=1) {
if (keydown(0)) {dir=0;if (!onwater(x+1.5,y+2)) {setcharani my_car,} 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 my_car,} 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 my_car,} 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 my_car,} else {setcharani swim,;};if (!onwall(x+2.8,y+2)) {x+=this.speed}}
if (!keydown(0) && !keydown(1) && !keydown(2) && !keydown(3) && !keydown(5) && !onwater(x+1.5,y+1.5)) {setcharani my_car,}
}

First, don't use playersays(). It's deprecated. Instead, catch the playerchats event and check the value of #c (the current chat text).

Second, Skyld already gave you some hints about how to move. For making sounds, there is the play command.
Reply With Quote
  #3  
Old 08-27-2005, 05:48 PM
Foggy Foggy is offline
Can you dance to my beat
Foggy's Avatar
Join Date: May 2005
Location: N.Ireland, Larne
Posts: 80
Foggy is on a distinguished road
Send a message via AIM to Foggy Send a message via MSN to Foggy
Quote:
Skyld already gave you some hints about how to move. For making sounds, there is the play command.
But how do i lay it all out and stuff?
__________________
Reply With Quote
  #4  
Old 08-27-2005, 06:57 PM
projectigi projectigi is offline
Registered User
Join Date: Jan 2004
Posts: 403
projectigi is an unknown quantity at this point
btw is there a way to make ganis blocking?
cuz it really sucks when someone walks under your car XD
Reply With Quote
  #5  
Old 08-28-2005, 02:24 AM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
this is an NPC i made for running, it allows every direction (360) it's easier this way I think any way. BTW, this doesn't have gani's in or anything, and it lets you run over walls, which is something I'm working on now (minor problem) sorry, im terrible w/ formatting
NPC Code:
// NPC made by Excaliber (Manager)
if(playerenters){
toweapons run
}
if(isweapon&&keypressed&&strequals(#p(1),I)&&!onwa ll(playerx,playery-2) &&playerhearts=playerfullhearts){
freezeplayer .05;
playery=playery-1.5
}
if(isweapon){
timeout=.05
}
if(timeout){
for (i=0;i<4;i++) {
if (keydown(i)) {
if(!onwall(playerx+vecx(i)*1.6,playery+vecy(i)*1.6 )){
playerx=playerx+vecx(i)*1.25;
playery=playery+vecy(i)*1.25;
}
}
}
}

Reply With Quote
  #6  
Old 09-02-2005, 03:21 AM
Dach Dach is offline
call me Chad, it's cooler
Dach's Avatar
Join Date: Aug 2002
Posts: 1,899
Dach is on a distinguished road
Quote:
Originally Posted by excaliber7388
this is an NPC i made for running, it allows every direction (360) it's easier this way I think any way. BTW, this doesn't have gani's in or anything, and it lets you run over walls, which is something I'm working on now (minor problem) sorry, im terrible w/ formatting
For one, there are four directions in your script.
Two, don't post full scripts, give an explanation of what to do. People don't learn by copy+paste.
__________________
Scripting Documents:Old Script Documentation-Movement Tutorial
Reply With Quote
Reply


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 11:23 PM.


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