Player::taskGoToCoordAndAimAtHatedEntitiesNearCoord
The ped will walk or run towards goToLocation, aiming towards goToLocation or focusLocation (depending on the aimingFlag) and shooting if shootAtEnemies = true to any enemy in his path.
If the ped is closer than noRoadsDistance, the ped will ignore pathing/navmesh and go towards goToLocation directly. This could cause the ped to get stuck behind tall walls if the goToLocation is on the other side. To avoid this, use 0.0f and the ped will always use pathing/navmesh to reach his destination.
If the speed is set to 0.0f, the ped will just stand there while aiming, if set to 1.0f he will walk while aiming, 2.0f will run while aiming.
The ped will stop aiming when he is closer than distanceToStopAt to goToLocation.
I still can't figure out what unkTrue is used for. I don't notice any difference if I set it to false but in the decompiled scripts is always true.
I think that unkFlag, like the driving styles, could be a flag that 'work as a list of 32 bits converted to a decimal integer. Each bit acts as a flag, and enables or disables a function'. What leads me to this conclusion is the fact that in the decompiled scripts, unkFlag takes values like: 0, 1, 5 (101 in binary) and 4097 (4096 + 1 or 1000000000001 in binary). For now, I don't know what behavior enable or disable this possible flag so I leave it at 0.
Note: After some testing, using unkFlag = 16 (0x10) enables the use of sidewalks while moving towards goToLocation.
The aimingFlag takes 2 values: 0 to aim at the focusLocation, 1 to aim at where the ped is heading (goToLocation).
Example:
enum AimFlag
{
AimAtFocusLocation,
AimAtGoToLocation
};
Vector3 goToLocation1 = { 996.2867f, 0, -2143.044f, 0, 28.4763f, 0 }; // remember the padding.
Vector3 goToLocation2 = { 990.2867f, 0, -2140.044f, 0, 28.4763f, 0 }; // remember the padding.
Vector3 focusLocation = { 994.3478f, 0, -2136.118f, 0, 29.2463f, 0 }; // the coord z should be a little higher, around +1.0f to avoid aiming at the ground
// 1st example
Player::TASK_GO_TO_COORD_AND_AIM_AT_HATED_ENTITIES_NEAR_COORD(pedHandle, goToLocation1.x, goToLocation1.y, goToLocation1.z, focusLocation.x, focusLocation.y, focusLocation.z, 2.0f /*run*/, true /*shoot*/, 3.0f /*stop at*/, 0.0f /*noRoadsDistance*/, true /*always true*/, 0 /*possible flag*/, AimFlag::AimAtGoToLocation, -957453492 /*FullAuto pattern*/);
// 2nd example
Player::TASK_GO_TO_COORD_AND_AIM_AT_HATED_ENTITIES_NEAR_COORD(pedHandle, goToLocation2.x, goToLocation2.y, goToLocation2.z, focusLocation.x, focusLocation.y, focusLocation.z, 1.0f /*walk*/, false /*don't shoot*/, 3.0f /*stop at*/, 0.0f /*noRoadsDistance*/, true /*always true*/, 0 /*possible flag*/, AimFlag::AimAtFocusLocation, -957453492 /*FullAuto pattern*/);
1st example: The ped (pedhandle) will run towards goToLocation1. While running and aiming towards goToLocation1, the ped will shoot on sight to any enemy in his path, using 'FullAuto' firing pattern. The ped will stop once he is closer than distanceToStopAt to goToLocation1.
2nd example: The ped will walk towards goToLocation2. This time, while walking towards goToLocation2 and aiming at focusLocation, the ped will point his weapon on sight to any enemy in his path without shooting. The ped will stop once he is closer than distanceToStopAt to goToLocation2.
- Skru
Syntax
player.taskGoToCoordAndAimAtHatedEntitiesNearCoord(gotoX, gotoY, gotoZ, aimNearX, aimNearY, aimNearZ, speed, shoot, unknown1, unknown2, unkTrue, unknown3, heading, firingPattern);
Required Arguments
- gotoX: float
- gotoY: float
- gotoZ: float
- aimNearX: float
- aimNearY: float
- aimNearZ: float
- speed: float
- shoot: Boolean
- unknown1: float
- unknown2: float
- unkTrue: Boolean
- unknown3: int
- heading: Boolean
- firingPattern: Model hash or name
Return value
- Undefined
Example
// todo
See also
- Functions:
- Player.addArmourTo
- Player.addVehicleSubtaskAttackCoord
- Player.addVehicleSubtaskAttack
- Player.applyBloodByZone
- Player.applyBloodDamageByZone
- Player.applyBloodSpecific
- Player.applyBlood
- Player.applyDamageDecal
- Player.applyDamagePack
- Player.applyDamageTo
- Player.call
- Player.canInCombatSeeTarget
- Player.canKnockOffVehicle
- Player.canRagdoll
- Player.clearAllProps
- Player.clearAlternateMovementAnim
- Player.clearBloodDamageByZone
- Player.clearBloodDamage
- Player.clearDamageDecalByZone
- Player.clearDecorations
- Player.clearDriveByClipsetOverride
- Player.clearDrivebyTaskUnderneathDrivingTask
- Player.clearFacialDecorations
- Player.clearFacialIdleAnimOverride
- Player.clearLastDamageBone
- Player.clearProp
- Player.clearSecondaryTask
- Player.clearTasksImmediately
- Player.clearTasks
- Player.clearWetness
- Player.cloneToTarget
- Player.clone
- Player.controlMountedWeapon
- Player.explodeHead
- Player.forceMotionState
- Player.forceToOpenParachute
- Player.getAccuracy
- Player.getAlertness
- Player.getAmmoInClip
- Player.getArmour
- Player.getBoneCoords
- Player.getBoneIndex
- Player.getCauseOfDeath
- Player.getCombatFloat
- Player.getCombatMovement
- Player.getCombatRange
- Player.getConfigFlag
- Player.getCurrentScenarioId
- Player.getCurrentScriptedAnim
- Player.getDeadPickupCoords
- Player.getDecorationsState
- Player.getDefensiveAreaPosition
- Player.getDesiredMoveBlendRatio
- Player.getDrawableVariation
- Player.getEnveffScale
- Player.getExtractedDisplacement
- Player.getFloodInvincibility
- Player.getGroupIndex
- Player.getHeadBlendData
- Player.getHeadOverlayValue
- Player.getIsTaskActive
- Player.getJackTarget
- Player.getLastDamageBone
- Player.getMaxHealth
- Player.getMeleeTargetFor
- Player.getMoney
- Player.getMount
- Player.getNavmeshRouteDistanceRemaining
- Player.getNearbyPeds
- Player.getNearbyVehicles
- Player.getNumberOfDrawableVariations
- Player.getNumberOfPropDrawableVariations
- Player.getNumberOfPropTextureVariations
- Player.getNumberOfTextureVariations
- Player.getPaletteVariation
- Player.getParachuteLandingType
- Player.getParachuteState
- Player.getParachuteTintIndex
- Player.getPhoneGestureAnimCurrentTime
- Player.getPhoneGestureAnimTotalTime
- Player.getPlayerIsFollowing
- Player.getPropIndex
- Player.getPropTextureIndex
- Player.getRagdollBoneIndex
- Player.getRelationshipBetweens
- Player.getRelationshipGroupDefaultHash
- Player.getRelationshipGroupHash
- Player.getResetFlag
- Player.getScriptTaskStatus
- Player.getSeatIsTryingToEnter
- Player.getSequenceProgress
- Player.getSourceOfDeath
- Player.getStealthMovement
- Player.getTextureVariation
- Player.getTimeOfDeath
- Player.getType
- Player.getVehicleIsIn
- Player.getVehicleIsTryingToEnter
- Player.getVehicleIsUsing
- Player.getsJacker
- Player.giveHelmet
- Player.giveNmMessage
- Player.hasHeadBlendFinished
- Player.hasUseScenarioTask
- Player.hideBloodDamageByZone
- Player.isAPlayer
- Player.isActiveInScenario
- Player.isAimingFromCover
- Player.isBeingArrested
- Player.isBeingJacked
- Player.isBeingStealthKilled
- Player.isBeingStunned
- Player.isClimbing
- Player.isComponentVariationValid
- Player.isConversationDead
- Player.isCuffed
- Player.isDeadOrDying
- Player.isDiving
- Player.isDoingDriveby
- Player.isDrivebyTaskUnderneathDrivingTask
- Player.isDucking
- Player.isEvasiveDiving
- Player.isFacingPed
- Player.isFalling
- Player.isFatallyInjured
- Player.isFleeing
- Player.isGettingIntoAVehicle
- Player.isGettingUp
- Player.isGoingIntoCover
- Player.isGroupMember
- Player.isHangingOnToVehicle
- Player.isHeadtrackingPed
- Player.isHeadtracking
- Player.isHuman
- Player.isHurt
- Player.isInAnyBoat
- Player.isInAnyHeli
- Player.isInAnyPlane
- Player.isInAnyPoliceVehicle
- Player.isInAnySub
- Player.isInAnyTaxi
- Player.isInAnyTrain
- Player.isInAnyVehicle
- Player.isInCombat
- Player.isInCoverFacingLeft
- Player.isInCover
- Player.isInFlyingVehicle
- Player.isInGroup
- Player.isInMeleeCombat
- Player.isInModel
- Player.isInParachuteFreeFall
- Player.isInVehicle
- Player.isInWrithe
- Player.isInjured
- Player.isJacking
- Player.isJumpingOutOfVehicle
- Player.isJumping
- Player.isMale
- Player.isModel
- Player.isMountedWeaponTaskUnderneathDrivingTask
- Player.isMoveBlendRatioRunning
- Player.isMoveBlendRatioSprinting
- Player.isMoveBlendRatioStill
- Player.isMoveBlendRatioWalking
- Player.isOnAnyBike
- Player.isOnFoot
- Player.isOnMount
- Player.isOnSpecificVehicle
- Player.isOnVehicle
- Player.isPerformingStealthKill
- Player.isPlantingBomb
- Player.isPlayingPhoneGestureAnim
- Player.isProne
- Player.isPropValid
- Player.isRagdoll
- Player.isReloading
- Player.isRunningArrestTask
- Player.isRunningMobilePhoneTask
- Player.isRunningRagdollTask
- Player.isRunning
- Player.isScriptedScenarioUsingConditionalAnim
- Player.isShootingInArea
- Player.isShooting
- Player.isSittingInAnyVehicle
- Player.isSittingInVehicle
- Player.isSprinting
- Player.isStill
- Player.isStopped
- Player.isStrafing
- Player.isSwimmingUnderWater
- Player.isSwimming
- Player.isTrackedVisible
- Player.isTracked
- Player.isTryingToEnterALockedVehicle
- Player.isUsingActionMode
- Player.isUsingAnyScenario
- Player.isUsingScenario
- Player.isVaulting
- Player.isWalking
- Player.isWearingHelmet
- Player.knockOffProp
- Player.knockOffVehicle
- Player.playAnimOnRunningScenario
- Player.playFacialAnim
- Player.registerHatedTargetsAround
- Player.registerTarget
- Player.registerheadshot
- Player.removeDefensiveArea
- Player.removeFromGroup
- Player.removeHelmet
- Player.removePreferredCoverSet
- Player.removeVoiceFx
- Player.resetInVehicleContext
- Player.resetLastVehicle
- Player.resetMovementClipset
- Player.resetRagdollTimer
- Player.resetStrafeClipset
- Player.resetVisibleDamage
- Player.resetVoiceFx
- Player.resetWeaponMovementClipset
- Player.resurrect
- Player.reviveInjured
- Player.setAccuracy
- Player.setAlertness
- Player.setAllowVehiclesOverride
- Player.setAllowedToDuck
- Player.setAlternateMovementAnim
- Player.setAmmoInClip
- Player.setAngledDefensiveArea
- Player.setArmour
- Player.setAsCop
- Player.setAsEnemy
- Player.setAsGroupLeader
- Player.setAsGroupMember
- Player.setBlendFromParents
- Player.setBlockingOfNonTemporaryEvents
- Player.setBoundsOrientation
- Player.setCanArmIk
- Player.setCanAttackFriendly
- Player.setCanBeDraggedOut
- Player.setCanBeKnockedOffVehicle
- Player.setCanBeShotInVehicle
- Player.setCanBeTargetedWhenInjured
- Player.setCanBeTargetedWithoutLos
- Player.setCanBeTargettedByPlayer
- Player.setCanBeTargettedByTeam
- Player.setCanBeTargetted
- Player.setCanCowerInCover
- Player.setCanEvasiveDive
- Player.setCanHeadIk
- Player.setCanLegIk
- Player.setCanPeekInCover
- Player.setCanPlayAmbientAnims
- Player.setCanPlayAmbientBaseAnims
- Player.setCanPlayGestureAnims
- Player.setCanPlayVisemeAnims
- Player.setCanRagdollFromPlayerImpact
- Player.setCanRagdoll
- Player.setCanSmashGlass
- Player.setCanSwitchWeapon
- Player.setCanTeleportToGroupLeader
- Player.setCanTorsoIk
- Player.setCanUseAutoConversationLookat
- Player.setCapsule
- Player.setCombatAbility
- Player.setCombatAttributes
- Player.setCombatFloat
- Player.setCombatMovement
- Player.setCombatRange
- Player.setComponentVariation
- Player.setConfigFlag
- Player.setCoordsKeepVehicle
- Player.setCoordsNoGang
- Player.setCowerHash
- Player.setDecoration
- Player.setDefaultComponentVariation
- Player.setDefensiveAreaAttachedToPed
- Player.setDefensiveAreaDirection
- Player.setDefensiveSphereAttachedToPed
- Player.setDesiredHeading
- Player.setDesiredMoveBlendRatio
- Player.setDiesInSinkingVehicle
- Player.setDiesInVehicle
- Player.setDiesInWater
- Player.setDiesInstantlyInWater
- Player.setDiesWhenInjured
- Player.setDriveByClipsetOverride
- Player.setDriveTaskCruiseSpeed
- Player.setDriveTaskDrivingStyle
- Player.setDriverAbility
- Player.setDriverAggressiveness
- Player.setDucking
- Player.setEnableBoundAnkles
- Player.setEnableEnveffScale
- Player.setEnableHandcuffs
- Player.setEnableScuba
- Player.setEnableWeaponBlocking
- Player.setEnveffScale
- Player.setExclusivePhoneRelationships
- Player.setEyeColor
- Player.setFaceFeature
- Player.setFacialDecoration
- Player.setFacialIdleAnimOverride
- Player.setFiringPattern
- Player.setFleeAttributes
- Player.setGeneratesDeadBodyEvents
- Player.setGestureGroup
- Player.setGetOutUpsideDownVehicle
- Player.setGravity
- Player.setGroupMemberPassengerIndex
- Player.setHairColor
- Player.setHeadBlendData
- Player.setHeadOverlayColor
- Player.setHeadOverlay
- Player.setHearingRange
- Player.setHelmetFlag
- Player.setHelmetPropIndex
- Player.setHelmetTextureIndex
- Player.setHelmet
- Player.setHighFallTask
- Player.setIdRange
- Player.setIkTarget
- Player.setInVehicleContext
- Player.setIntoVehicle
- Player.setKeepTask
- Player.setLegIkMode
- Player.setLodMultiplier
- Player.setMaxHealth
- Player.setMaxMoveBlendRatio
- Player.setMaxTimeInWater
- Player.setMaxTimeUnderwater
- Player.setMinGroundTimeForStungun
- Player.setMinMoveBlendRatio
- Player.setModelIsSuppressed
- Player.setMoney
- Player.setMotionBlur
- Player.setMountedWeaponTarget
- Player.setMoveAnimsBlendOut
- Player.setMoveRateOverride
- Player.setMovementClipset
- Player.setNameDebug
- Player.setNeverLeavesGroup
- Player.setParachuteTaskTarget
- Player.setParachuteTaskThrust
- Player.setParachuteTintIndex
- Player.setPathAvoidFire
- Player.setPathCanDropFromHeight
- Player.setPathCanUseClimbovers
- Player.setPathCanUseLadders
- Player.setPathPreferToAvoidWater
- Player.setPathsWidthPlant
- Player.setPinnedDown
- Player.setPlaysHeadOnHornAnimWhenDiesInVehicle
- Player.setPreferredCoverSet
- Player.setPrimaryLookat
- Player.setPropIndex
- Player.setRagdollFlag
- Player.setRagdollForceFall
- Player.setRagdollOnCollision
- Player.setRandomComponentVariation
- Player.setRandomProps
- Player.setRelationshipGroupDefaultHash
- Player.setRelationshipGroupHash
- Player.setResetFlag
- Player.setResetRagdollFlag
- Player.setScriptedAnimSeatOffset
- Player.setSeeingRange
- Player.setShootRate
- Player.setShootsAtCoord
- Player.setSphereDefensiveArea
- Player.setStayInVehicleWhenJacked
- Player.setStealthMovement
- Player.setSteersAroundObjects
- Player.setSteersAroundPeds
- Player.setSteersAroundVehicles
- Player.setStrafeClipset
- Player.setSuffersCriticalHits
- Player.setSweat
- Player.setTargetLossResponse
- Player.setTaskVehicleChaseBehaviorFlag
- Player.setTaskVehicleChaseIdealPursuitDistance
- Player.setToInformRespectedFriends
- Player.setToLoadCover
- Player.setToRagdoll
- Player.setUsingActionMode
- Player.setVisualFieldCenterAngle
- Player.setVisualFieldMaxAngle
- Player.setVisualFieldMaxElevationAngle
- Player.setVisualFieldMinAngle
- Player.setVisualFieldMinElevationAngle
- Player.setVisualFieldPeripheralRange
- Player.setVoiceFx
- Player.setVoiceFxBQF
- Player.setVoiceFxChorus
- Player.setVoiceFxCompressor
- Player.setVoiceFxDistortion
- Player.setVoiceFxEcho
- Player.setVoiceFxFlanger
- Player.setVoiceFxGargle
- Player.setVoiceFxI3DL2Reverb
- Player.setVoiceFxParamEq
- Player.setVoiceFxPeakEq
- Player.setVoiceFxReverb
- Player.setVoiceFxVolume
- Player.setWeaponMovementClipset
- Player.setWetnessEnabledThisFrame
- Player.setWetnessHeight
- Player.stopAnimPlayback
- Player.stopAnimTask
- Player.stopWeaponFiringWhenDropped
- Player.taskAchieveHeading
- Player.taskAimGunAtCoord
- Player.taskAimGunAt
- Player.taskAimGunScripted
- Player.taskArrest
- Player.taskBoatMission
- Player.taskChatTo
- Player.taskClearLookAt
- Player.taskClimbLadder
- Player.taskClimb
- Player.taskCombatHatedTargetsAround
- Player.taskCombatHatedTargetsInArea
- Player.taskCombat
- Player.taskCower
- Player.taskDriveBy
- Player.taskEnterVehicle
- Player.taskFollowNavMeshToCoordAdvanced
- Player.taskFollowNavMeshToCoord
- Player.taskFollowPointRoute
- Player.taskFollowToOffsetOf
- Player.taskForceMotionState
- Player.taskGetOffBoat
- Player.taskGoStraightToCoord
- Player.taskGoToCoordAndAimAtHatedEntitiesNearCoord
- Player.taskGoToCoordAnyMeansExtraParamsWithCruiseSpeed
- Player.taskGoToCoordAnyMeansExtraParams
- Player.taskGoToCoordAnyMeans
- Player.taskGoToCoordWhileAimingAtCoord
- Player.taskGoToWhileAimingAt
- Player.taskGotoAiming
- Player.taskGotoOffset
- Player.taskGuardCurrentPosition
- Player.taskGuardSphereDefensiveArea
- Player.taskHandsUp
- Player.taskHeliChase
- Player.taskHeliMission
- Player.taskJump
- Player.taskLeaveAnyVehicle
- Player.taskLeaveVehicle
- Player.taskLookAt
- Player.taskMoveNetworkAdvanced
- Player.taskMoveNetwork
- Player.taskOpenVehicleDoor
- Player.taskParachuteToTarget
- Player.taskParachute
- Player.taskPatrol
- Player.taskPause
- Player.taskPerformSequence
- Player.taskPlaneChase
- Player.taskPlaneLand
- Player.taskPlaneMission
- Player.taskPlantBomb
- Player.taskPlayAnimAdvanced
- Player.taskPlayAnim
- Player.taskPlayPhoneGestureAnimation
- Player.taskPutDirectlyIntoCover
- Player.taskPutDirectlyIntoMelee
- Player.taskRappelFromHeli
- Player.taskReactAndFlee
- Player.taskReloadWeapon
- Player.taskScriptedAnim
- Player.taskScriptedAnimation
- Player.taskSeekCoverFrom
- Player.taskSeekCoverToCoords
- Player.taskSetBlockingOfNonTemporaryEvents
- Player.taskSetDecisionMaker
- Player.taskShockingEventReact
- Player.taskShootAtCoord
- Player.taskShuffleToNextVehicleSeat
- Player.taskSkyDive
- Player.taskSlideToCoordHdgRate
- Player.taskSlideToCoord
- Player.taskSmartFleeCoord
- Player.taskSmartFlee
- Player.taskStandGuard
- Player.taskStandStill
- Player.taskStartScenarioAtPosition
- Player.taskStartScenarioInPlace
- Player.taskStayInCover
- Player.taskStealthKill
- Player.taskStopPhoneGestureAnimation
- Player.taskSwapWeapon
- Player.taskSweepAim
- Player.taskSynchronizedScene
- Player.taskTurnToFaceCoord
- Player.taskTurnToFace
- Player.taskUseMobilePhoneTimed
- Player.taskUseMobilePhone
- Player.taskUseNearestScenarioToCoordWarp
- Player.taskVehicleAimAt
- Player.taskVehicleChase
- Player.taskVehicleDriveToCoordLongrange
- Player.taskVehicleDriveToCoord
- Player.taskVehicleDriveWander
- Player.taskVehicleEscort
- Player.taskVehicleFollowWaypointRecording
- Player.taskVehicleFollow
- Player.taskVehicleGotoNavmesh
- Player.taskVehicleHeliProtect
- Player.taskVehicleMissionCoorsTarget
- Player.taskVehicleMissionTarget
- Player.taskVehiclePark
- Player.taskVehicleShootAt
- Player.taskVehicleTempAction
- Player.taskWanderInArea
- Player.taskWanderStandard
- Player.taskWarpIntoVehicle
- Player.taskWrithe
- Player.uncuff
- Player.unregisterheadshot
- Player.updateHeadBlendData
- Player.updateTaskAimGunScriptedTarget
- Player.updateTaskHandsUpDuration
- Player.updateTaskSweepAim
- Player.wasKilledByStealth
- Player.wasKilledByTakedown
- Player.wasSkeletonUpdated
- Properties: