User Tools

Site Tools


scripting:components:charactercontrollercomponent

Table of Contents

CharacterControllerComponent

Provides functionality for wheeled vehicles.

class: CharacterControllerComponent

Parent Class: PrimaryControllerComponent

Location: scripts/Game/generated/Components/CharacterControllerComponent.c

Common usage

wip

Functions

GetAnimationComponent()

GetAnimationComponent();

Return type: CharacterAnimationComponent

GetWeaponManagerComponent()

GetWeaponManagerComponent();

Return type: BaseWeaponManagerComponent

GetCameraHandlerComponent()

GetCameraHandlerComponent();

Return type: CameraHandlerComponent

GetInventoryStorageManager()

GetInventoryStorageManager();

Return type: InventoryStorageManagerComponent

GetVONComponent()

GetVONComponent();

Return type: VoNComponent

GetInputContext()

GetInputContext();

Return type: CharacterInputContext

GetMovementType()

GetMovementType();

Return type: float

SetMovement()

SetMovement(float type, vector movementDirLocal);

Update animation about state of movement, define speed and direction in local space of character

Return type: void

SetHeadingAngle()

SetHeadingAngle(float newHeadingAngle, bool adjustAimingYaw = false);

set heading angle in radians

Return type: void

GetHeadingAngle()

GetHeadingAngle();

Return type: float

SetAimingAngles()

SetAimingAngles(float yaw, float pitch);

set aiming angles in radians

Return type: void

GetStance()

GetStance();

Returns the current stance of the character.

Return type: ECharacterStance

GetCharacter()

GetCharacter();

Returns the current controlled character.

Return type: SCR_ChimeraCharacter

SetFireWeaponWanted()

SetFireWeaponWanted(bool val);

Set wanted input action values

Return type: void

SetThrow()

Set wanted input action values

SetThrow(bool val, bool cancelThrow);

Return type: void

SetMovementDirWorld()

Update simulation state with difference of world position

SetMovementDirWorld(vector movementDirWorld);

Return type: void

GetMovementDirWorld()

GetMovementDirWorld();

Return type: vector

SetWeaponRaised()

Set the current weapon-raised state.

SetWeaponRaised(bool val);

Return type: void

SetWeaponADS()

Set the current weapon ADS state.

SetWeaponADS(bool val);

Return type: void

SetPlayGesture()

Set the current play gesture state.

SetPlayGesture(bool val);

Return type: void

SetFreeLook()

SetFreeLook(bool val);

Return type: void

ResetPersistentStates()

ResetPersistentStates(bool resetADSState = true, bool resetGadgetState = true);

Return type: void

SetDynamicSpeed()

Sets dynamic speed of this character. param value Desired speed as percentage <0,1>.

SetDynamicSpeed(float value);

Return type: void

GetDynamicSpeed()

Returns dynamic speed value. return Dynamic speed value as <0, 1>.

GetDynamicSpeed();

Return type: float

SetDynamicStance()

Sets dynamic stance of this character. param value Desired stance height as percentage of full erect <0,1>.

SetDynamicStance(float value);

Return type: void

CanSetDynamicStance()

Returns whether provided dynamic stance can be set for this character. see CharacterControllerComponent::SetDynamicStance(float value) param value Desired stance height as percentage of full erect <0,1>.

CanSetDynamicStance(float value);

Return type: bool

GetDynamicStance()

Returns current dynamic stance value. return Dynamic stance value as <0,1>.

GetDynamicStance();

Return type: float

SetInspectionMode()

Enables or disables inspection mode. param state Desired state true=enabled, disabled otherwise.

SetInspectionMode(bool state);

Return type: void

CanSetInspectionMode()

Returns whether inspection mode can be set. return True in case inspection mode can be set, false otherwise.

CanSetInspectionMode();

Return type: bool

GetIsInspectionMode()

Returns whether character is in inspection mode. return True in case character is in inspection mode, false otherwise.

GetIsInspectionMode();

Return type: bool

SetInspectionState()

Sets inspection state if inspection state is enabled. param state Desired state.

SetInspectionState(float state);

Return type: void

GetInspectionState()

Returns inspection state if inspection state is enabled. return Returns desired state.

GetInspectionState();

Return type: float

SetStanceChange()

CharacterStanceChange STANCECHANGE_NONE = 0, STANCECHANGE_TOERECTED = 1, STANCECHANGE_TOCROUCH = 2, STANCECHANGE_TOPRONE = 3

SetStanceChange(int stance);

Return type: void

CanChangeStance()

CharacterStanceChange STANCECHANGE_NONE = 0, STANCECHANGE_TOERECTED = 1, STANCECHANGE_TOCROUCH = 2, STANCECHANGE_TOPRONE = 3

