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

πŸ”ͺ Melee

A Melee represents an Entity which can be Pickable by a Character and can be used to melee attack, Charactes can hold it with hands with pre-defined handling modes.

info

🟦 Authority: This class can only be spawned on Server.

⏬ Inheritance: This class inherits from Actor, Paintable and Pickable.

Usage​

local crowbar = Melee(
Vector(-900, 185, 215),
Rotator(0, 90, 90),
"nanos-world::SM_Crowbar_01",
CollisionType.Normal,
true,
HandlingMode.SingleHandedMelee,
""
)

crowbar:SetScale(Vector(1.5, 1.5, 1.5))
crowbar:SetAnimationCharacterUse("nanos-world::AM_Mannequin_Melee_Slash_Attack")
crowbar:SetDamageSettings(0.3, 0.5)
crowbar:SetCooldown(0.5)
crowbar:SetBaseDamage(40)

Constructor Parameters​

TypeNameDefault
VectorlocationVector(0, 0, 0)
RotatorrotationRotator(0, 0, 0)
StaticMesh Assetasset
CollisionTypecollision_typeCollisionType.Normal
booleangravity_enabledtrue
HandlingModehandling_modeHandlingMode.Torch
Material Assetcrosshair_material

Functions​

Inherited Actor Functions
ReturnsNameDescription
AddImpulseApplies a Force in world space to this Actor
AttachToAttaches this Actor to another Actor
DestroyDestroys this Actor
DetachDetaches this Actor if attached
SetCollisionSets this Actor's collision type
SetForceAdds a permanent force to this Actor
SetGravityEnabledSets whether gravity is enabled on this Actor
SetVisibilitySets the Actor visibility
SetHighlightEnabledSets whether the highlight is enabled on this Actor, and which highlight index to use
SetOutlineEnabledSets whether the outline is enabled on this Actor, and which outline index to use
SetLifeSpanSets the time (in seconds) before this Actor is destroyed
SetLocationSets this Actor's location in the game world
SetNetworkAuthoritySets the Player this Actor will have its physics calculated on Network Authority
SetRelativeLocationSets this Actor's relative location in local space
SetRelativeRotationSets this Actor's relative rotation in local space
SetRotationSets this Actor's rotation in the game world
SetScaleSets this Actor's scale
SetValueSets a value in this Actor, which can be accessed by any package
TranslateToSmoothly moves this Actor to the specified location
RotateToSmoothly rotates this Actor to the specified angle
booleanHasNetworkAuthorityGets if the LocalPlayer is currently the Network Authority of this Actor
booleanHasAuthorityGets if this Actor was spawned by the client side
booleanIsBeingDestroyedGets if this Actor is being destroyed
booleanIsGravityEnabledGets whether gravity is enabled on this Actor
booleanIsVisibleGets whether this actor is Visible or not
booleanIsInWaterGets if this Actor is in water
booleanIsNetworkDistributedGets if this Actor is currently Network Distributed
booleanIsValidReturns if this Actor is valid (i.e. not destroyed)
tableGetAttachedEntitiesGets all Actors attached to this Actor
anyGetAttachedToGets the Actor this Actor is attached to
tableGetBoundsGets this Actor's bounds
numberGetCollisionGets this Actor's collision type
numberGetIDGets the universal network ID of this Actor
VectorGetLocationGets this Actor's location in the game world
RotatorGetRotationGets this Actor's angle in the game world
VectorGetForceGets this Actor's scale
VectorGetScaleGets this Actor's scale
stringGetTypeGets the type of this Actor
anyGetValueGets a value stored on this Actor at the given key
VectorGetVelocityReturns this Actor's current velocity
stringAddActorTagAdds an Unreal Actor Tag to this Actor
stringRemoveActorTag`Remove an Unreal Actor Tag from this Actor
tableGetActorTagsGets all Unreal Actor Tags from this Actor
functionSubscribeSubscribes to an Event
UnsubscribeUnsubscribes from an Event
Inherited Pickable 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
Inherited Paintable Functions
ReturnsNameDescription
SetMaterialSets the material at the specified index of this Actor
SetMaterialFromWebUISets the material at the specified index of this Actor to a WebUI object
SetMaterialFromSceneCaptureSets the material at the specified index of this Actor to a SceneCapture object
ResetMaterialResets the material from the specified index to the original one
SetMaterialColorParameterSets a Color parameter in this Actor’s material
SetMaterialScalarParameterSets a scalar parameter in this Actor’s material
SetMaterialTextureParameterSets a texture parameter in this Actor's material to an image on disk
SetMaterialVectorParameterSets a Vector parameter in this Actor’s material
SetPhysicalMaterialOverrides this Actor's Physical Material with a new one
ReturnsNameDescription
SetAnimationCharacterUseSets the Animation when attacking
SetSoundUseSets the Sound when attacking
SetBaseDamageSets the Base Damge
SetDamageSettingsSets the Damage Settings (activation damage time/duration)
SetCooldownSets the Cooldown between attacks
stringGetAnimationCharacterUseGets the attack Animation
stringGetSoundUseGets the Attacking Sound
numberGetBaseDamageGets the Base Damage
numberGetCooldownGets the Cooldown

SetAnimationCharacterUse​

Sets the Animation when attacking

my_melee:SetAnimationCharacterUse(asset_path)
TypeParameterDefault ValueDescription
Animation Assetasset_pathThe Animation used when attacking

SetSoundUse​

Sets the Sound when attacking

my_melee:SetSoundUse(asset_path)
TypeParameterDefault ValueDescription
Sound Asset or Special Pathasset_pathThe Sound used when attacking

SetBaseDamage​

Sets the Base Damage

my_melee:SetBaseDamage(damage)
TypeParameterDefault ValueDescription
numberdamageThe Base Damage value

SetDamageSettings​

Sets the times when to start applying damage and when to end. During this time the collision of the melee will be enabled and the damage will be applied if it hits something

my_melee:SetDamageSettings(damage_start_time, damage_duration_time)
TypeParameterDefault ValueDescription
numberdamage_start_timeThe initial time to start applying damage
numberdamage_duration_timeThe duration time to stop applying damage

SetCooldown​

Sets the cooldown between attacking

my_melee:SetCooldown(cooldown)
TypeParameterDefault ValueDescription
numbercooldown

GetAnimationCharacterUse​

Gets the animation asset

Returns string

my_melee:GetAnimationCharacterUse()

GetSoundUse​

Gets the sound asset

Returns string

my_melee:GetSoundUse()

GetBaseDamage​

Gets the base damage

Returns number

my_melee:GetBaseDamage()

GetCooldown​

Gets the cooldown

Returns number

my_melee:GetCooldown()

Events​

Inherited Actor Events
NameDescription
DestroyTriggered when an Actor is destroyed
SpawnTriggered when an Actor is spawned/created
ValueChangeTriggered when an Actor has a value changed with :SetValue()
Inherited Pickable 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)