Page 1 of 1
Projectile: Allow Only One to Exist?
Posted: Sat Oct 04, 2014 9:18 pm
by Swaffy
I made a droppable ammo bag (in the form of a PCO), and I want to make it to where only a player can have only one ammo bag exist on the map for that player. And if the player drops a new ammo bag then the previous one will self-destroy or disappear.
- The FireArm will have infinite ammo (drop as many ammo bags as player wants)
- Only one ammo bag can exist at a time
- The first ammo bag will disappear when the new one is spawned
- The ammo bag is a PCO that is already destructible.
Can this be done? If so, may I have some direction as to how I can implement this?
Re: Projectile: Allow Only One to Exist?
Posted: Sat Oct 04, 2014 9:38 pm
by Vilespring
I would make it work like the ExPack, where it will "detonate" them, then a few frames later place one. So, the other one would be destroyed, and then another one would be placed.
Re: Projectile: Allow Only One to Exist?
Posted: Sat Oct 04, 2014 9:48 pm
by Apache Thunder
This won't work with infinite ammo. You can add a network template to the projectile and the limit will be dictated by the mag size of the weapon that fires it. This also means the projectile disappears when the player dies and the kit that had the weapon that fired it vanishes from the map. If the player dies in a vehicle, then the projectile vanishes instantly.
Infinite ammo on a weapon that fires a networked projectile will crash the game.

Re: Projectile: Allow Only One to Exist?
Posted: Sun Oct 05, 2014 8:00 am
by Swaffy
Apache Thunder wrote:This won't work with infinite ammo. You can add a network template to the projectile and the limit will be dictated by the mag size of the weapon that fires it. This also means the projectile disappears when the player dies and the kit that had the weapon that fired it vanishes from the map. If the player dies in a vehicle, then the projectile vanishes instantly.
Infinite ammo on a weapon that fires a networked projectile will crash the game.

Okay. So let's narrow it down some more. My only goal is to have only one ammo box, per player, on the map at a time. And if that player throws down another ammo box the old one will go away.
Re: Projectile: Allow Only One to Exist?
Posted: Sun Oct 05, 2014 5:11 pm
by Apache Thunder
Recreate a copy of the exppack hand weapon and give it a ammo of 1. It might still allow two ammo projectiles on the map before it starts removing them however. I'm not entirely sure about that since I've never created a hand weapon like this with that few ammo count. The closest equilevent I have is the claymore handweapons in my BF242 mod or the Troop Trap handweapons in my BFH'42 mod. Both of which have a ammo count or 3 or 4 and I recall the game limiting me to double that amount before removing them from the map when I place new ones.
You can't make the Ammo boxes PCOs, because if you did, they won't vanish from the map when the player places a new one. It has to remain a projectile.
What you can try doing is putting a health depot on the dummy projectile that spawns the PCO that keeps the PCO from self-destructing and when the projectile vanishes the ammo box PCO will quickly die from critical damage settings.
However there's one big issue about this. You can't have a networked projectile spawn a PCO. I've tried this a long time back and it doesn't work. For some reason adding network info to a projectile causes any object spawners tied to that projectile to not work correctly in multiplayer and they never spawn the PCO as intended.
Re: Projectile: Allow Only One to Exist?
Posted: Sun Oct 05, 2014 5:58 pm
by Swaffy
Okay, thanks for the reply. I'll try your idea, if it doesn't work right then I'll just keep my current method - one ammo bag and that's it until the soldier dies and respawns with a new kit.