Projectile: Allow Only One to Exist?

Ask questions, discuss ideas, get answers
Post Reply
User avatar
Swaffy
Posts: 1715
Joined: Sun Aug 29, 2010 9:25 pm
Location: Cibolo, Texas

Projectile: Allow Only One to Exist?

Post 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?
(Forum Thread|Download) Swaffy'sMod v0.34 | Download link to come Soon™
User avatar
Vilespring
Posts: 740
Joined: Sat Nov 24, 2012 5:47 am
Location: Somewere in the United States

Re: Projectile: Allow Only One to Exist?

Post 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.
A picture is worth a thousand words, but takes up three thousand times the memory.

Area 51: http://battlefieldarea51mod.weebly.com/

Image
"I didn't steal your pizza"
User avatar
Apache Thunder
Posts: 1210
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA
Contact:

Re: Projectile: Allow Only One to Exist?

Post 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. ;)
ImageImageImage
I have cameras in your head!
User avatar
Swaffy
Posts: 1715
Joined: Sun Aug 29, 2010 9:25 pm
Location: Cibolo, Texas

Re: Projectile: Allow Only One to Exist?

Post 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.
(Forum Thread|Download) Swaffy'sMod v0.34 | Download link to come Soon™
User avatar
Apache Thunder
Posts: 1210
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA
Contact:

Re: Projectile: Allow Only One to Exist?

Post 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.
ImageImageImage
I have cameras in your head!
User avatar
Swaffy
Posts: 1715
Joined: Sun Aug 29, 2010 9:25 pm
Location: Cibolo, Texas

Re: Projectile: Allow Only One to Exist?

Post 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.
(Forum Thread|Download) Swaffy'sMod v0.34 | Download link to come Soon™
Post Reply