Advertisement
TechOFreak

Episode 49 Functions

Aug 30th, 2021
1,044
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.63 KB | None | 0 0
  1. //From my Amnesia Rebirth Tutorial Series
  2. //Episode 49 Custom Inventory Items! Prop Pickups!
  3. //https://www.youtube.com/playlist?list=PL4KkjlmOwLwwMVqedCNpi6caUxhgyf8Qr
  4. //-----------------------------------------------------------
  5.  
  6.  
  7. //Create the inventory icon with size 256x256
  8.  
  9. //Export as PNG
  10.  
  11. //Then export as DDS
  12.  
  13. //Put down the entity you want to turn into a pickup entity
  14.  
  15. //Click the plus to create a new entity
  16.  
  17. //Entity settings > class > change to Prop_Pickup
  18.  
  19. //Save to your custom story folder
  20.  
  21. //On the entity in your level editor click the dots and change its entity to your new one
  22.  
  23. //Add a new entry to your inventory.cfg file for your new custom pickup item
  24.  
  25. <ItemType ID="Hammer">
  26.             <Inventory Icon="hammer.dds"/>
  27.             <Use OnWorld="true" CanUseOnWorldMapCallback="CanUse_Hammer" UseOnWorldMapCallback="OnUse_Hammer"/>
  28. </ItemType>
  29.  
  30. //Create a description for the hammer
  31.  
  32. <CATEGORY Name="Inventory">
  33.     <Entry Name="Hammer">Sledgehammer</Entry>
  34.     <Entry Name="Hammer_Desc">I might be able to use this to break down a door.</Entry>
  35. </CATEGORY>
  36.  
  37. //Add the can use and on use functions
  38.  
  39. bool CanUse_Hammer(const tString& in asItemType, const tString& in asItemID, const tString& in asPickedEntity){
  40.         return asPickedEntity == "med_door";
  41.     }
  42.    
  43.     bool OnUse_Hammer(const tString& in asItemType, const tString& in asItemID, const tString& in asTargetEntity, const tString& in asItemEntity, float afTimeElapsed, float afTimeStep){
  44.         Prop_SetHealth("med_door", 0.f);
  45.         Item_RemoveFromInventory(ItemType_GetFirstInInventory(asItemType));
  46.         return false;
  47.     }
  48.    
  49.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement