Skip to main content
Version: latest - a1.7.0 βš–οΈ

Base Pickable

Base class for all Pickables

Pickables are special Actors which can be grabbed, held and used by Characters. Examples of Pickable Actor are: Weapon, Melee and Grenade.

They have special methods and events and are highlighted when looked at by a Character.

Functions​

ReturnsNameDescription
AddSkeletalMeshAttachedSpawns and attaches a SkeletalMesh to this Pickable
AddStaticMeshAttachedSpawns and attaches a StaticMesh to this Pickable
PullUseTriggers the PullUse event on this Pickable
ReleaseUseTriggers the ReleaseUse event on this Pickable
RemoveSkeletalMeshAttachedRemoves, if it exists, a SkeletalMesh from this Pickable given its custom ID
RemoveStaticMeshAttachedRemoves, if it exists, a StaticMesh from this Pickable given its custom ID
SetAttachmentSettingsSets the adjustment of the Attachment
SetCrosshairMaterialSets the crosshair material for this Pickable
SetPickableSets if this Pickable can be grabbed
stringGetAssetNameGets the name of the asset this Pickable uses
CharacterGetHandlerGets the Character, if it exists, that's holding this Pickable

AddSkeletalMeshAttached​

Spawns and attaches a SkeletalMesh to this Pickable, the SkeletalMesh must have the same skeleton used by this Actor's mesh, and will follow all animations from it. Uses a custom ID to be used for removing it later

For customizing the Materials specific of a SkeletalMeshAttached, please use the following syntax as the id in the Paintable methods: attachable///[ATTACHABLE_ID]/[PARAMETER_NAME], where [ATTACHABLE_ID] is the ID of the Attachable, and [PARAMETER_NAME] is the name of the parameter you want to change.

entity:AddSkeletalMeshAttached(id, skeletal_mesh_path)
TypeParameterDefault ValueDescription
stringidUnique ID to assign to the SkeletalMesh
stringskeletal_mesh_pathSkeletalMesh asset to use

AddStaticMeshAttached​

Spawns and attaches a StaticMesh to this Pickable in a Socket with a relative location and rotation. Uses a custom ID to be used for removing it later

For customizing the Materials specific of a StaticMeshAttached, please use the following syntax as the id in the Paintable methods: attachable///[ATTACHABLE_ID]/[PARAMETER_NAME], where [ATTACHABLE_ID] is the ID of the Attachable, and [PARAMETER_NAME] is the name of the parameter you want to change.

entity:AddStaticMeshAttached(id, static_mesh_path, socket, relative_location, relative_rotation)
TypeParameterDefault ValueDescription
stringidUnique ID to assign to the StaticMesh
stringstatic_mesh_pathStaticMesh asset to use
stringsocket""Bone socket to attach to
Vectorrelative_locationVector(0, 0, 0)Relative location
Rotatorrelative_rotationRotator(0, 0, 0)Relative rotation

PullUse​

Pulls the usage of this Pickable (will start firing if this is a weapon)

entity:PullUse(release_use_after)
TypeParameterDefault ValueDescription
numberrelease_use_after-1Time in seconds to automatically release the usage (-1 will not release, 0 will release one tick after)

ReleaseUse​

Releases the usage of this Pickable (will stop firing if this is a weapon)

entity:ReleaseUse()

RemoveSkeletalMeshAttached​

Removes, if it exists, a SkeletalMesh from this Pickable given its custom ID

entity:RemoveSkeletalMeshAttached(id)
TypeParameterDefault ValueDescription
stringidUnique ID of the SkeletalMesh to remove

RemoveStaticMeshAttached​

Removes, if it exists, a StaticMesh from this Pickable given its custom ID

entity:RemoveStaticMeshAttached(id)
TypeParameterDefault ValueDescription
stringidUnique ID of the StaticMesh to remove

SetAttachmentSettings​

Sets the Attachment Settings for this Pickable (how it attaches to the Character when Picking up)

entity:SetAttachmentSettings(relative_location, relative_rotation, socket)
TypeParameterDefault ValueDescription
Vectorrelative_locationRelative location to the Socket
Rotatorrelative_rotationRotator()Relative rotation to the Socket
stringsockethand_r_socketCharacter Socket to attach

