====== 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: [[scripting:datatypes#CharacterAnimationComponent]] ==== GetWeaponManagerComponent() ==== GetWeaponManagerComponent(); Return type: [[scripting:datatypes#BaseWeaponManagerComponent]] ==== GetCameraHandlerComponent() ==== GetCameraHandlerComponent(); Return type: [[scripting:datatypes#CameraHandlerComponent]] ==== GetInventoryStorageManager() ==== GetInventoryStorageManager(); Return type: [[scripting:datatypes#InventoryStorageManagerComponent]] ==== GetVONComponent() ==== GetVONComponent(); Return type: [[scripting:datatypes#VoNComponent]] ==== GetInputContext() ==== GetInputContext(); Return type: [[scripting:datatypes#CharacterInputContext]] ==== GetMovementType() ==== GetMovementType(); Return type: [[scripting:datatypes#float]] ==== SetMovement() ==== SetMovement(float type, vector movementDirLocal); Update animation about state of movement, define speed and direction in local space of character Return type: [[scripting:datatypes#void]] ==== SetHeadingAngle() ==== SetHeadingAngle(float newHeadingAngle, bool adjustAimingYaw = false); set heading angle in radians Return type: [[scripting:datatypes#void]] ==== GetHeadingAngle() ==== GetHeadingAngle(); Return type: [[scripting:datatypes#float]] ==== SetAimingAngles() ==== SetAimingAngles(float yaw, float pitch); set aiming angles in radians Return type: [[scripting:datatypes#void]] ==== GetStance() ==== GetStance(); Returns the current stance of the character. Return type: [[scripting:datatypes#ECharacterStance]] ==== GetCharacter() ==== GetCharacter(); Returns the current controlled character. Return type: [[scripting:datatypes#SCR_ChimeraCharacter]] ==== SetFireWeaponWanted() ==== SetFireWeaponWanted(bool val); Set wanted input action values Return type: [[scripting:datatypes#void]] ==== SetThrow() ==== Set wanted input action values SetThrow(bool val, bool cancelThrow); Return type: [[scripting:datatypes#void]] ==== SetMovementDirWorld() ==== Update simulation state with difference of world position SetMovementDirWorld(vector movementDirWorld); Return type: [[scripting:datatypes#void]] ==== GetMovementDirWorld() ==== GetMovementDirWorld(); Return type: [[scripting:datatypes#vector]] ==== SetWeaponRaised() ==== Set the current weapon-raised state. SetWeaponRaised(bool val); Return type: [[scripting:datatypes#void]] ==== SetWeaponADS() ==== Set the current weapon ADS state. SetWeaponADS(bool val); Return type: [[scripting:datatypes#void]] ==== SetPlayGesture() ==== Set the current play gesture state. SetPlayGesture(bool val); Return type: [[scripting:datatypes#void]] ==== SetFreeLook() ==== SetFreeLook(bool val); Return type: [[scripting:datatypes#void]] ==== ResetPersistentStates() ==== ResetPersistentStates(bool resetADSState = true, bool resetGadgetState = true); Return type: [[scripting:datatypes#void]] ==== SetDynamicSpeed() ==== Sets dynamic speed of this character. param value Desired speed as percentage <0,1>. SetDynamicSpeed(float value); Return type: [[scripting:datatypes#void]] ==== GetDynamicSpeed() ==== Returns dynamic speed value. return Dynamic speed value as <0, 1>. GetDynamicSpeed(); Return type: [[scripting:datatypes#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: [[scripting:datatypes#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: [[scripting:datatypes#bool]] ==== GetDynamicStance() ==== Returns current dynamic stance value. return Dynamic stance value as <0,1>. GetDynamicStance(); Return type: [[scripting:datatypes#float]] ==== SetInspectionMode() ==== Enables or disables inspection mode. param state Desired state true=enabled, disabled otherwise. SetInspectionMode(bool state); Return type: [[scripting:datatypes#void]] ==== CanSetInspectionMode() ==== Returns whether inspection mode can be set. return True in case inspection mode can be set, false otherwise. CanSetInspectionMode(); Return type: [[scripting:datatypes#bool]] ==== GetIsInspectionMode() ==== Returns whether character is in inspection mode. return True in case character is in inspection mode, false otherwise. GetIsInspectionMode(); Return type: [[scripting:datatypes#bool]] ==== SetInspectionState() ==== Sets inspection state if inspection state is enabled. param state Desired state. SetInspectionState(float state); Return type: [[scripting:datatypes#void]] ==== GetInspectionState() ==== Returns inspection state if inspection state is enabled. return Returns desired state. GetInspectionState(); Return type: [[scripting:datatypes#float]] ==== SetStanceChange() ==== CharacterStanceChange STANCECHANGE_NONE = 0, STANCECHANGE_TOERECTED = 1, STANCECHANGE_TOCROUCH = 2, STANCECHANGE_TOPRONE = 3 SetStanceChange(int stance); Return type: [[scripting:datatypes#void]] ==== CanChangeStance() ==== CharacterStanceChange STANCECHANGE_NONE = 0, STANCECHANGE_TOERECTED = 1, STANCECHANGE_TOCROUCH = 2, STANCECHANGE_TOPRONE = 3 CanChangeStance(int stance); Return type: [[scripting:datatypes#bool]] ==== ForceStance() ==== ForceStance(int stance); Return type: [[scripting:datatypes#void]] ==== ForceStanceUp() ==== ForceStanceUp(int stance); Return type: [[scripting:datatypes#void]] ==== SetRoll() ==== 2 - right, 1 - left SetRoll(int val); Return type: [[scripting:datatypes#void]] ==== SetJump() ==== SetJump(float val); Return type: [[scripting:datatypes#void]] ==== SetWantedLeaning() ==== SetWantedLeaning(float val); Return type: [[scripting:datatypes#void]] ==== SetBanking() ==== SetBanking(float val); Return type: [[scripting:datatypes#void]] ==== SetMeleeAttack() ==== SetMeleeAttack(bool val); Return type: [[scripting:datatypes#void]] ==== GetLeaning() ==== Either character wants to lean GetLeaning(); Return type: [[scripting:datatypes#float]] ==== GetWantedLeaning ==== GetWantedLeaning(); Return type: [[scripting:datatypes#float]] ==== IsAdjustingLeaning() ==== IsAdjustingLeaning(); Return type: [[scripting:datatypes#bool]] ==== GetCurrentLeanAmount() ==== Returns current amount of leaning applied GetCurrentLeanAmount(); Return type: [[scripting:datatypes#float]] ==== IsLeaning() ==== IsLeaning(); Return type: [[scripting:datatypes#bool]] ==== GetADSTime() ==== GetADSTime(); Return type: [[scripting:datatypes#float]] ==== IsWeaponRaised() ==== IsWeaponRaised(); Return type: [[scripting:datatypes#bool]] ==== IsWeaponObstructed() ==== IsWeaponObstructed(); Return type: [[scripting:datatypes#bool]] ==== GetObstructionAlpha() ==== GetObstructionAlpha(); Return type: [[scripting:datatypes#float]] ==== IsClimbing() ==== IsClimbing(); Return type: [[scripting:datatypes#bool]] ==== IsSwimming() ==== IsSwimming(); Return type: [[scripting:datatypes#bool]] ==== IsSprinting() ==== IsSprinting(); Return type: [[scripting:datatypes#bool]] ==== IsChangingStance() ==== IsChangingStance(); Return type: [[scripting:datatypes#bool]] ==== IsWeaponADS() ==== IsWeaponADS(); Return type: [[scripting:datatypes#bool]] ==== IsChangingFireMode() ==== IsChangingFireMode(); Return type: [[scripting:datatypes#bool]] ==== IsPlayingGesture() ==== IsPlayingGesture(); Return type: [[scripting:datatypes#bool]] ==== IsFreeLookEnabled() ==== IsFreeLookEnabled(); Return type: [[scripting:datatypes#bool]] ==== IsTrackIREnabled() ==== IsTrackIREnabled(); Return type: [[scripting:datatypes#bool]] ==== IsFocusMode() ==== IsFocusMode(); Return type: [[scripting:datatypes#bool]] ==== GetWeaponADSInput() ==== GetWeaponADSInput(); Return type: [[scripting:datatypes#bool]] ==== IsChangingItem() ==== IsChangingItem(); Return type: [[scripting:datatypes#bool]] ==== IsFalling() ==== IsFalling(); Return type: [[scripting:datatypes#bool]] ==== IsReloading() ==== IsReloading(); Return type: [[scripting:datatypes#bool]] ==== CanFire() ==== CanFire(); Return type: [[scripting:datatypes#bool]] ==== IsDead() ==== IsDead(); Return type: [[scripting:datatypes#bool]] ==== IsUsingItem() ==== IsUsingItem(); Return type: [[scripting:datatypes#bool]] ==== IsMeleeAttack() ==== IsMeleeAttack(); Return type: [[scripting:datatypes#bool]] ==== CanEngageChangeItem() ==== CanEngageChangeItem(); Return type: [[scripting:datatypes#bool]] ==== SelectWeapon() ==== Set weapon on character with switching animations. If true, the request was successful SelectWeapon(BaseWeaponComponent newWeapon); Return type: [[scripting:datatypes#bool]] ==== SetMuzzle() ==== SetMuzzle(int index); Return type: [[scripting:datatypes#bool]] ==== SetFireMode() ==== SetFireMode(int index); Return type: [[scripting:datatypes#bool]] ==== SetSightsRange() ==== SetSightsRange(int index); Return type: [[scripting:datatypes#void]] ==== SetWeaponADSInput() ==== SetWeaponADSInput(bool val); Return type: [[scripting:datatypes#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: [[scripting:datatypes#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: [[scripting:datatypes#float]] ==== ReloadWeapon() ==== Request weapon reload. If true, request was sucessful ReloadWeapon(); Return type: [[scripting:datatypes#bool]] ==== ReloadWeaponWith() ==== mag or projectile ReloadWeaponWith(IEntity ammunitionEntity); Return type: [[scripting:datatypes#bool]] ==== Ragdoll() ==== Dying Ragdoll(); Return type: [[scripting:datatypes#void]] ==== ForceDeath() ==== Kills the character. Skips invincibility checks. ForceDeath(); Return type: [[scripting:datatypes#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: [[scripting:datatypes#void]] ==== CanEquipGadget() ==== Performs gadget equip validation CanEquipGadget(IEntity gadget); Return type: [[scripting:datatypes#bool]] ==== GetAttachedGadgetAtLeftHandSlot() ==== GetAttachedGadgetAtLeftHandSlot(); Return type: [[scripting:datatypes#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: [[scripting:datatypes#bool]] ==== RemoveGadgetFromHand() ==== Remove held gadget RemoveGadgetFromHand(bool skipAnimations = false); Return type: [[scripting:datatypes#void]] ==== RecoverHiddenGadget() ==== Put held gadget on hold RecoverHiddenGadget(bool respectSettings, bool skipAnims); Return type: [[scripting:datatypes#void]] ==== IsGadgetInHands() ==== Returns true if there is a gadget in hands. IsGadgetInHands(); Return type: [[scripting:datatypes#bool]] ==== SetGadgetRaisedModeWanted() ==== Returns true if focus will be changed to requested SetGadgetRaisedModeWanted(bool newRaised); Return type: [[scripting:datatypes#bool]] ==== IsGadgetRaisedModeWanted ==== Returns true if character will be (or is) using gadget in raised mode IsGadgetRaisedModeWanted(); Return type: [[scripting:datatypes#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: [[scripting:datatypes#bool]] ==== GetRightHandItem() ==== Returns generic item attached to right hand. Returns null if there's none (or if active item is weapon) GetRightHandItem(); Return type: [[scripting:datatypes#IEntity]] ==== TryUseEquippedItem() ==== Try to use equipped item. return Returns true if the equipped item has been used. TryUseEquippedItem(); Return type: [[scripting:datatypes#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: [[scripting:datatypes#bool]] ==== CanUseItem() ==== Returns true if the character can use an item. CanUseItem(); Return type: [[scripting:datatypes#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: [[scripting:datatypes#bool]] ==== StopCharacterGesture() ==== StopCharacterGesture(); Return type: [[scripting:datatypes#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: [[scripting:datatypes#bool]] ==== IsPlayingItemGesture() ==== Returns true if the character is playing a gesture. IsPlayingItemGesture(); Return type: [[scripting:datatypes#bool]] ==== CanPlayItemGesture() ==== Returns true if the character can play a gesture. CanPlayItemGesture(); Return type: [[scripting:datatypes#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: [[scripting:datatypes#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: [[scripting:datatypes#bool]] ==== RequestActionByID() ==== Script RequestActionByID(int actionID, float value); Return type: [[scripting:datatypes#void]] ==== IsPartiallyLowered() ==== Returns true if the character is partially lowered. IsPartiallyLowered(); Return type: [[scripting:datatypes#bool]] ==== GetAimingAngles() ==== Returns the aiming angles in radians GetAimingAngles(); Return type: [[scripting:datatypes#vector]] ==== GetWeaponAngles() ==== Returns the weapon angles in degrees GetWeaponAngles(); Return type: [[scripting:datatypes#vector]] ==== GetCameraWeaponAngles() ==== Returns the camera weapon angles in degrees GetCameraWeaponAngles(); Return type: [[scripting:datatypes#vector]] ==== GetCameraWeaponOffset() ==== GetCameraWeaponOffset(); Return type: [[scripting:datatypes#vector]] ==== GetLookAtAngularVelocity() ==== Returns the angular velocity in degrees/s GetLookAtAngularVelocity(); Return type: [[scripting:datatypes#vector]] ==== GetDisableMovementControls() ==== GetDisableMovementControls(); Return type: [[scripting:datatypes#bool]] ==== SetDisableMovementControls() ==== SetDisableMovementControls(bool other); Return type: [[scripting:datatypes#void]] ==== GetDisableViewControls() ==== GetDisableViewControls(); Return type: [[scripting:datatypes#bool]] ==== SetDisableViewControls() ==== SetDisableViewControls(bool other); Return type: [[scripting:datatypes#void]] ==== SetAimingSensitivity() ==== SetAimingSensitivity(float mouse, float gamepad, float ads); Return type: [[scripting:datatypes#void]] ==== GetAimingSensivity() ==== GetAimingSensivity(out float mouse, out float gamepad, out float ads); Return type: [[scripting:datatypes#void]] ==== SetStickyGadget() ==== Sets gadget handling into persistent mode SetStickyGadget(bool enable); Return type: [[scripting:datatypes#void]] ==== SetStickyADS() ==== Sets ads and gadget focus into persistent mode SetStickyADS(bool enable); Return type: [[scripting:datatypes#void]] ==== SetMaxZoomInADS() ==== SetMaxZoomInADS(bool enable); Return type: [[scripting:datatypes#void]] ==== GetMaxZoomInADS() ==== GetMaxZoomInADS(); Return type: [[scripting:datatypes#bool]] ==== GetDisableWeaponControls() ==== GetDisableWeaponControls(); Return type: [[scripting:datatypes#bool]] ==== SetDisableWeaponControls() ==== SetDisableWeaponControls(bool other); Return type: [[scripting:datatypes#void]] ==== GetMovementVelocity() ==== GetMovementVelocity(); Return type: [[scripting:datatypes#vector]] ==== GetMovementInput() ==== GetMovementInput(); Return type: [[scripting:datatypes#vector]] ==== GetVelocity() ==== GetVelocity(); Return type: [[scripting:datatypes#vector]] ==== GetIsSprintingToggle() ==== GetIsSprintingToggle(); Return type: [[scripting:datatypes#bool]] ==== GetLastStanceChangeDelay() ==== GetLastStanceChangeDelay(); Return type: [[scripting:datatypes#float]] ==== GetCurrentMovementPhase() ==== GetCurrentMovementPhase(); Return type: [[scripting:datatypes#int]] ==== GetCanFireWeapon() ==== GetCanFireWeapon(); Return type: [[scripting:datatypes#bool]] ==== GetCanThrow() ==== GetCanThrow(); Return type: [[scripting:datatypes#bool]] ==== SetWeaponNoFireTime() ==== SetWeaponNoFireTime(float t); Return type: [[scripting:datatypes#void]] ==== IsInThirdPersonView() ==== IsInThirdPersonView(); Return type: [[scripting:datatypes#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: [[scripting:datatypes#void]] ==== GetStanceChangeDelayTime() ==== GetStanceChangeDelayTime(); Return type: [[scripting:datatypes#float]] ==== GetJumpSpeed() ==== GetJumpSpeed(); Return type: [[scripting:datatypes#float]] ==== GetMeleeAttackInput() ==== GetMeleeAttackInput(); Return type: [[scripting:datatypes#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: [[scripting:datatypes#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: [[scripting:datatypes#void]] ==== CharacterStaminaComponent() ==== Returns locally cached stamina component or null if none. GetStaminaComponent(); Return type: [[scripting:datatypes#CharacterStaminaComponent]] ==== IsCharacterStationary() ==== Check if character is not moving and not any other locomotion related action is being performed IsCharacterStationary(); Return type: [[scripting:datatypes#bool]] ===== Events ===== ==== OnInit() ==== OnInit(IEntity owner); Called during EOnInit. param owner Entity this component is attached to. Return type: [[scripting:datatypes#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: [[scripting:datatypes#void]] ==== OnReloaded() ==== OnReloaded(IEntity owner, BaseWeaponComponent weapon); Return type: [[scripting:datatypes#void]] ==== OnPrepareControls() ==== OnPrepareControls(IEntity owner, ActionManager am, float dt, bool player); Return type: [[scripting:datatypes#void]] ==== OnApplyControls() ==== OnApplyControls(IEntity owner, float timeSlice); Return type: [[scripting:datatypes#void]] ==== OnMeleeDamage() ==== OnMeleeDamage(bool started); Handling of melee events. Sends true if melee started, false, when melee ends ==== GetCanMeleeAttack() ==== GetCanMeleeAttack(); Return type: [[scripting:datatypes#bool]] ==== OnPerformAction() ==== OnPerformAction(); Override to handle what happens after pressing F button, return false to use default cpp behavior Return type: [[scripting:datatypes#bool]] ==== CanGetOutVehicleScript() ==== CanGetOutVehicleScript(); Override to handle whether character can get out of vehicle via GetOut input action Return type: [[scripting:datatypes#bool]] ==== OnDeath() ==== Handling of death OnDeath(IEntity instigator); Return type: [[scripting:datatypes#void]] ==== OnGadgetStateChanged() ==== OnGadgetStateChanged(IEntity gadget, bool isInHand, bool isOnGround); Will be called when gadget taken/removed from hand Return type: [[scripting:datatypes#void]] ==== OnGadgetFocusStateChanged() ==== OnGadgetFocusStateChanged(IEntity gadget, bool isFocused); Will be called when gadget fully transitioned to or canceled focus mode Return type: [[scripting:datatypes#void]] ==== OnItemUseBegan() ==== OnItemUseBegan(IEntity item); Will be called when item use action is started Return type: [[scripting:datatypes#void]] ==== OnItemUseComplete() ==== OnItemUseComplete(IEntity item); Will be called when item use action is complete Return type: [[scripting:datatypes#void]] ==== OnAnimationEvent() ==== OnAnimationEvent(AnimationEventID animEventType, AnimationEventID animUserString, int intParam, float timeFromStart, float timeToEnd); Return type: [[scripting:datatypes#void]] ==== OnControlledByPlayer() ==== OnControlledByPlayer(IEntity owner, bool controlled); Called when a player has been assigned to this controller Return type: [[scripting:datatypes#void]]