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.