PDA

View Full Version : projectile detection problem


Understood
11-06-2008, 10:37 PM
Hi
I made a tank, and would like it to have its own HP. The problem is that I can't seem to figure out how to detect when a projectile hits the tank, and not the player. I've tried a few things but have had no luck so far.

Basically, I think I need onActionProjectile() to be called whenever a projectile hits a shape surrounding the player...not the player himself

xXziroXx
11-06-2008, 10:50 PM
Have an onActionProjectile() function in the tank NPC's script, simple as that. I think it's clientsided only, so you'll have to trigger data from client to server whenever it's hit.

Understood
11-06-2008, 11:45 PM
Well, the tank is set up like this:

Weapon NPC which handles rotation/movement and sets four player.attr[]'s: the tank's turret gani, the tank's body gani, the rotation angle of the turret, and the rotation angle of the body.

Then, in the gani scripts of the body and turret, the gani rotation is set according to the player.attr[]

Sooo....a setshape via the weaponscript and an onActionProjectile() doesn't work...unless I'm doing something wrong.

cbk1994
11-06-2008, 11:51 PM
I don't think there's any way using shoot() you're going to be able to achieve that.

Understood
11-07-2008, 01:58 AM
I don't think there's any way using shoot() you're going to be able to achieve that.

There has to be a way =[

Bl0nkt
11-07-2008, 02:12 AM
What should happen is there should be a method of changing the player's shape.

DarkReaper0
11-07-2008, 03:23 AM
That would also fix an interesting problem whenever you use player.zoom.

Codein
11-08-2008, 04:46 PM
The only way I can think of doing it is putting an NPC when the weapon is fired, and do all projectile detection in that. However, I do agree that being able to set the player's shape would be much better.

napo_p2p
11-08-2008, 10:23 PM
I don't think there's a good way to do it with the current projectile system.

I guess you could try looping through the 'projectiles' array and check to see if any projectile is within a certain boundary.