Ok well i got the monster just can't make it so it won't be able to walk through walls!
NPC Code:
if (created) {setcharani popie,;initialize();setcharprop #P(1),hat#v(int(random(0,100))).png;
}
if (timeout&&this.found==0) {
for (i=-1;this.found==0;i+=1) {
this.found=1;
if (i>playerscount) i=-1;
}
timeout=.1;
}
if (timeout&&this.found==1) {
this.wall=0;
this.gani++;
if (abs(players[i].x-x)<=20&&abs(players[i].y-y)<=20) {
tx=players[i].x - x;
ty=players[i].y - y;
dist= (tx*tx+ty*ty)^0.5;
nx= (tx/dist)*.5;
ny= (ty/dist)*.5;
dir=getdir(players[i].x-x,players[i].y-y);
wallcheck();
if (this.wall==0) {
if (this.gani>=3) {
setcharani podies-walk,;
this.gani=0;
}
x+=nx;
y+=ny;
}
} else {setcharani podies,;message ;this.found=0;timeout=.1}
if (players[i].x in |x-2,x+2|&&players[i].y in |y-2,y+2|) {
setcharani podies-attack,;
with(players[i]) {setani hurt,;setstring client.hp,#v(strtofloat(#s(client.hp))-1)};sleep .5;timeout=1;}
timeout=.1;}
if (wa****) {
message ;setcharani podies,;
hearts-=.5;message #v(hearts);sleep 1;
checkdead()}
if (actionprojectile&&hearts>=0) {
message ;setcharani podies-hurt,;
hearts-=strtofloat(#p(1))*2;
showtext 1000,x,y,verdana,r,#v(strtofloat(#p(1))*2);this.nu mber=strtofloat(#p(1))*2;
sleep .1;showtext 1000,x,y-.2,verdana,r,#v(this.number);
sleep .1;showtext 1000,x,y-.4,verdana,r,#v(this.number);
sleep .1;showtext 1000,x,y-.6,verdana,r,#v(this.number);
sleep .1;showtext 1000,x,y-.8,verdana,r,#v(this.number);
sleep .1;showtext 1000,x,y-.6,verdana,r,;
message #v(hearts);sleep 1;
checkdead();}
function initialize() {
setcharani podies,;setshape 1,50,50;
this.found=0;
hearts=6;
setcharani podies,;
timeout=.1;
}
function checkdead() {
if (this.hearts<=0) {
with(getplayer(#p(2))) {
insertstring client.messages,0,You gained EXP;
setstring client.playerexp,#v(strtofloat(#s(client.playerexp ))+3);
if (strlen(#g)>1) {setstring server.account,#a;setstring server.guild,#g}
}
for(i=0;i<allplayerscount;i++) {
with (allplayers[i]) {
if (strequals(#g,#s(server.guild))&&!strequals(#a,#s( server.account))) {
insertstring client.messages,0,You guild/party got you EXP;
setstring client.playerexp,#v(strtofloat(#s(client.playerexp ))+3);
}
}
}
timeout=0;
hide;
sleep 30;
show;
initialize();
}
else {setcharani podies,;timeout=.65}
}
}
function wallcheck() {
for (a=0;a<2;a+=.1){
message ;
if (onwall(x+(vecx(dir)*a),y+(vecy(dir)*a))) {
this.wall=1;
break;
}
}
}