Graal Forums  

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 07-28-2004, 07:36 PM
sparkers sparkers is offline
Yojumisto Online
sparkers's Avatar
Join Date: Jun 2004
Location: Why does anyone care about that?
Posts: 111
sparkers is on a distinguished road
Send a message via AIM to sparkers
Serverside baddy

Hey can someone help me with this script?
There's a few problems.
1.It staggers when it walks and wont show the full gani.
2.It can walk through anything.
3.When its hit its supposed to show text of its damage go up and a bit down.
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=.3
}
if (timeout&&this.found==1) {

if (abs(players[i].x-x)<=20&&abs(players[i].y-y)<=20) {
dir=getdir(players[i].x-x,players[i].y-y);
setcharani podies-walk,;
tx=players[i].x - x;
ty=players[i].y - y;
dist= (tx*tx+ty*ty)^0.5;
nx= (tx/dist)*1.2;
ny= (ty/dist)*1.2;
move nx,ny,1.2,4;
} 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,;playerhearts-=.5};sleep .5;timeout=1;}
timeout=.3;}

if (waS**t) {
message;setcharani podies,;

hearts-=.5;message #v(hearts);sleep 1;
checkdead()}

if (actionprojectile&&!hearts<=0) {
message;setcharani podies-hurt,;
hearts-=strtofloat(#p(1))*2;this.number=strtofloat(#p(1)) *2;
if (this.number != 0){
this.temp ++;
showtext 13,x,y-2*this.temp,veranda,r,#v(this.number);
if (this.temp = 4) this.number = 0;
}else{
hideimg 13;
this.temp = 0;
}




sleep 1;
checkdead();}
function initialize() {
setcharani podies,;setshape 1,50,50;
this.found=0;
hearts=30;
setcharani podies,;
timeout=.3;
}
function checkdead() {
if (hearts<=0) {setcharani podies-dead,;
with (players[i]) {
setplayerprop#c, I got some experience, yay!;
setstring client.playerexp,#v(strtofloat(#s(client.playerexp ))+3);
}
with (players[i+1]) {
setplayerprop#c, I got some experience, yay!;
setstring client.playerexp,#v(strtofloat(#s(client.playerexp ))+3);
}
with (players[i+2]) {
setplayerprop#c, I got some experience, yay!;
setstring client.playerexp,#v(strtofloat(#s(client.playerexp ))+3);
}

timeout=0;setcharani podies-dead,;sleep 2;hide;sleep 30; show;initialize()}
else timeout=.3;

}

Reply With Quote
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 08:03 PM.


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