Baddy help? :P

Works offline but Online It can’t hurt you and you can’t hurt it?

[CODE]//#CLIENTSIDE
if (playerenters) {
this.maxhp=5;
this.hp=5;
this.restartime=50;
timeout=.1;
}
if (playerenters||timeout) {
this.aimplayer=getnearestplayer,5,5);
}
if (timeout){
showimg 1,@c@#v(this.hp)/#v(this.maxhp),x+1,y+2.5;
changeimgzoom 1,.7;
if (this.hp>0){
setcharani bomy_walk,;
this.aimx=players[this.aimplayer].x;
this.aimy=players[this.aimplayer].y;
for (i=0;i<=20;i++){
if (this.img<=5) {
if (this.img=5) {this.img=0;}
this.img+=1;
}
if (abs(this.aimy)>y){
if (!onwall(x,y+2)) {
dir=2;
this.dir=2;
y+=.02;
}
} else if (abs(this.aimy)<y){
if (!onwall(x,y-2.02;)) {
dir=0;
this.dir=0;
y-=.02;
}
}
if (abs(this.aimx)>x){
if (!onwall(x+2.02,y)){
dir=3;
this.dir=3;
x+=.02;
}
} elseif (abs(this.aimx)<x){
if (!onwall(x-.02,y)){
dir=1;
this.dir=1;
x-=.02;
}
}
bomy_hitplayer();
}
}
else {this.restart+=1;}
if (this.hp<1){
this.hp=0;
putleaps 3,x,y;
}
if (this.restart>=this.restarttime){
this.restart=0;
//this.hp=this.maxhp;
}
timeout=.1;
}

if (washit||wasshot||waspelt){
hide;
bomy_recoil();
timeout=.1;
show;
}

/* functions below for actions *

  •         hitplayer//playerhit          */
    

function bomy_hitplayer() {
//if (!strequals(#g,Paused)) {
if (playerx in |x-.5,x+.5| && playery in |y-1,y+1|) {
playerhearts-=1;
setani ,hurt;
freezeplayer .25;
player_recoil();
}
if (x+vecx(this.dir)*2=this.aimx && y+vecy(this.dir)*2=this.aimy) {
playerhearts-=1;
setani ,hurt;
freezeplayer .25;
player_recoil();
}
//}
}

function bomy_recoil() {
if (this.hp-1>0){
this.hp-=1;
npcx=0;
npcy=0;
if (playerdir=0) {
npcx=0;
npcy-=4;
if(!onwall(x+1.5+npcx,y+2+npcy)){
x+=npcx; y+=npcy;
}
}
if (playerdir=1) {
npcx-=4;
npcy=0;
if(!onwall(x+1.5+npcx,y+2+npcy)){
x+=npcx; y+=npcy;
}
}
if (playerdir=2) {
npcx=0;
npcy+=4;
if(!onwall(x+1.5+npcx,y+2+npcy)){
x+=npcx; y+=npcy;
}
}
if (playerdir=3) {
npcx+=4;
npcy=0;
if(!onwall(x+1.5+npcx,y+2+npcy)){
x+=npcx; y+=npcy;
}
}

}
else {this.hp=0; putleaps 3,x-1,y-1; putleaps 1,x+1,y+1; putleaps 1,x,y; sleep .5; destroy;}
}

function player_recoil() {
newx=0;
newy=0;
if (this.dir=0) {
newy-=3.5;
newx=0;
if(!onwall(playerx+1.5+newx,playery+2+newy)){
playerx+=newx; playery+=newy;
}
}
if (this.dir=1) {
newx-=3.5;
newy=0;
if(!onwall(playerx+1.5+newx,playery+2+newy)){
playerx+=newx; playery+=newy;
}
}
if (this.dir=2) {
newy+=3.5;
newx=0;
if(!onwall(playerx+1.5+newx,playery+2+newy)){
playerx+=newx; playery+=newy;
}
}
if (this.dir=3) {
newx+=3.5;
newy=0;
if(!onwall(playerx+1.5+newx,playery+2+newy)){
playerx+=newx; playery+=newy;
}
}
}[/CODE]

Hmm, just scanning over it real quick. But why is that there?

