Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //From my Amnesia Rebirth Tutorial Series
- //Episode 49 Custom Inventory Items! Prop Pickups!
- //https://www.youtube.com/playlist?list=PL4KkjlmOwLwwMVqedCNpi6caUxhgyf8Qr
- //-----------------------------------------------------------
- //Create the inventory icon with size 256x256
- //Export as PNG
- //Then export as DDS
- //Put down the entity you want to turn into a pickup entity
- //Click the plus to create a new entity
- //Entity settings > class > change to Prop_Pickup
- //Save to your custom story folder
- //On the entity in your level editor click the dots and change its entity to your new one
- //Add a new entry to your inventory.cfg file for your new custom pickup item
- <ItemType ID="Hammer">
- <Inventory Icon="hammer.dds"/>
- <Use OnWorld="true" CanUseOnWorldMapCallback="CanUse_Hammer" UseOnWorldMapCallback="OnUse_Hammer"/>
- </ItemType>
- //Create a description for the hammer
- <CATEGORY Name="Inventory">
- <Entry Name="Hammer">Sledgehammer</Entry>
- <Entry Name="Hammer_Desc">I might be able to use this to break down a door.</Entry>
- </CATEGORY>
- //Add the can use and on use functions
- bool CanUse_Hammer(const tString& in asItemType, const tString& in asItemID, const tString& in asPickedEntity){
- return asPickedEntity == "med_door";
- }
- bool OnUse_Hammer(const tString& in asItemType, const tString& in asItemID, const tString& in asTargetEntity, const tString& in asItemEntity, float afTimeElapsed, float afTimeStep){
- Prop_SetHealth("med_door", 0.f);
- Item_RemoveFromInventory(ItemType_GetFirstInInventory(asItemType));
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement