Creating Ammo Crates
lgdevil
03-03-2007, 08:54 PM
For this example I'll be creating a replenishing grenade crate.
1. Create a prop_dynamic entity, choose the grenade crate model located under items>ammocrate_grenade.mdl
2. Create a brush with the trigger texture and surround the ammo crate with it. This is so you only have to touch the crate/brush to make it give out ammo. Tie it to entity. Give it an trigger_multiple designation.
Under the class info tab give it the name: GrenadeBox.
3. Create a game_player_equip entity somewhere where people won't reach it like in a high corner. Name the entity: PlayerEquip.
4. Go back to the GrenadeBox trigger and open up properties for it. Go to the output tab and click on add. Specify OnTrigger, PlayerEquip, Use, leave fire once unchecked. Click apply.
5. Go back to your PlayerEquip entity. Specify which weapons you want to the crate to give out. Go to the output tab and click on add. Specify OnUser1, GrenadeBox, Enable, leave fire once unchecked. In the flags tab, check the Use Only (don't equip on spawn). Click apply.
I've run into a problem that will probably need solving. You will need some kind of filter to specify which classes should receive what. With the above method it will give ammo to anyone on either team that touches the trigger. So even a sniper who doesn't normally have grenades will be able to pick them up with the crate. If that's a good or bad thing is debatable. If you take it further and get it to work with the correct classes please list your answer here.
Enjoy!
dmGremlin
03-04-2007, 10:28 AM
Thanks so much for the tutorial! I really appreciate it - in the course of getting it to work I also figured out something relevant that I thought I'd share in case anyone else gets confused like I did -
Apparantly the entity names on the valve site (http://developer.valvesoftware.com/wiki/List_of_DoD:S_entities) are wrong.
The proper entity names for all the grenades are actually:
weapon_frag_us = Ally grenade
weapon_frag_ger = Axis grenade
weapon_smoke_ger = Axis smoker
weapon_smoke_us = Ally smoker
weapon_riflegren_ger = Axis Rifle Grenade
weapon_riflegren_us = Alliy Rifle Grenade
You wouldn't happen to know the entity name for the 'spare ammo', would you? :) Still trying to figure out that one...
the_irate_pirate
03-04-2007, 11:17 AM
I don't know of way to add ammo for primary weapons, it may not be possible. However, you can add ammo for secondary weapons.
dmGremlin
03-04-2007, 12:49 PM
I don't know of way to add ammo for primary weapons, it may not be possible. However, you can add ammo for secondary weapons.
How do you do that?
the_irate_pirate
03-04-2007, 01:31 PM
right here, my friend: http://www.dayofdefeat.net/forums/showthread.php?t=69532
JossiRossi
03-04-2007, 03:30 PM
Bah I had ammo crates for months now! =p
As far as I know there is no way to filter player classes, you can only filter teams. So you can't prevent snipers from getting the same ammo.
Also as far as I know primary weapons can only receive the single clip and no more. We'd need to alter what is given when you tell it to give a support gun, right now all you can do is add more support guns which the player can only have one of. Maybe there's a Support_clip kind of item or phantom of an item that could be used?
the_irate_pirate
03-04-2007, 05:54 PM
Maybe there's a Support_clip kind of item or phantom of an item that could be used?
Considering that Valve didn't make the game_player_equip entity "visible" in the entity list (so you either put it in dod's .fgd or have it show up in red, "unrecognized", when you place it in hammer), you'd think that maybe there are other hidden goodies. I don't know, but what I tried to do is to search to search through the client.dll and server.dll with the program "Windows Grep" (http://www.wingrep.com/) for some "hidden" entities.
I'm no programmer. It was confusing. Decompiled code is a mess! There were a few ammo entities, but they almost certainly didn't have classnames (i.e. a mapper can't use them). Maybe someone who knows programming better can try to do what I did, but hopefully with better results?
fishy
03-04-2007, 08:26 PM
that could be breaking the EULA, and if so, might not be the best admission to make on official forums. :rolleyes:
the_irate_pirate
03-04-2007, 08:44 PM
That can't be illegal, because I'm not decompiling it, right?. Also, I didn't gain anything from it :(. I'm just a noob, trying to gain information.
lgdevil
03-04-2007, 09:45 PM
That doesn't break the EULA. Only if you decompile for the purpose of reverse engineering, i.e. creating a new game off of it. Basically taking their stuff and using it for things they wouldn't approve of. I doubt they would have an issue with decompiling it just to find out what the ammo entities are named. We wouldn't have to do that if they gave us all the information we need to work with. Then again I'm no lawyer, just using common sense.
We do need better information on the ammo entity names. There's got to be something in there for us that's just not being published. I doubt they are doing that on purpose too. Probably just something they've missed. Anyone feel like trying to contact the correct developer and get the ammo info we need... Hmm come to think of it that's probably a better way to go rather than decompiling their code. ;) Just ask someone. Who I have no clue. There has to be someone out there with the answers.
the_irate_pirate
03-04-2007, 10:22 PM
I think I know the exact situation. CS:S had the same problem - the primary weapons would only have 1 clip of ammo. It also had another problem - disappearing weapons (when you place them on the ground as, for example weapon_m4a1, entity). The ammo problem was fixed by introducing a certain method, I think this is it:
http://www.fpsbanana.com/tuts/1435
The disappearing weapons problems was also fixed. Unfortunately, DoD:S suffers from both those problems. And Valve, being as busy as they are, will never find time to fix these issues. Maybe we can find some info by using GREP to search for info.. but not likely.
And not only is searching for info through dll's not illegal (by using Grep), decompiling is also not illegal, as long as you do it for information purposes.
Ace_McGirk
03-05-2007, 01:35 AM
Considering that Valve didn't make the game_player_equip entity "visible" in the entity list (so you either put it in dod's .fgd or have it show up in red, "unrecognized", when you place it in hammer
I have not changed my fdg or any other files and this entity shows up normally in hammer for me.
btw nice tut.......solves a problem I had on a training map.
lgdevil
03-05-2007, 06:09 AM
Might be worth noting that the above method can dish out infinite ammo crates. If you want an ammo crate to give out a different kind of ammo create a PlayerEquip2 and tie that to the trigger...and so on.
With the above method I currently have 7 identical ammo crates tied to the 1 player_equip entity. The ammo crates never run out of ammo. They are bottomless pits of ammo. So if you want to put an ammo cap on how many times they can give out ammo I'm clueless.
Ace_McGirk
03-05-2007, 08:03 AM
Might be worth noting that the above method can dish out infinite ammo crates. If you want an ammo crate to give out a different kind of ammo create a PlayerEquip2 and tie that to the trigger...and so on.
With the above method I currently have 7 identical ammo crates tied to the 1 player_equip entity. The ammo crates never run out of ammo. They are bottomless pits of ammo. So if you want to put an ammo cap on how many times they can give out ammo I'm clueless.
Must be some way to tie in a math_counter
to shut it down after so many gives(maybe have the player equip output to the math_counter to increment the count each time)
I will look into it later tonight
the_irate_pirate
03-05-2007, 09:20 AM
Might be worth noting that the above method can dish out infinite ammo crates. If you want an ammo crate to give out a different kind of ammo create a PlayerEquip2 and tie that to the trigger...and so on.
With the above method I currently have 7 identical ammo crates tied to the 1 player_equip entity. The ammo crates never run out of ammo. They are bottomless pits of ammo. So if you want to put an ammo cap on how many times they can give out ammo I'm clueless.
so you CAN add ammo for primary weapons? and how do you spawn the ammo box? is it the dod_ammo_box entity?
lgdevil
03-05-2007, 10:31 PM
We are talking ammo crates here not ammo boxes but the choice is all in the model you want. It doesn't respawn, it's always there. Primary ammo is given in the form of the gun. Other than grenades it's the only way I've found to do it.
Heres a good example. You want to make a sniper training map with an ammo crate for snipers. Unfortunately there is no sniper specific ammo entity (that I'm aware of). So you'll have to give out the sniper rifle. In doing so the new sniper rifle only has 1 clip. That means 5 shots then you have to drop the gun, go to the ammo crate and get another one. Just little issues like that which makes my and your life harder than it should be.
Day of Defeat Forum Archive created by
Neil Jedrzejewski.
This in an partial archive of the old Day of Defeat forums orignally hosted by
Valve Software LLC.
Material has been archived for the purpose of creating a knowledge base from messages posted between 2003 and 2008.