Throwable and Placeable Items
Purpose
This guide shows how to make an item that the player can throw like a grenade and place on a surface like an explosive charge. The RHS strobes use this system. For the player side, see Strobe Devices.
Prerequisites
RHS: Status Quo as a dependency of your mod.
An item model with collision geometry.
Procedure
Make a prefab that inherits from the vanilla
{A9EF01A7A6FE60CD}Prefabs/Weapons/Core/Throw_Base.et.Add
SCR_PlaceableInventoryItemComponentas the inventory item component.Add
RHS_ThrowablePlaceableItemComponentand set its attributes (see the reference below).Set up the throw:
In
WeaponComponent, set isThrowable to 1 and WeaponSlotType togrenade.Add a
GrenadeMoveComponentwithout a trigger.Add a
RigidBody. Use the item weight as the mass.
Save the prefab and test it in play mode.
The player throws the item with the left mouse button. To place it, the player holds the right mouse button (input action RHS_PlaceModeHold) and pushes the left mouse button.
Example
Reference
RHS_ThrowablePlaceableItemComponent:
m_bRequireAimToPlace
1
Show the placement preview only while the player holds the right mouse button. Otherwise the item is thrown.
m_bAlignForwardToSurfaceNormal
1
Place the item with its front (local Z axis) along the surface normal instead of its top (local Y axis).
m_bPickableAfterThrow
1
When a thrown item stops, the server replaces it with a new item of the same prefab, so the player can pick it up.
m_bSkipPlacementAnimation
1
Place the item without an animation. Grenade animation sets have no placing animation.
Prefabs
{5F7EF7FEBC39B874}Prefabs/Items/Equipment/Nightvision/HelstarStrobe/Helstar.et
HEL-STAR 6 strobe, light faces local +Z
{643AB339663E92F7}Prefabs/Items/Equipment/Nightvision/MS2000/Marker_MS2000.et
MS2000 strobe
{8F54EE49D3317266}Prefabs/Items/Equipment/Nightvision/VipLight/VipLight.et
VIP strobe
Last updated