Search the Community
Showing results for tags 'definitions'.
This question addresses a feature I plan for my cyberpunk extension The Dark Module. It will eventually have an unified inventory, on which every item will be part of the same tool belt. I would like to know how I can combine weapons with item definitions, making them appear and be possible to select from the item browser. Basically I want to make the Blackjack / Sword / Arrows appear in the same inventory list as the Lamp / Compass / Lockpicks / Readables / etc: Just as you select the Lamp item and hit the "use" key to toggle the light, you could select the Sword item and hit the "use" key to select or holster the sword weapon. Obviously you can still activate weapons using their keybinds... although my mod will replace those with a customizable hotbar, which is what this feature is as a starting step for. Technical note 1: I'm aware that weapons are defined differently from player tools, using builtin idTech 4 entries of the form "def_weapon1 atdm:weapon_blackjack". This would obviously not change! What I believe I'm looking for is an additional definition per weapon, which separately creates an item entry for that weapon as well: When you pick up a weapon on the map, the player gets both the normal weapon entry as well as an inventory entry... this entry separately creates an item for that weapon in the player tools list, which activates its weapon when used. Technical note 2: Item dropping would have to be accounted for. If you select a Lockpick for instance, there is a key to hold the item in front of you then drop it to the ground. When doing this with a weapon, dropping the item should of course also unregister the weapon entry and make it unavailable. Obviously the weapon may not be selected while carrying its inventory entry as an item. What is the simplest and cleanest way to achieve this? Can I make the weapon definition register an item directly, or does that have to be a separate entity? If it's the later, how do I make it so that the weapon entity you receive from the map offers both the weapon definition and inventory item to the player simultaneously?