Equipping and Removing Weapons


the_irate_pirate
11-07-2006, 01:07 PM
Many people out there enjoy small, simple maps, like dod_orange_fight_arena. In light of this, I wanted
to teach everyone [who cares] how to equip/remove weapons. And if you feel this is a waste of your time, don't make comments like "this isn't CS". Remember that many people do like point-and-shoot style gameplay.

Weapons are removed with the player_weaponstrip entity, via input strip. You can use this in various ways, my preferred method is to have players spawn in a trigger_multiple which would trigger the player_weaponstrip. But before you can trigger the player_weaponstrip, you must give it a name.

Once you create the player_weaponstrip entity (which will almost certainly NOT be on the entity list, just type in the name even if will be marked in red), turn off "Smart Edit", click add, then:
Key: targetname
Value: whateveryouwannacallit

Now that you've given your weapon-stripper a name, you can trigger it
anytime. Here's an example setup with a trigger_multiple:
Output: OnStarttouch
Target Entity: Whateveryoucalledit
Via Input: Strip


Weapons are equipped with the game_player_equip entity, via input use. Here are all the possible weapons and their appropriate names:
http://developer.valvesoftware.com/wiki/List_of_DoD:S_entities

Use this as reference:
http://www.fpsbanana.com/tuts/1435

EDIT: the correct names for grenades are weapons_frag_us and weapon_frag_ger (thanks JossiRossi)

So, when you're in the game_player_equip's tab, you turn off "SmartEdit", click add, then:
Key: weapon_thompson
Value: 1

Unfortunately only secondary weapons (that includes M1Carbine and C96) and grenades can have additional
ammo. You can add more ammo by simply adding more of the same item. So you'd have:
Key: weapon_colt
Value: 3

So in this case, if you had set value to 1, it would just give you 1 clip, if you set it to 3 (as you just did), it will give you 2 extra clips. If you set value to 4, you'll have 2 extra clips and one will drop on the ground, which, strangely enough, you WILL pick up. So you can have 3 extra clips, but the last one will have to be equipped seperately (or you'll pick it up off the ground).
Maybe someone can figure out how to add ammo to primary weapons?

I hope you can figure this out! It can be somewhat confusing, but it works, I guarantee, or your money back :D.
P.S. if someone makes nice screenshots, I'll edit this post and add them.

Wile E Coyote
12-09-2006, 12:38 AM
What this has to do with "point-and-shoot style gameplay" is beyond me. Feeling a little defensive?? :D

However the tutorial is a very handy item, can think of lots of uses for it, such as training maps and so on. Thanks!

the_irate_pirate
12-10-2006, 02:35 AM
heck yeah im defensive :D. dod has a 'technical' crowd and their spider-sense is tingling when they sense game_player_equip and such.. not very ww2 like :D.

Unk
03-05-2007, 03:37 AM
use this FGD and it has all the names in it no useing SmartEdit and it gives full ammo the fgd rocks

http://www.editlife.net/customfgd.php

lgdevil
03-05-2007, 06:03 AM
Just FYI RAE's FGD does have weaponstrip. I've been modifying that FGD with updated ammo entities and such. Also RAE's FGD has weapons_frag_us_live and weapons_frag_ger_live. Those can be deleted as they are duplicates of the correct entity name. Why that error wasn't caught I don't know.

Very nice tutorial. Like yourself I'm not sure if mapping wwii purists will approve of adding ammo boxes and such in game. Then again if you were in wwii and found a weapon on the ground or dead soldier chances are you'd pick it up. So this does have value in realism. In any event, mappers using this for practice/range maps will find this tutorial very handy. Nice job.

the_irate_pirate
03-05-2007, 10:54 AM
Hey didn't you figure out how to spawn ammo for primary weapons?

dmGremlin
03-05-2007, 11:31 AM
Just FYI RAE's FGD does have weaponstrip. I've been modifying that FGD with updated ammo entities and such. Also RAE's FGD has weapons_frag_us_live and weapons_frag_ger_live. Those can be deleted as they are duplicates of the correct entity name. Why that error wasn't caught I don't know.

Very nice tutorial. Like yourself I'm not sure if mapping wwii purists will approve of adding ammo boxes and such in game. Then again if you were in wwii and found a weapon on the ground or dead soldier chances are you'd pick it up. So this does have value in realism. In any event, mappers using this for practice/range maps will find this tutorial very handy. Nice job.

Actually I just found the weapons_frag_ger_live, tested it out on my new ammobox (thanks again lgdevil!), and it actually spawned a LIVE GRENADE! I'm not sure how exactly I'd use this in my maps, but it sure was interesting getting blown up a few seconds later.

I also tried to spawn a dod_ammo_box - it spawned an ammo box, but when I walk over it it doesn't do anything, it just sits there.

l3eeron
03-05-2007, 03:02 PM
so to clarify:

Theres no way to have a zook on the ground for anyone to pick up with full ammo? Ive only been able to get it to spawn with 1 rocket in the zook. (Haven't tried changing the key value to 4 or 5 yet, but thats not supposed to work on primary weapons anyway)

the_irate_pirate
03-05-2007, 03:25 PM
Theres no way to have a zook on the ground for anyone to pick up with full ammo?

it seems so. But this got me hopeful (and confused):

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.

lgdevil
03-05-2007, 10:38 PM
The bazooka's do have rocket ammo you can spawn with the model. The entities are in valves wiki which there is a link to it in the first post of this thread.

Gremlin that's cool to know about the live grenade. Guess I'll have to put it back in my fgd lol.

l3eeron
03-11-2007, 10:05 AM
This would be ALOT better to do this with an event script using the admin plug in. I have two working solutions using map entities but both have bugs though. The big problem is, you MUST disarm your primary weapon before trying to pick anything up. It wont give you anything unless your primary slots is empty.

In one version, a func_button fires to a strip/equip combo thats works good. But that one sucks because I cant tell the equip to not do things like give snipers grenades. And I cant tell it to give riflegrenades when its a rifleman, etc... Also, I think the strip/equip entities fire to all the players on your team when you trigger them - not cool. I think I need to integrate the !activator into the equation somehow.

In the other version, a weapon_m1carbine spawns off a logic timer every 2 seconds.


Nothing really works perfect. I posted a request at mattieinfo.com for someone to write a script like this. It'd be sweet if I could tell the admin plug in to make the player drop his primary, then ma_give player weapon_m1carbine when the player is in a certain trigger brush and hits the +use key.

Ill report back if I get anywhere with this.


The only other thing that might be a part of the solution is the !activator input. Im still working on this one....

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.