SetCrosshairMaterial​

Sets the crosshair material for this Pickable

entity:SetCrosshairMaterial(path)
TypeParameterDefault ValueDescription
stringpathAsset path to the crosshair material

SetPickable​

Sets if this Pickable can be grabbed

entity:SetPickable(is_pickable)
TypeParameterDefault ValueDescription
booleanis_pickable

GetAssetName​

Gets the name of the asset this Pickable uses

entity:GetAssetName()

GetHandler​

Gets the Character, if it exists, that's holding this Pickable

entity:GetHandler()

Events​

NameDescription
DropWhen a Character drops this Pickable
HitWhen this Pickable hits something
InteractWhen a Character interacts with this Pickable
PickUpWhen a Character picks this up
PullUseWhen a Character presses the use button for this Pickable (i.e. clicks left mouse button with this equipped)
ReleaseUseWhen a Character releases the use button for this Pickable (i.e. releases left mouse button with this equipped)

Drop​

When a Character drops this Pickable

Weapon.Subscribe("Drop", function(self, character, was_triggered_by_player)
-- called when any weapon is dropped by a Character
end)
TypeParameterDescription
PickableselfThe Pickable which has been dropped
CharactercharacterThe Character that dropped it
booleanwas_triggered_by_playerIf the Player actively pressed 'G' to drop

Hit​

When this Pickable hits something

Weapon.Subscribe("Hit", function(self, impact_force, normal_impulse, impact_location, velocity)
-- called when any weapon hits something
end)
TypeParameterDescription
PickableselfThe Actor that was hit
numberimpact_forceThe intensity of the hit normalized by the Pickable's weight
Vectornormal_impulseThe impulse direction of the hit
Vectorimpact_locationThe world space location of the impact
VectorvelocityThe Pickable's velocity at the moment it hit

Interact​

When a Character interacts with this Pickable (i.e. tries to pick it up)

return false to prevent the interaction

TypeParameterDescription
PickableselfThe Pickable that just got interacted with
CharactercharacterThe Character that interacted with it

PickUp​

When a Character picks this up

Weapon.Subscribe("PickUp", function(self, character)
-- called when any weapon is picked up by a Character
end)
TypeParameterDescription
PickableselfThe Picable that just got picked up
CharactercharacterThe Character that picked it up

PullUse​

When a Character presses the use button for this Pickable (i.e. clicks left mouse button with this equipped)

Weapon.Subscribe("PullUse", function(self, character)

end)
TypeParameterDescription
PickableselfThe Pickable which has just been used
CharactercharacterThe Character that used it

ReleaseUse​

When a Character releases the use button for this Pickable (i.e. releases left mouse button with this equipped)

Weapon.Subscribe("ReleaseUse", function(self, character)

end)
TypeParameterDescription
PickableselfThe Pickable which has just stopped being used
CharactercharacterThe Character that stopped using it

Available Crosshairs​

nanos world provides a bunch of crosshair materials which can be used in Weapons/Pickables. You can of course create your own crosshair materialr and use those instead!

All available CrosshairsAll available Crosshairs

List of crosshair materials included in the default asset pack​

  • nanos-world::MI_Crosshair_Circle
  • nanos-world::MI_Crosshair_Crossbow
  • nanos-world::MI_Crosshair_Dot
  • nanos-world::MI_Crosshair_Holo
  • nanos-world::MI_Crosshair_Launcher
  • nanos-world::MI_Crosshair_Regular
  • nanos-world::MI_Crosshair_Regular_X
  • nanos-world::MI_Crosshair_Rocket
  • nanos-world::MI_Crosshair_Separated_Triangle
  • nanos-world::MI_Crosshair_Shotgun
  • nanos-world::MI_Crosshair_Square
  • nanos-world::MI_Crosshair_Submachine
  • nanos-world::MI_Crosshair_Tee
  • nanos-world::MI_Crosshair_ThreeDots
  • nanos-world::MI_Crosshair_Triangle
  • nanos-world::MI_Crosshair_Vee