PDA

View Full Version : NPC Baddies...


Jerom
07-31-2001, 02:57 PM
Hiyas!
Before I say anything, I'll just say, I SUCK AT SCRIPTING!!!!
ok..
Now I was trying to make a baddie that would move around randomly, and between directional switces, it would pause 1 second, then it would pick a random direction, or it would just stay still for another second again.
All I get out of this script is a bunch of MESSED UP LOOKIN' movement that makes my baddie look like it took some crack cocaine right after running around firepole for at LEAST 7 years straight. I also would like if someone could tell me how to make it so that when the baddie wasn't walking, it would change to idle.gani.
If you are thinking of just re-creating the script(because my work SUCKS), please make it long and drawn out so that us newbie scripters can understand what the script is doing. - thanks
---
//Script made by Jerom
//[email protected]'
if (created && playerenters) {
dontblock;
drawoverplayer;
timeout = 0.05;
this.speed = 0.09;
setarray move,4;
}

if (timeout && this.stop==0){
this.mmode = random(0,50);
timeout = 0.05;
}
if (this.mmode<=10 && timeout){
move[3] = 1;
this.stop = 1;}
if (move[3]==1 && timeout){
x+=this.speed;
move[4] = random(0,50);
this.stop = 1;}
if (this.mmode>10 && this.mmode<20 && timeout) {
move[2] = 1;}
if (move[2]==1 && timeout){
y+=this.speed;
move[4] = random(0,50);
this.stop = 1;}
if (this.mmode>20 && this.mmode<30 && timeout){
move[1] = 1;}
if (move[1]==1 && timeout){
x-=this.speed;
move[4] = random(0,50);
this.stop = 1;}
if (this.mmode>30 && this.mmode<=40 && timeout) {
move[0] = 1;
}
if (move[0]==1 && timeout){
y-=this.speed;
move[4] = random(0,50);}
if (move[4]<=10) {
move[0] = 0;
move[1] = 0;
move[2] = 0;
move[3] = 0;
this.stop = 0;
this.mmode = random(0,50);}
if (this.mmode>40 && this.mmode<50) {
sleep 1;
timeout = 0.05;}

Asuka
07-31-2001, 03:46 PM
well to make him stop

if (move == 0){setgani idle.gani} i think i'm not sure though and i don't know the new commands and it's been a year since i've scripted something but i'm almost positive thats right but i'm bored and downloading so i'm trying to help out =)

08-01-2001, 03:28 AM
:eek: :eek: :eek: :eek: :)


