Baddy Experiment 1: The Frog.
Terribly simple, and that's the point.
The script (note the constant references to clientside classic-style):
NPC Code:
if (created) {
showcharacter;
dontblock;
setcharprop #3,frog.png;
setcharani tyhm_frog_baddy_rustle,;
}
if (playerenters||timeout) {
if (isleader) {
if (this.counter==1) {
setcharani tyhm_frog_baddy,;
}else if (this.counter <3) {
this.vulnerable = 1;
this.attacking = 1;
} else if (this.counter < 4){
this.vulnerable = 0;
this.attacking = 0;
} else if (this.counter < 5){
hide;
} else {
this.counter = 0;
x+=random(-5,+5);
if (x>63) x=63;
else if (x<0) x=0;
y+=random(-5,+5);
if (y>63) y=63;
else if (y<0) y=0;
show;
}
this.counter+=0.05;
}
if (this.attacking > 0) {
if(playerx in |x-2,x+2| && playery in |y-4,y+1|){
hitplayer 0,1,x,y;
}
}
timereverywhere;
timeout=0.05;
}
if((wa****||wasshot||exploded)&&this.vulnerable>0) {
this.vulnerable = 0;
this.counter=0;
setcharani baddydead,;
sleep 1;//I know, I know, bad form but it's temporary.
temp.i=int(random(0,20));
if (temp.i<5) lay greenrupee;
else if (temp.i<6) lay bluerupee;
else if (temp.i<9) lay heart;
destroy;
}
Timing's way off, gani's smoother but not quite as Correct - point is, this is the theory.