ScriptingExamples/PedAttackPlayer: Difference between revisions
Jump to navigation
Jump to search
(Created page with "For GTA III, Vice City, and San Andreas you can use natives or the GTAC functions to set a ped to consider something as a threat, and the ped will target/attack it.<br> {{JSCode|1= ped.setThreatSearch(1); // To make the ped target the player ped.heedThreats = true; // To enable attacking threats }} == Notes == * A list of ped [https://wiki.gtaconnected.com/Defines/III#GTA_III_-_Threat_Defines threat types for GTA 3]. Vice City threats aren't documented, but they're the...") |
No edit summary |
||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:Ped Attack Player Example}} | |||
For GTA III, Vice City, and San Andreas you can use natives or the GTAC functions to set a ped to consider something as a threat, and the ped will target/attack it.<br> | For GTA III, Vice City, and San Andreas you can use natives or the GTAC functions to set a ped to consider something as a threat, and the ped will target/attack it.<br> | ||
{{JSCode|1= | {{JSCode|1= |
Revision as of 05:34, 5 September 2025
For GTA III, Vice City, and San Andreas you can use natives or the GTAC functions to set a ped to consider something as a threat, and the ped will target/attack it.
ped.setThreatSearch(1); // To make the ped target the player
ped.heedThreats = true; // To enable attacking threats
Notes
- A list of ped threat types for GTA 3. Vice City threats aren't documented, but they're the same except for the gangs.
- You can define multiple threats separated by a bitwise OR. Example:
ped.setThreatSearch(1|64|1048576)
would make the ped attack the player, cops, and anybody else that has a gun. - For attacking players, the ped will only attack it's syncer. If you need to change the player that the ped attacks, change the syncer then send a network event to the new syncer to tell it to set the player as a threat to update it.
- If you set a ped's threat but the ped.heedThreats is disabled (false), the ped will NOT attack threats.