timereverywhere;
if (created){
showcharacter;
setcharprop #n,Mace Baddy;
setcharprop #1,blankbow.gif;
setcharprop #2,blankbow.gif;
hearts=3;
hurtdx=0;
hurtdy=0;
}
if (playerenters||wasthrown){
dirgo={0,-1,-1,0,0,1,1,0};
maceangle={5,3.5,2,.5};
this.speed=.4;
this.macespeed=1.5;
this.pow=1;
this.macepow=2;
swordpower=0;
shieldpower=0;
timeout=.05;
}
if (timeout&&isleader){
if (hearts>0&&this.hit!=1&&this.attack!=1){
for (i=0;i<5;i++){
hideimg i;
}
if (sprite<8){
sprite++;
}else{
sprite=1;
}
this.distx=abs(playerx-x);
this.disty=abs(playery-y);
if (this.distx<=this.disty){
if (playery<y)dir=0;
if (playery>y)dir=2;
}else{
if (playerx<x)dir=1;
if (playerx>x)dir=3;
}
this.dist=((this.distx^2)+(this.disty^2))^.5;
if (this.dist<=8){
this.attack=1;
this.step=0;
sprite=6;
this.angle=maceangle[dir];
this.flyx = x+.5;
this.flyy = y+1.25;
if (dir==0||dir==2) this.flyx-=0.5;
if (dir==1) this.flyx+=0.5;
}
if (this.distx==0){
this.addy=this.speed;
}else if (this.disty==0){
this.addx=this.speed;
}else if (this.distx>this.disty){
this.ratio=this.disty/this.distx;
this.addx=this.speed;
this.addy=this.speed*this.ratio;
}else if (this.disty>this.distx){
this.ratio=this.distx/this.disty;
this.addy=this.speed;
this.addx=this.speed*this.ratio;
}
if (y<playery&&!onwall(x+1.5,y+3+this.addy)) y+=this.addy;
if (y>playery&&!onwall(x+1.5,y-this.addy)) y-=this.addy;
if (x<playerx&&!onwall(x+3+this.addx,y+1.5)) x+=this.addx;
if (x>playerx&&!onwall(x-this.addx,y+1.5)) x-=this.addx;
timeout=.05;
}
if (this.hit==1){
i+=.5;
if (x>playerx&&!onwall(x+3+i,y+1.5)) x+=.5;
if (x<playerx&&!onwall(x-i,y+1.5)) x-=.5;
if (y>playery&&!onwall(x+1.5,y+i)) y+=.5;
if (y<playery&&!onwall(x-1.5,y-i)) y-=.5;
if (i>=3.5){
this.hit=0;
i=0;
}
timeout=.05;
}
}
if (playertouchsme&&hearts>0){
hurt this.pow;
}
if (hearts>0&&abs((x+1.5)-(playerx+1.5))<=3 &&abs((playery+1.5)-(y+1.5))<=3) {
hurt this.pow;
}
if (this.hit!=1&&(washit||wasshot||exploded||waspelt)&&hearts>0){
if (washit){
hurtdx=x;
hurtdy=y;
hearts-=playerswordpower;
}
if (wasshot){
hearts--;
}
if (exploded){
hearts--;
}
if (waspelt){
if (peltwithbush) hearts-=.5;
if (peltwithsign || peltwithvase || peltwithstone) hearts-=1;
if (peltwithblackstone) hearts -=1.5;
}
sprite=39;
this.hit=1;
this.attack=0;
for (i=0;i<5;i++){
hideimg i;
}
timeout=.05;
}
if (timeout&&this.attack==1){
p=testplayer(this.flyx+1,this.flyy+1);
if (p>=0){
hitplayer p,this.macepow,this.flyx+1,this.flyy+1;
}
if (this.step<5){
this.flyx-=.5*(dirgo[dir*2]);
this.flyy-=.5*(dirgo[dir*2+1]);
}else if (this.step>=5&&this.step<=10){
sprite=11;
this.flyx+=dirgo[dir*2]*this.macespeed;
this.flyy+=dirgo[dir*2+1]*this.macespeed;
this.radius=(((x+.5)-this.flyx)^2+((y+1)-this.flyy)^2)^.5;
}else if (this.step>10&&this.step<=30){
this.flyx=x+cos(this.angle)*this.radius;
this.flyy=y+sin(this.angle)*this.radius;
this.angle+=.314;
}else if (this.step>30&&this.step<=36){
this.flyx-=dirgo[dir*2];
this.flyy-=dirgo[dir*2+1];
}else if (this.step>36){
this.attack=0;
sprite=0;
}
this.step++;
this.mc1x=x+.5-(.2*(x-this.flyx));
this.mc1y=y+1-(.2*(y-this.flyy));
this.mc2x=x+.5-(.4*(x-this.flyx));
this.mc2y=y+1-(.4*(y-this.flyy));
this.mc3x=x+.5-(.6*(x-this.flyx));
this.mc3y=y+1-(.6*(y-this.flyy));
this.mc4x=x+.5-(.8*(x-this.flyx));
this.mc4y=y+1-(.8*(y-this.flyy));
showimg 0,wmace.gif,this.flyx,this.flyy;
showimg 1,wmace0.gif,this.mc1x,this.mc1y;
showimg 2,wmace0.gif,this.mc2x,this.mc2y;
showimg 3,wmace0.gif,this.mc3x,this.mc3y;
showimg 4,wmace0.gif,this.mc4x,this.mc4y;
timeout=.05;
}
if (hurtdx!=0||hurtdy!=0){
sprite=39;
hurtdx=0;
hurtdy=0;
}
if (timeout&&hearts<=0&&isleader){
for (i=0;i<5;i++){
hideimg i;
}
this.attack=0;
this.step=0;
while(d<=8){
dir=(dir+3)%4;
d++;
sleep.1;
}
i = random(0,100);
if (i<10) lay greenrupee;
else if (i<15) lay bluerupee;
else if (i<30) lay heart;
sprite=40;
}

