Fai

03-17-2001, 10:17 PM

I've spent hours trying to figure this out......

HOW DO YOU GET HITPLAYER(ORWHATVER) TO HIT ANYONE WHO IS IN THAT SPOT?!

HOW DO YOU GET HITPLAYER(ORWHATVER) TO HIT ANYONE WHO IS IN THAT SPOT?!

View Full Version : Help

Fai

03-17-2001, 10:17 PM

I've spent hours trying to figure this out......

HOW DO YOU GET HITPLAYER(ORWHATVER) TO HIT ANYONE WHO IS IN THAT SPOT?!

HOW DO YOU GET HITPLAYER(ORWHATVER) TO HIT ANYONE WHO IS IN THAT SPOT?!

kyle0654

03-18-2001, 07:23 AM

-. .`

I'm gonna assume you want it to hit any player in a certain range around a point...

if (whatever starts code) {

this.fromx = #;

this.fromy = #;

this.hitx = #;

this.hity = #;

this.hitradius = #;

this.hitpower = #;

for (this.p = playerscount-1; this.p > 0; this.p--) {

if ((((players[this.p].x + 1.5 - this.hitx)^2 - (players[this.p].y + 1.5 - this.hity)^2)^.5) <= this.hitradius) {

hitplayer this.p, this.hitpower, this.fromx, this.fromy;

}

}

}

basic pathagorean theorem for ya (a^2 + b^2 = C^2), or, in this case, (((a^2 + b^2)^.5) = c). Taking something to the power of .5 will find the square root, just in case you didn't know.

this.fromx/this.fromy - This is where the player will be hit back from. If it's a weapon the player fires, I'd suggest using the player that fired it as this.fromx and this.fromy. You may have arrows or spells though that do different. Maybe even a monster ;)

this.hitx/this.hity/this.hitradius - This is where you are checking for a player. It will check with the center at (this.hitx, this.hity), and check if a player's center is within this.hitradius.

this.hitpower - how many halfhearts you want to take off the player. A hit power of 2 would take off 1 full heart.

Now, if you wanted to check within a box...

if (whatever starts code) {

this.fromx = #;

this.fromy = #;

this.hitx = #;

this.hity = #;

this.hitwidth = #;

this.hitheight = #;

this.hitpower = #;

for (this.p = playerscount-1; this.p > 0; this.p--) {

if (players[this.p].x in |this.hitx, this.hitx+this.hitwidth| && players[this.p].y in |this.hity, this.hity+this.hitheight|) {

hitplayer this.p, this.hitpower, this.fromx, this.fromy;

}

}

}

Only difference is that it checks within a box, and that box checks for the player's top left to be in that box. this.hitwidth and this.hitheight define how big the box is that it should check for a player within.

Please excuse me if this isn't completely perfect, I don't really want to go testin' the scripts right now.

I'm gonna assume you want it to hit any player in a certain range around a point...

if (whatever starts code) {

this.fromx = #;

this.fromy = #;

this.hitx = #;

this.hity = #;

this.hitradius = #;

this.hitpower = #;

for (this.p = playerscount-1; this.p > 0; this.p--) {

if ((((players[this.p].x + 1.5 - this.hitx)^2 - (players[this.p].y + 1.5 - this.hity)^2)^.5) <= this.hitradius) {

hitplayer this.p, this.hitpower, this.fromx, this.fromy;

}

}

}

basic pathagorean theorem for ya (a^2 + b^2 = C^2), or, in this case, (((a^2 + b^2)^.5) = c). Taking something to the power of .5 will find the square root, just in case you didn't know.

this.fromx/this.fromy - This is where the player will be hit back from. If it's a weapon the player fires, I'd suggest using the player that fired it as this.fromx and this.fromy. You may have arrows or spells though that do different. Maybe even a monster ;)

this.hitx/this.hity/this.hitradius - This is where you are checking for a player. It will check with the center at (this.hitx, this.hity), and check if a player's center is within this.hitradius.

this.hitpower - how many halfhearts you want to take off the player. A hit power of 2 would take off 1 full heart.

Now, if you wanted to check within a box...

if (whatever starts code) {

this.fromx = #;

this.fromy = #;

this.hitx = #;

this.hity = #;

this.hitwidth = #;

this.hitheight = #;

this.hitpower = #;

for (this.p = playerscount-1; this.p > 0; this.p--) {

if (players[this.p].x in |this.hitx, this.hitx+this.hitwidth| && players[this.p].y in |this.hity, this.hity+this.hitheight|) {

hitplayer this.p, this.hitpower, this.fromx, this.fromy;

}

}

}

Only difference is that it checks within a box, and that box checks for the player's top left to be in that box. this.hitwidth and this.hitheight define how big the box is that it should check for a player within.

Please excuse me if this isn't completely perfect, I don't really want to go testin' the scripts right now.

vBulletin® v3.8.3, Copyright ©2000-2019, Jelsoft Enterprises Ltd.