[QUOTE=Twiggy;7860]

this.aimplayer=getnearestplayer,5,5[b][size="12"])[/size][/b];
[/QUOTE]

My guess is that the player trying to hit the bomy isn’t running the script properly.
It’d be worth a try fiddling with the timeouts, or throwing something with isleader in there.

How many of these baddies do you use on one level? If you use more then one, the x and y values in it will need to be changed to this.x/this.y. So that they are exclusive to that npc only, or each baddy will be reseting the same x/y positions.

Just a shot in the dark here but have you added timereverywhere?

It tends to fix alot of stuff for me online.

Haha :]] (5,5) is what is was xP I’ve been trying to fix it up but nothing is really working.

Only offline xDD But yeah I’m just going to drop this baddy and start over :\ buggy

[QUOTE=Twiggy;7870]Only offline xDD But yeah I’m just going to drop this baddy and start over :\ buggy[/QUOTE]

  • Because you have the best guarantees of what will work and how it works when you use your own abilities and not blindly rip work from other people.

This is the script from super crappy Graal Kingdoms

Yeah, I figured it was supposed to be getnearplayer(5,5); which would make it a function. But that’s not a default Graal function in the version were using to my knowledge.

Also, this line in the bomy_hurtplayer function only has 1 equal sign.

(x+vecx(this.dir)*2=this.aimx && y+vecy(this.dir)*2=this.aimy)

Which will make it assign
x+vecx(ths.dir)*2 to the value this.aimx.
Instead of what it intended to do, by comparing the 2 sides for equality.
You need to use back to back equal signs. (==)

Does the npc move online? I can’t really see it getting a player id to chase, except possible getting the default 0. OR due to the single ='s in the line above giving it a player id # to chase after.

Try putting if (washit||wasshot||waspelt){ inside a timeout to see if it makes a differnce on being able to damage the baddy. I assume they are event flags that should work without a timeout, but try it to see, and if it makes no differnce, there is definetly a hangup in the script or the player isn’t running it.

Also, like pyrez said, you should try adding timereverywhere.

But I guess it doesn’t matter much if he’s scrapping the script anyway.

Yeah, in my commands.rtf it just shows the proper way of writing it as
setani hurt;
I thought only the commands that replace a default gani have the coma, but it could be an error on whoever wrote my commands.rtf.

I know what you mean now lol I’m not exactly a baddy person :stuck_out_tongue: but I looked over some of Aces baddy bible and learned a few things and started on a even better baddy xDD thats sad I think. :]

[QUOTE=JonusRockweller;7881]

  • Because you have the best guarantees of what will work and how it works when you use your own abilities and not blindly rip work from other people.
    [/QUOTE]

It’s not from GK lol :stuck_out_tongue: It’s just from an old friend I never said I made it did I? :o! If I was ripping it I would claim to have made it I just said I was trying to fix it up haha

[QUOTE=Spooon;7886]
This is the script from super crappy Graal Kingdoms
[/QUOTE]

It moves online :stuck_out_tongue: It works like it should it just can’t be hurt, and it cant be damaged lol

[QUOTE=HandupOnYoHip;7893]
Yeah, I figured it was supposed to be getnearplayer(5,5); which would make it a function. But that’s not a default Graal function in the version were using to my knowledge.

Also, this line in the bomy_hurtplayer function only has 1 equal sign.

(x+vecx(this.dir)*2=this.aimx && y+vecy(this.dir)*2=this.aimy)

Which will make it assign
x+vecx(ths.dir)*2 to the value this.aimx.
Instead of what it intended to do, by comparing the 2 sides for equality.
You need to use back to back equal signs. (==)

Does the npc move online? I can’t really see it getting a player id to chase, except possible getting the default 0. OR due to the single ='s in the line above giving it a player id # to chase after.

Try putting if (washit||wasshot||waspelt){ inside a timeout to see if it makes a differnce on being able to damage the baddy. I assume they are event flags that should work without a timeout, but try it to see, and if it makes no differnce, there is definetly a hangup in the script or the player isn’t running it.

Also, like pyrez said, you should try adding timereverywhere.

But I guess it doesn’t matter much if he’s scrapping the script anyway.
[/QUOTE]