Jerom
08-01-2001, 06:54 AM
mmmmkay, now IcePick, why in the heCK did you post an entire different baddie script and not say anything about it?

08-01-2001, 08:11 AM
Originally posted by Jerom
mmmmkay, now IcePick, why in the heCK did you post an entire different baddie script and not say anything about it?

because i felt like it....

DuckyJ
08-01-2001, 10:21 AM
WAY TO GO ICE PICK!

now I don't script baddies much I more script NPC weapons and such, so I won't help for I fear I might steer you wrong, I read every manual I can find on NPC scripting, so if you know of any than please tell me I enjoy it.

Slaktmaster
08-01-2001, 03:44 PM
Way to go Ice Pick? :(
That is the Mace Baddy made my Ace long ago, it could be found on his NPC baddy programming page. I really hope Ice Pickle din't try to take the credit for it...

CyanideSR71
08-02-2001, 10:33 AM
I think XDaKreepX made that.
Hmmm... It it just me or is Ice Pick the new Antago?

Knightoffrost
08-02-2001, 10:35 AM
Originally posted by Jerom
mmmmkay, now IcePick, why in the heCK did you post an entire different baddie script and not say anything about it?

Because he didnt know how to make it becuase he didnt make it. He just took out credits that belong to other people. He has no comment on it because he doesnt know how anything works.

Jerom
08-02-2001, 12:56 PM
Originally posted by Knightoffrost


Because he didnt know how to make it becuase he didnt make it. He just took out credits that belong to other people. He has no comment on it because he doesnt know how anything works.

Word Knightoffrost.

IcePick made a post which meant nothing other than he was posting a script...no explanation, no words other than just the script...which meant no HELP, nor guidance toward helping newbie scripters.
I would also like to add that IcePick was so stupid, that he forgot to change the image coords for the NW bunny when he took credit for it and nammed it something else...He didn't change the name of the variables or anything, just changed the image names.
In this situation, NewWorld should locate IcePick's home, travel to his home, slaughter all of whats left of his so called family, then hang IcePick in the town square for everyone to see what a stupid person he is for stealing a NewWorld script. Oh, and it would be cool if we could burn his house down on Delteria right before we send 5 teams of nukers onto Delteria to get rid of that POSER of a server, once and for all.

"When the hare and the turtle met after the race, the rabbit was kidnapped by IcePick and placed in a swimming event, which later the rabbit drowned because rabbits do not belong in water. Meanwhile the turtle left to go cash in his first place prize winnings on two hookers from Classic."

LiquidIce00
08-02-2001, 01:22 PM
IcePick has lately been trying to show off his super npc scripting skills by copying other ppl's npc scripts. soon he will start posting bomy script and say he made it but hes gonna use his l337 find and replace skills to change all words in the script that say "bomy" to "gomy"

08-02-2001, 02:45 PM
Originally posted by Slaktmaster
Way to go Ice Pick? :(
That is the Mace Baddy made my Ace long ago, it could be found on his NPC baddy programming page. I really hope Ice Pickle din't try to take the credit for it...
Ace did make that, I didnt... If i cloud make something like that, that will be awesome!

LiquidIce00
08-02-2001, 11:13 PM
Originally posted by IcePick_2001

Ace did make that, I didnt... If i cloud make something like that, that will be awesome!
that will be the day hell freezes over