CanChangeStance(int stance);

Return type: bool

ForceStance()

ForceStance(int stance);

Return type: void

ForceStanceUp()

ForceStanceUp(int stance);

Return type: void

SetRoll()

2 - right, 1 - left

SetRoll(int val);

Return type: void

SetJump()

SetJump(float val);

Return type: void

SetWantedLeaning()

SetWantedLeaning(float val);

Return type: void

SetBanking()

SetBanking(float val);

Return type: void

SetMeleeAttack()

SetMeleeAttack(bool val);

Return type: void

GetLeaning()

Either character wants to lean

GetLeaning();

Return type: float

GetWantedLeaning

GetWantedLeaning();

Return type: float

IsAdjustingLeaning()

IsAdjustingLeaning();

Return type: bool

GetCurrentLeanAmount()

Returns current amount of leaning applied

GetCurrentLeanAmount();

Return type: float

IsLeaning()

IsLeaning();

Return type: bool

GetADSTime()

GetADSTime();

Return type: float

IsWeaponRaised()

IsWeaponRaised();

Return type: bool

IsWeaponObstructed()

IsWeaponObstructed();

Return type: bool

GetObstructionAlpha()

GetObstructionAlpha();

Return type: float

IsClimbing()

IsClimbing();

Return type: bool

IsSwimming()

IsSwimming();

Return type: bool

IsSprinting()

IsSprinting();

Return type: bool

IsChangingStance()

IsChangingStance();

Return type: bool

IsWeaponADS()

IsWeaponADS();

Return type: bool

IsChangingFireMode()

IsChangingFireMode();

Return type: bool

IsPlayingGesture()

IsPlayingGesture();

Return type: bool

IsFreeLookEnabled()

IsFreeLookEnabled();

Return type: bool

IsTrackIREnabled()

IsTrackIREnabled();

Return type: bool

IsFocusMode()

IsFocusMode();

Return type: bool

GetWeaponADSInput()

GetWeaponADSInput();

Return type: bool

IsChangingItem()

IsChangingItem();

Return type: bool

IsFalling()

IsFalling();

Return type: bool

IsReloading()

IsReloading();

Return type: bool

CanFire()

CanFire();

Return type: bool

IsDead()

IsDead();

Return type: bool

IsUsingItem()

IsUsingItem();

Return type: bool

IsMeleeAttack()

IsMeleeAttack();

Return type: bool

CanEngageChangeItem()

CanEngageChangeItem();

Return type: bool

SelectWeapon()

Set weapon on character with switching animations. If true, the request was successful

SelectWeapon(BaseWeaponComponent newWeapon);

Return type: bool

SetMuzzle()

SetMuzzle(int index);

Return type: bool

SetFireMode()

SetFireMode(int index);

Return type: bool

SetSightsRange()

SetSightsRange(int index);

Return type: void

SetWeaponADSInput()

SetWeaponADSInput(bool val);

Return type: void

SetSafety()

Set the safety of the current weapon. param safety True to set the weapon safety. param automatic True to set the automatic safety otherwise false to set manual safety. return Returns true if the action has been successfull otherwise false.

SetSafety(bool safety, bool automatic);

Return type: bool

GetStamina()

Returns the current stamina value in <0, 1>. -1 if there is no stamina component attached to the current owner.

GetStamina();

Return type: float

ReloadWeapon()

Request weapon reload. If true, request was sucessful

ReloadWeapon();

Return type: bool

ReloadWeaponWith()

mag or projectile

ReloadWeaponWith(IEntity ammunitionEntity);

Return type: bool

Ragdoll()

Dying

Ragdoll();

Return type: void

ForceDeath()

Kills the character. Skips invincibility checks.

ForceDeath();

Return type: void

TakeGadgetInLeftHand()

