![]() |
projectile detection problem
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 |
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.
|
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. |
I don't think there's any way using shoot() you're going to be able to achieve that.
|
Quote:
|
What should happen is there should be a method of changing the player's shape.
|
That would also fix an interesting problem whenever you use player.zoom.
|
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.
|
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. |
| All times are GMT +2. The time now is 08:53 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.