/* @NOTE(Leo): Temp solution, eventually will be solved by setting respective gadget graph attachments, unfortunately current state of Enf animation system is not allowing it and will be solved not earlier then 10.07 by @Michal Žák from conversation with @Théo Escamez: so heres how it works : for now we have 4 items> compass adrianov, compass SY183, Radio ANPRC68 and Radio R148 …where they are triggered respectively by integers 1 2 3 and 4…

TakeGadgetInLeftHand(IEntity gadget, int gadgetType, bool autoFocus = false, bool skipAnimations = false);

Return type: void

CanEquipGadget()

Performs gadget equip validation

CanEquipGadget(IEntity gadget);

Return type: bool

GetAttachedGadgetAtLeftHandSlot()

GetAttachedGadgetAtLeftHandSlot();

Return type: IEntity

TryUseBandage()

Try to use bandage on specified body part for a specific duration. param bandage Bandage entity used for bandage action. param bodyPart Body part where the bandage will be applied. param duration Duration of the bandage in seconds. param bandageSelf True if the player is bandaging himself.

TryUseBandage(IEntity bandage, int bodyPart, float duration = 4.0, bool bandageSelf = true);

Return type: bool

RemoveGadgetFromHand()

Remove held gadget

RemoveGadgetFromHand(bool skipAnimations = false);

Return type: void

RecoverHiddenGadget()

Put held gadget on hold

RecoverHiddenGadget(bool respectSettings, bool skipAnims);

Return type: void

IsGadgetInHands()

Returns true if there is a gadget in hands.

IsGadgetInHands();

Return type: bool

SetGadgetRaisedModeWanted()

Returns true if focus will be changed to requested

SetGadgetRaisedModeWanted(bool newRaised);

Return type: bool

IsGadgetRaisedModeWanted

Returns true if character will be (or is) using gadget in raised mode

IsGadgetRaisedModeWanted();

Return type: bool

TryEquipRightHandItem()

Generic item Equippes an item in right hand, if swap is true then action performed without animations, accepts optional callback that will be triggered when action is completed

TryEquipRightHandItem(IEntity item, EEquipItemType type, bool swap = false, BaseUserAction callbackAction = null);

Return type: bool

GetRightHandItem()

Returns generic item attached to right hand. Returns null if there's none (or if active item is weapon)

GetRightHandItem();

Return type: IEntity

TryUseEquippedItem()

Try to use equipped item. return Returns true if the equipped item has been used.

TryUseEquippedItem();

Return type: bool

TryUseItem()

Try to use the specified item. param item The item which should be used. return Returns true if the item has been used.

TryUseItem(IEntity item);

Return type: bool

CanUseItem()

Returns true if the character can use an item.

CanUseItem();

Return type: bool

TryStartCharacterGesture()

Starts character gesture with specified duration in milliseconds (if duration ⇐ 0, it will be played until StopCharacterGesture is called)

TryStartCharacterGesture(int gesture, int durationMS = 0);

Return type: bool

StopCharacterGesture()

StopCharacterGesture();

Return type: void

TryPlayItemGesture()

Try to play the specified gesture. param gesture The gesture which should be played. param callbackAction Optional UserAction as callback that will be called when target animation event is hit or gesture is complete param confirmEvent return Returns true if the gesture has been played.

TryPlayItemGesture(EItemGesture gesture, BaseUserAction callbackAction = null, string confirmEvent = "");

Return type: bool

IsPlayingItemGesture()

Returns true if the character is playing a gesture.

IsPlayingItemGesture();

Return type: bool

CanPlayItemGesture()

Returns true if the character can play a gesture.

CanPlayItemGesture();

Return type: bool

CanUseLadder()

Returns true if the character can use provided ladder. if optional maxTestDistance or maxEntryAngle is below 0, distance for test will be taken from character's ladder auto detection settings

CanUseLadder(LadderComponent pLadder, float maxTestDistance = -1.0, float maxEntryAngle = -1.0, bool performTraceCheck = false);

Return type: bool

TryUseLadder()

Start climbing provided ladder. Returns true if request was successful.

TryUseLadder(LadderComponent pLadder, float maxTestDistance = -1.0, float maxEntryAngle = -1.0);

Return type: bool

RequestActionByID()

Script

RequestActionByID(int actionID, float value);

Return type: void

IsPartiallyLowered()

Returns true if the character is partially lowered.

IsPartiallyLowered();

Return type: bool

GetAimingAngles()

Returns the aiming angles in radians

GetAimingAngles();

Return type: vector

GetWeaponAngles()

Returns the weapon angles in degrees

GetWeaponAngles();

Return type: vector

GetCameraWeaponAngles()

Returns the camera weapon angles in degrees

GetCameraWeaponAngles();

Return type: vector

GetCameraWeaponOffset()

GetCameraWeaponOffset();

Return type: vector

GetLookAtAngularVelocity()

Returns the angular velocity in degrees/s

GetLookAtAngularVelocity();

Return type: vector

GetDisableMovementControls()

GetDisableMovementControls();

Return type: bool

SetDisableMovementControls()

SetDisableMovementControls(bool other);

Return type: void

GetDisableViewControls()

GetDisableViewControls();

Return type: bool

SetDisableViewControls()

SetDisableViewControls(bool other);

Return type: void

SetAimingSensitivity()

SetAimingSensitivity(float mouse, float gamepad, float ads);

Return type: void

GetAimingSensivity()

GetAimingSensivity(out float mouse, out float gamepad, out float ads);

Return type: void

SetStickyGadget()

Sets gadget handling into persistent mode
SetStickyGadget(bool enable);

Return type: void

SetStickyADS()

Sets ads and gadget focus into persistent mode

SetStickyADS(bool enable);

Return type: void

SetMaxZoomInADS()

SetMaxZoomInADS(bool enable);

Return type: void

GetMaxZoomInADS()

GetMaxZoomInADS();

Return type: bool

GetDisableWeaponControls()

GetDisableWeaponControls();

Return type: bool

SetDisableWeaponControls()

SetDisableWeaponControls(bool other);

Return type: void

GetMovementVelocity()

GetMovementVelocity();

Return type: vector

GetMovementInput()

GetMovementInput();

Return type: vector

GetVelocity()

GetVelocity();

Return type: vector

GetIsSprintingToggle()

GetIsSprintingToggle();

Return type: bool

GetLastStanceChangeDelay()

GetLastStanceChangeDelay();

Return type: float

GetCurrentMovementPhase()

GetCurrentMovementPhase();

Return type: int

GetCanFireWeapon()

GetCanFireWeapon();

Return type: bool

GetCanThrow()

GetCanThrow();

Return type: bool

SetWeaponNoFireTime()

SetWeaponNoFireTime(float t);

Return type: void

IsInThirdPersonView()

IsInThirdPersonView();

Return type: bool

SetInThirdPersonView()

SetInThirdPersonView(bool state);

Caching third person view since profiling showed minor impact on cpu time when calling in to scripted method

Return type: void

GetStanceChangeDelayTime()

GetStanceChangeDelayTime();

Return type: float

GetJumpSpeed()

GetJumpSpeed();

Return type: float

GetMeleeAttackInput()

GetMeleeAttackInput();

Return type: bool

GetPositionInView()

GetPositionInView(vector pos, float angMax);

Returns whether a position is in the character's view param pos World Position to check is within view param angMax Maximum(exclusive) angular offset in Degrees to consider the position within view

Return type: bool

GetWeaponModifiers()

GetWeaponModifiers(float baseScale, float moveScale, out vector scaleA, out vector scaleB);

Returns modifiers for weapon sway/recoil based on movement, stance, etc Fills scaleA and scaleB with following modifier values: scaleA.x - modifier scaleX scaleA.y - modifier scaleY scaleB.x - speed scale scaleB.y - translation scale

[Obsolete(“This method will be removed soon!”)]

Return type: void

CharacterStaminaComponent()

Returns locally cached stamina component or null if none.

GetStaminaComponent();

Return type: CharacterStaminaComponent

IsCharacterStationary()

Check if character is not moving and not any other locomotion related action is being performed
IsCharacterStationary();

Return type: bool

Events

OnInit()

OnInit(IEntity owner);

Called during EOnInit. param owner Entity this component is attached to.

Return type: void

OnDiag()

OnDiag(IEntity owner, float timeslice);

Called during EOnDiag. Param owner Entity this component is attached to. param timeSlice Delta time since last update.

Return type: void

OnReloaded()

OnReloaded(IEntity owner, BaseWeaponComponent weapon);

Return type: void

OnPrepareControls()

OnPrepareControls(IEntity owner, ActionManager am, float dt, bool player);

Return type: void

OnApplyControls()

OnApplyControls(IEntity owner, float timeSlice);

Return type: void

OnMeleeDamage()

OnMeleeDamage(bool started);

Handling of melee events. Sends true if melee started, false, when melee ends

GetCanMeleeAttack()

GetCanMeleeAttack();

Return type: bool

OnPerformAction()

OnPerformAction();

Override to handle what happens after pressing F button, return false to use default cpp behavior

Return type: bool

CanGetOutVehicleScript()

CanGetOutVehicleScript();

Override to handle whether character can get out of vehicle via GetOut input action

Return type: bool

OnDeath()

Handling of death

OnDeath(IEntity instigator);

Return type: void

OnGadgetStateChanged()

OnGadgetStateChanged(IEntity gadget, bool isInHand, bool isOnGround);

Will be called when gadget taken/removed from hand

Return type: void

OnGadgetFocusStateChanged()

OnGadgetFocusStateChanged(IEntity gadget, bool isFocused);

Will be called when gadget fully transitioned to or canceled focus mode

Return type: void

OnItemUseBegan()

OnItemUseBegan(IEntity item);

Will be called when item use action is started

Return type: void

OnItemUseComplete()

OnItemUseComplete(IEntity item);

Will be called when item use action is complete

Return type: void

OnAnimationEvent()

OnAnimationEvent(AnimationEventID animEventType, AnimationEventID animUserString, int intParam, float timeFromStart, float timeToEnd);

Return type: void

OnControlledByPlayer()

OnControlledByPlayer(IEntity owner, bool controlled);

Called when a player has been assigned to this controller

Return type: void

scripting/components/charactercontrollercomponent.txt · Last modified: 2022/08/10 22:40 by jerryhopper

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki