Advertisement
RanggaBS

NPC Full Fighting Style

Dec 1st, 2021 (edited)
443
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 25.69 KB | None | 0 0
  1. --[[
  2.     NPC Full Fighting Style v1.2
  3.     Author: RBS ID
  4. ]]
  5.  
  6. -- Change the value of this variables to true / false. true = enable the exclusive throwing node, false = disable
  7. local garyBricksThrow = true
  8. local darbyBottlesThrow = true
  9. local tedWftbombsThrow = true
  10.  
  11. --local nortonHP;
  12. --local fattyHP;
  13.  
  14. function LoadAnims()
  15.     local animGroup, actionTree = {
  16.         --[["Authority",]] "Boxing", "B_Striker", --[["CV_Female", "CV_Male",]] "DO_Edgar", "DO_Grap", "DO_StrikeCombo", "DO_Striker", "Earnest",
  17.         --[["F_Adult",]] "F_BULLY", "F_Crazy", "F_Douts", "F_Girls", "F_Greas", "F_Jocks", "F_Nerds", --[["F_OldPeds", "F_Pref",]]
  18.         "F_Preps", "G_Grappler", "G_Johnny", "G_Striker", "Grap", "J_Damon", "J_Grappler", "J_Melee", "J_Ranged", "J_Striker",
  19.         --[["LE_Orderly",]] "Nemesis", "NPC_Mascot", "N_Ranged", "N_Striker", "N_Striker_A", "N_Striker_B", "P_Grappler", "P_Striker", --"PunchBag",
  20.         "Qped", --[["RAT_PED",]] "Russell", "Russell_Pbomb", "Straf_Dout", "Straf_Fat", "Straf_Female", "Straf_Male", "Straf_Nerd", "Straf_Prep",
  21.         "Straf_Savage", "Straf_Wrest", --[["TE_Female",]] "Ambient", "Ambient2", "Ambient3", "N2B Dishonerable", "MINI_React"
  22.     }, {
  23.         "Act/AI/AI_BOXER.act", "Act/Anim/BoxingPlayer.act", "Act/AI/AI_RUSSEL_1_B.act", "Act/Anim/BOSS_Darby.act", "Act/AI/AI_MASCOT_4_05.act",
  24.         "Act/Anim/DO_Edgar.act", "Act/AI/AI_EDGAR_5_B.act", "Act/Conv/5_B.act", "Act/AI/AI_Gary.act", "Act/AI/AI_Norton.act", "Act/Anim/3_05_Norton.act"
  25.     }
  26.     for i, v in ipairs(animGroup) do
  27.         --if not HasAnimGroupLoaded(v) then
  28.             LoadAnimationGroup(v)
  29.         --end
  30.     end
  31.     for i, v in ipairs(actionTree) do
  32.         LoadActionTree(v)
  33.     end
  34. end
  35.  
  36. function T_NPC_Full_Fighting_Style()
  37.     while true do
  38.         Wait(0)
  39.         for doi, ped in {PedFindInAreaXYZ(0, 0, 0, 999)} do
  40.             if PedIsValid(ped) and ped ~= gPlayer then
  41.  
  42.                 -- Russell:
  43.                 if PedIsModel(ped, 75) or PedIsModel(ped, 176) then
  44.                     if not MissionActiveSpecific("1_B") then
  45.                         if PedIsInCombat(ped) then
  46.                             if DistanceBetweenPeds2D(ped, PedGetTargetPed(ped)) >= 3 then
  47.                                 if PedMePlaying(ped, "Default_KEY") and not PedIsPlaying(ped, "/Global/B_Striker_A", true) and not PedIsDoingTask(ped, "/Global/AI", true) and PedHasWeapon(ped, -1) then
  48.                                     PedSetActionTree(ped, "/Global/B_Striker_A", "Act/Anim/B_Striker_A.act")
  49.                                     PedSetAITree(ped, "/Global/AI", "Act/AI/AI.act")
  50.                                 end
  51.                             else
  52.                                 if PedMePlaying(ped, "Default_KEY") and not PedIsPlaying(ped, "/Global/BOSS_Russell", true) and not PedIsDoingTask(ped, "/Global/RusselAI", true) and PedHasWeapon(ped, -1) then
  53.                                     PedSetActionTree(ped, "/Global/BOSS_Russell", "Act/Anim/BOSS_Russell.act")
  54.                                     PedSetAITree(ped, "/Global/RusselAI", "Act/AI/AI_RUSSEL_1_B.act")
  55.                                 end
  56.                                 FightingSpeech(ped)
  57.                                 if PedMePlaying(ped, "Default_KEY") and not SoundSpeechPlaying(ped) and math.random(400) < 4 then
  58.                                     --local russellSpeech = math.random(2)
  59.                                     --if russellSpeech == 1 then
  60.                                         local russellSpeechM_1_B = {2, 3, 5, 7--[[2, 8, 10, 12]]}
  61.                                         SoundPlayScriptedSpeechEvent(ped, "M_1_B", russellSpeechM_1_B[math.random(table.getn(russellSpeechM_1_B))], "large")
  62.                                     --else
  63.                                         --SoundPlay3D(PedGetPosXYZ(ped), math.random(2) == 1 and "RUSS_CHARGE" or "RUSS_ROAR")
  64.                                     --end
  65.                                 end
  66.                             end
  67.                         else
  68.                             if PedMePlaying(ped, "Default_KEY") and not PedIsPlaying(ped, "/Global/B_Striker_A", true) and not PedIsDoingTask(ped, "/Global/AI", true) and PedHasWeapon(ped, -1) then
  69.                                 PedSetActionTree(ped, "/Global/B_Striker_A", "Act/Anim/B_Striker_A.act")
  70.                                 PedSetAITree(ped, "/Global/AI", "Act/AI/AI.act")
  71.                             end
  72.                         end
  73.                     end
  74.                 end
  75.                
  76.                 -- Darby:
  77.                 if PedIsModel(ped, 37) or PedIsModel(ped, 218) then
  78.                     if not MissionActiveSpecific("2_B") then
  79.                         if PedMePlaying(ped, "Default_KEY") and not PedIsPlaying(ped, "/Global/BOSS_Darby", true) and PedHasWeapon(ped, -1) then
  80.                             PedSetActionTree(ped, "/Global/BOSS_Darby", "Act/Anim/BOSS_Darby.act")
  81.                         end
  82.                         if GameGetPedStat(ped, 17) ~= "Generic" then
  83.                             PedOverrideStat(ped, 17, "Generic")
  84.                         end
  85.                         if PedIsInCombat(ped) then
  86.                             if PedMePlaying(ped, "Default_KEY") and not PedIsDoingTask(ped, "/Global/DarbyAI", true) then
  87.                                 PedSetAITree(ped, "/Global/DarbyAI", "Act/AI/AI_DARBY_2_B.act")
  88.                             end
  89.                             if DistanceBetweenPeds2D(ped, PedGetTargetPed(ped)) < 3 and PedMePlaying(ped, "Default_KEY") and math.random(450) < 4 then
  90.                                 local darbyNodes, darbyNodes_rand = {
  91.                                     {"/Global/BOSS_Darby/Offense/Special/Dash/Dash/Uppercut/ShortDarby", "Act/Anim/BOSS_Darby.act"},
  92.                                     {"/Global/BOSS_Darby/Defense/Evade/EvadeDuck/HeavyAttacks/EvadeDuckPunch", "Act/Anim/BOSS_Darby.act"},
  93.                                     {"/Global/BOSS_Darby/Defense/Evade/EvadeLeft/HeavyAttacks/EvadeRightPunch", "Act/Anim/BOSS_Darby.act"},
  94.                                     {"/Global/BOSS_Darby/Defense/Evade/EvadeRight/HeavyAttacks/EvadeLeftPunch", "Act/Anim/BOSS_Darby.act"}
  95.                                 }, math.random(4)
  96.                                 PedSetActionNode(ped, darbyNodes[darbyNodes_rand][1], darbyNodes[darbyNodes_rand][2])
  97.                             end
  98.                             if darbyBottlesThrow and DistanceBetweenPeds2D(ped, PedGetTargetPed(ped)) >= 3 and PedMePlaying(ped, "Default_KEY") and math.random(500) <= 5 then
  99.                                 PedSetActionNode(ped, "/Global/BOSS_Darby/Special/Throw", "Act/Anim/BOSS_Darby.act")
  100.                             end
  101.                             FightingSpeech(ped)
  102.                             if PedMePlaying(ped, "Default_KEY") and not SoundSpeechPlaying(ped) and math.random(400) < 4 then
  103.                                 SoundPlayScriptedSpeechEvent(ped, "M_2_B", 14, "large")
  104.                             end
  105.                         else
  106.                             if PedMePlaying(ped, "Default_KEY") and not PedIsDoingTask(ped, "/Global/AI", true) then
  107.                                 PedSetAITree(ped, "/Global/AI", "Act/AI/AI.act")
  108.                             end
  109.                             if PedHasWeapon(ped, 327) then
  110.                                 PedDestroyWeapon(ped, 327)
  111.                             end
  112.                         end
  113.                     end
  114.                 end
  115.  
  116.                 -- Bif (boxing outfit):
  117.                 if PedIsModel(ped, 133) or PedIsModel(ped, 172) or PedIsModel(ped, 243) then
  118.                     if not MissionActiveSpecific("2_09") then
  119.                         if PedIsInCombat(ped) then
  120.                             if DistanceBetweenPeds2D(ped, PedGetTargetPed(ped)) <= 2 then
  121.                                 if PedMePlaying(ped, "Default_KEY") and not PedIsPlaying(ped, "/Global/P_Bif", true) and not PedIsDoingTask(ped, "/Global/AI_BOXER", true) and PedHasWeapon(ped, -1) then
  122.                                     PedSetActionTree(ped, "/Global/P_Bif", "Act/Anim/P_Bif.act")
  123.                                     PedSetAITree(ped, "/Global/AI_BOXER", "Act/AI/AI_BOXER.act")
  124.                                 end
  125.                                 FightingSpeech(ped) -- Not working for damaged face boxer
  126.                             else
  127.                                 if PedMePlaying(ped, "Default_KEY") and not PedIsPlaying(ped, "/Global/P_Striker_A", true) and not PedIsDoingTask(ped, "/Global/AI", true) and PedHasWeapon(ped, -1) then
  128.                                     PedSetActionTree(ped, "/Global/P_Striker_A", "Act/Anim/P_Striker_A.act")
  129.                                     PedSetAITree(ped, "/Global/AI", "Act/AI/AI.act")
  130.                                 end
  131.                             end
  132.                         else
  133.                             if PedMePlaying(ped, "Default_KEY") and not PedIsPlaying(ped, "/Global/P_Striker_A", true) and not PedIsDoingTask(ped, "/Global/AI", true) and PedHasWeapon(ped, -1) then
  134.                                 PedSetActionTree(ped, "/Global/P_Striker_A", "Act/Anim/P_Striker_A.act")
  135.                                 PedSetAITree(ped, "/Global/AI", "Act/AI/AI.act")
  136.                             end
  137.                         end
  138.                     end
  139.                 end
  140.            
  141.                 -- Justin & Parker (boxing outfit):
  142.                 if PedIsModel(ped, 118) or PedIsModel(ped, 119) or PedIsModel(ped, 244) or PedIsModel(ped, 245) or PedIsModel(ped, 246) or PedIsModel(ped, 247) then
  143.                     if not MissionActiveSpecific2("2_R11_Justin") and not MissionActiveSpecific2("2_R11_Parker") and not MissionActiveSpecific2("2_R11_Random") and not MissionActiveSpecific("3_R09_P3") then
  144.                         if PedIsInCombat(ped) then
  145.                             if DistanceBetweenPeds2D(ped, PedGetTargetPed(ped)) <= 2 then
  146.                                 if PedMePlaying(ped, "Default_KEY") and not PedIsPlaying(ped, "/Global/P_Bif", true) and not PedIsDoingTask(ped, "/Global/AI_BOXER", true) and PedHasWeapon(ped, -1) then
  147.                                     PedSetActionTree(ped, "/Global/P_Bif", "Act/Anim/P_Bif.act")
  148.                                     PedSetAITree(ped, "/Global/AI_BOXER", "Act/AI/AI_BOXER.act")
  149.                                 end
  150.                                 FightingSpeech(ped) -- Not working for damaged face boxer
  151.                             else
  152.                                 if PedMePlaying(ped, "Default_KEY") and not PedIsPlaying(ped, "/Global/P_Striker_B", true) and not PedIsDoingTask(ped, "/Global/AI", true) and PedHasWeapon(ped, -1) then
  153.                                     PedSetActionTree(ped, "/Global/P_Striker_B", "Act/Anim/P_Striker_B.act")
  154.                                     PedSetAITree(ped, "/Global/AI", "Act/AI/AI.act")
  155.                                 end
  156.                             end
  157.                         else
  158.                             if PedMePlaying(ped, "Default_KEY") and not PedIsPlaying(ped, "/Global/P_Striker_B", true) and not PedIsDoingTask(ped, "/Global/AI", true) and PedHasWeapon(ped, -1) then
  159.                                 PedSetActionTree(ped, "/Global/P_Striker_B", "Act/Anim/P_Striker_B.act")
  160.                                 PedSetAITree(ped, "/Global/AI", "Act/AI/AI.act")
  161.                             end
  162.                         end
  163.                     end
  164.                 end
  165.            
  166.                 -- Chad & Bryce boxing outfit:
  167.                 if PedIsModel(ped, 36) or PedIsModel(ped, 117) or PedIsModel(ped, 239) or PedIsModel(ped, 240) or PedIsModel(ped, 241) or PedIsModel(ped, 242) then
  168.                     if not MissionActiveSpecific2("2_R11_Chad") and not MissionActiveSpecific2("2_R11_Bryce") and not MissionActiveSpecific2("2_R11_Random") and not MissionActiveSpecific("3_R09_P3") then
  169.                         if PedIsInCombat(ped) then
  170.                             if DistanceBetweenPeds2D(ped, PedGetTargetPed(ped)) <= 2 then
  171.                                 if PedMePlaying(ped, "Default_KEY") and not PedIsPlaying(ped, "/Global/P_Bif", true) and not PedIsDoingTask(ped, "/Global/AI_BOXER", true) and PedHasWeapon(ped, -1) then
  172.                                     PedSetActionTree(ped, "/Global/P_Bif", "Act/Anim/P_Bif.act")
  173.                                     PedSetAITree(ped, "/Global/AI_BOXER", "Act/AI/AI_BOXER.act")
  174.                                 end
  175.                                 FightingSpeech(ped) -- Not working for damaged face boxer
  176.                             else
  177.                                 if PedMePlaying(ped, "Default_KEY") and not PedIsPlaying(ped, "/Global/P_Grappler_A", true) and not PedIsDoingTask(ped, "/Global/AI", true) and PedHasWeapon(ped, -1) then
  178.                                     PedSetActionTree(ped, "/Global/P_Grappler_A", "Act/Anim/P_Grappler_A.act")
  179.                                     PedSetAITree(ped, "/Global/AI", "Act/AI/AI.act")
  180.                                 end
  181.                             end
  182.                         else
  183.                             if PedMePlaying(ped, "Default_KEY") and not PedIsPlaying(ped, "/Global/P_Grappler_A", true) and not PedIsDoingTask(ped, "/Global/AI", true) and PedHasWeapon(ped, -1) then
  184.                                 PedSetActionTree(ped, "/Global/P_Grappler_A", "Act/Anim/P_Grappler_A.act")
  185.                                 PedSetAITree(ped, "/Global/AI", "Act/AI/AI.act")
  186.                             end
  187.                         end
  188.                     end
  189.                 end
  190.  
  191.                 -- Johnny:
  192.                 if PedIsModel(ped, 23) or PedIsModel(ped, 217) then
  193.                     if not MissionActiveSpecific("3_B") and not MissionActiveSpecific("3_06") then
  194.                         if PedMePlaying(ped, "Default_KEY") and not PedIsPlaying(ped, "/Global/G_Johnny", true) and PedHasWeapon(ped, -1) then
  195.                             PedSetActionTree(ped, "/Global/G_Johnny", "Act/Anim/G_Johnny.act")
  196.                         end
  197.                         if PedIsInCombat(ped) then
  198.                             if DistanceBetweenPeds2D(ped, PedGetTargetPed(ped)) <= 2 and PedMePlaying(ped, "Default_KEY") and math.random(494) < 3 then
  199.                                 PedSetActionNode(ped, "/Global/G_Johnny/Default_KEY/RisingAttacks/HeavyAttacks/RisingAttacks", "Act/Anim/G_Johnny.act")
  200.                             end
  201.                         end
  202.                     end
  203.                 end
  204.  
  205.                 -- Norton William:
  206.                 if PedIsModel(ped, 29) or PedIsModel(ped, 201) then
  207.                     if not MissionActiveSpecific("3_05") then
  208.                         if PedIsInCombat(ped) then
  209.                             if PedHasWeapon(ped, 324) then
  210.                                 if PedMePlaying(ped, "Default_KEY") and not PedIsPlaying(ped, "/Global/Norton", true) and not PedIsDoingTask(ped, "/Global/NortonAI", true) then
  211.                                     --nortonHP = PedGetHealth(ped)
  212.                                     --PedSetStatsType(ped, "STAT_3_05_NORTON")
  213.                                     --PedSetHealth(ped, nortonHP)
  214.                                     PedSetActionTree(ped, "/Global/Norton", "Act/Anim/3_05_Norton.act")
  215.                                     PedSetAITree(ped, "/Global/NortonAI", "Act/AI/AI_Norton.act")
  216.                                 end
  217.                                 FightingSpeech(ped)
  218.                                 if PedMePlaying(ped, "Default_KEY") and not SoundSpeechPlaying(ped) and math.random(400) < 4 then
  219.                                     SoundPlayScriptedSpeechEvent(ped, "M_3_05", 18, "large")
  220.                                 end
  221.                             else
  222.                                 if PedMePlaying(ped, "Default_KEY") then
  223.                                     if not PedIsPlaying(ped, "/Global/G_Grappler_A", true) and not PedIsDoingTask(ped, "/Global/AI", true) and PedHasWeapon(ped, -1) then
  224.                                         --nortonHP = PedGetHealth(ped)
  225.                                         --PedSetStatsType(ped, "STAT_G_GRAPPLER_A")
  226.                                         --PedSetHealth(ped, nortonHP)
  227.                                         PedSetActionTree(ped, "/Global/G_Grappler_A", "Act/Anim/G_Grappler_A.act")
  228.                                         PedSetAITree(ped, "/Global/AI", "Act/AI/AI.act")
  229.                                     end
  230.                                     if math.random(1100) == 99 then
  231.                                         PedSetWeapon(ped, 324, 1)
  232.                                     end
  233.                                 end
  234.                             end
  235.                         else
  236.                             if PedMePlaying(ped, "Default_KEY") and not PedIsPlaying(ped, "/Global/G_Grappler_A", true) and not PedIsDoingTask(ped, "/Global/AI", true) and PedHasWeapon(ped, -1) then
  237.                                 --nortonHP = PedGetHealth(ped)
  238.                                 --PedSetStatsType(ped, "STAT_G_GRAPPLER_A")
  239.                                 --PedSetHealth(ped, nortonHP)
  240.                                 PedSetActionTree(ped, "/Global/G_Grappler_A", "Act/Anim/G_Grappler_A.act")
  241.                                 PedSetAITree(ped, "/Global/AI", "Act/AI/AI.act")
  242.                             end
  243.                             if PedHasWeapon(ped, 324) then
  244.                                 PedDestroyWeapon(ped, 324)
  245.                             end
  246.                         end
  247.                     end
  248.                 end
  249.  
  250.                 -- Earnest Jones:
  251.                 if PedIsModel(ped, 10) or PedIsModel(ped, 215) then
  252.                     if not MissionActiveSpecific("4_B1") then
  253.                         if GameGetPedStat(ped, 11) < 70 then
  254.                             PedOverrideStat(ped, 11, math.random(70, 100))
  255.                         end
  256.                         if PedIsInCombat(ped) then
  257.                             if PedMePlaying(ped, "Default_KEY") and DistanceBetweenPeds2D(ped, PedGetTargetPed(ped)) > 3 and math.random(309) >= 306 then
  258.                                 local Action_Earnest, Random_Earnest = {
  259.                                     {"/Global/N_Earnest/Offense/FireSpudGun", "Act/Anim/N_Earnest.act", {305, 50}},
  260.                                     {"/Global/N_Earnest/Offense/ThrowBombs", "Act/Anim/N_Earnest.act", {417, 8}}
  261.                                 }, math.random(2)
  262.                                 PedSetWeaponNow(ped, unpack(Action_Earnest[Random_Earnest][3]))
  263.                                 Wait(200)
  264.                                 PedSetActionNode(ped, Action_Earnest[Random_Earnest][1], Action_Earnest[Random_Earnest][2])
  265.                                 Wait(math.random(200, 500))
  266.                                 SoundPlayScriptedSpeechEvent(ped, "M_4_B1", math.random(3), "large")
  267.                             end
  268.                         else
  269.                             if PedHasWeapon(ped, 305) then
  270.                                 PedDestroyWeapon(ped, 305)
  271.                             elseif PedHasWeapon(ped, 417) then
  272.                                 PedDestroyWeapon(ped, 417)
  273.                             end
  274.                         end
  275.                     end
  276.                 end
  277.  
  278.                 -- Ted:
  279.                 if PedIsModel(ped, 19) or PedIsModel(ped, 110) or PedIsModel(ped, 216) then
  280.                     if not MissionActiveSpecific("4_B2") then
  281.                         if GameGetPedStat(ped, 11) < 60 then
  282.                             PedOverrideStat(ped, 11, math.random(60, 100)) -- Projectile frequency
  283.                         end
  284.                         if PedMePlaying(ped, "Default_KEY") and not PedIsPlaying(ped, "/Global/J_Ted", true) and PedHasWeapon(ped, -1) then
  285.                             PedSetActionTree(ped, "/Global/J_Ted", "Act/Anim/J_Ted.act")
  286.                         end
  287.                         if PedIsInCombat(ped) then
  288.                             if PedMePlaying(ped, "Default_KEY") then
  289.                                 if tedWftbombsThrow and not PedHasWeapon(ped, 400) and DistanceBetweenPeds2D(ped, PedGetTargetPed(ped)) > 3 and math.random(500) > 498 then
  290.                                     PedSetWeapon(ped, 400, 1)
  291.                                     Wait(math.random(200, 500))
  292.                                     SoundPlayScriptedSpeechEvent(ped, "M_4_B2", 4, "large")
  293.                                 elseif DistanceBetweenPeds2D(ped, PedGetTargetPed(ped)) <= 1.75 and math.random(110) == 5 then
  294.                                     PedSetActionNode(ped, "/Global/J_Melee_A/Offense/Medium/Strikes/Unblockable", "Act/Anim/J_Melee_A.act")
  295.                                 end
  296.                             end
  297.                         else
  298.                             if PedHasWeapon(ped, 400) then
  299.                                 PedDestroyWeapon(ped, 400)
  300.                             end
  301.                         end
  302.                     end
  303.                 end
  304.  
  305.                 -- Damon West:
  306.                 if PedIsModel(ped, 12) or PedIsModel(ped, 112) or PedIsModel(ped, 168) or PedIsModel(ped, 205) then
  307.                     if not MissionActiveSpecific("4_B2") then
  308.                         if PedIsInCombat(ped) then
  309.                             if not PedIsInAnyVehicle(PedGetTargetPed(ped)) --[[and PedHasWeapon(ped, -1)]] and DistanceBetweenPeds2D(ped, PedGetTargetPed(ped)) < 5 and PedMePlaying(ped, "Default_KEY") and math.random(550) <= 2 then
  310.                                 PedSetActionNode(ped, "/Global/J_Damon/Offense/SpecialStart/StartRun", "Act/Anim/J_Damon.act")
  311.                             end
  312.                         end
  313.                     end
  314.                 end
  315.            
  316.                 -- Casey Harris & Bo Jackson
  317.                 if PedIsModel(ped, 17) or PedIsModel(ped, 164) or PedIsModel(ped, 232) or PedIsModel(ped, 18) or PedIsModel(ped, 204) or PedIsModel(ped, 231) then
  318.                     if PedIsInCombat(ped) then
  319.                         if DistanceBetweenPeds2D(ped, PedGetTargetPed(ped)) <= 1.75 and PedMePlaying(ped, "Default_KEY") and math.random(450) >= 448 then
  320.                             PedSetActionNode(ped, "/Global/J_Melee_A/Offense/Medium/Strikes/Unblockable", "Act/Anim/J_Melee_A.act")
  321.                         end
  322.                     end
  323.                 end
  324.            
  325.                 -- Mascot:
  326.                 if PedIsModel(ped, 88) then
  327.                     if not MissionActiveSpecific("4_05") then
  328.                         --if PedMePlaying(ped, "Default_KEY") and not PedIsPlaying(ped, "/Global/J_Mascot", true) and PedHasWeapon(ped, -1) then
  329.                             --PedSetActionTree(ped, "/Global/J_Mascot", "Act/Anim/J_Mascot.act")
  330.                         --end
  331.                         if PedIsInCombat(ped) then
  332.                             if PedMePlaying(ped, "Default_KEY") and not PedIsDoingTask(ped, "/Global/AI_MASCOT_4_05", true) then
  333.                                 PedSetAITree(ped, "/Global/AI_MASCOT_4_05", "Act/AI/AI_MASCOT_4_05.act")
  334.                             end
  335.                             if not PedIsInAnyVehicle(PedGetTargetPed(ped)) and DistanceBetweenPeds2D(ped, PedGetTargetPed(ped)) <= 3 and PedMePlaying(ped, "Default_KEY") and math.random(324) < 4 then
  336.                                 local mascotNodes, mascotNodes_random = {
  337.                                     {"/Global/J_Mascot/Offense/Special/Mascot/Mascot/SpecialChoose/Headbutt/Invincible/Headbutt", "Act/Anim/J_Mascot.act"},
  338.                                     {"/Global/J_Mascot/Offense/Short", "Act/Anim/J_Mascot.act"}
  339.                                 }, math.random(2)
  340.                                 PedSetActionNode(ped, mascotNodes[mascotNodes_random][1], mascotNodes[mascotNodes_random][2])
  341.                             end
  342.                             FightingSpeech(ped)
  343.                             if PedMePlaying(ped, "Default_KEY") and not SoundSpeechPlaying(ped) and math.random(400) < 4 then
  344.                                 SoundPlayScriptedSpeechEvent(ped, "M_4_05", math.random(2) == 1 and 50 or 58, "large")
  345.                             end
  346.                         else
  347.                             if PedMePlaying(ped, "Default_KEY") and not PedIsDoingTask(ped, "/Global/AI", true) then
  348.                                 PedSetAITree(ped, "/Global/AI", "Act/AI/AI.act")
  349.                             end
  350.                         end
  351.                     end
  352.                 end
  353.  
  354.                 --Edgar:
  355.                 if PedIsModel(ped, 91) or PedIsModel(ped, 196) then
  356.                     if not MissionActiveSpecific("5_B") then
  357.                         if PedMePlaying(ped, "Default_KEY") and not PedIsPlaying(ped, "/Global/DO_Edgar", true) and PedHasWeapon(ped, -1) then
  358.                             PedSetActionTree(ped, "/Global/DO_Edgar", "Act/Anim/DO_Edgar.act")
  359.                         end
  360.                         if GameGetPedStat(ped, 13) < 60 then
  361.                             PedOverrideStat(ped, 13, math.random(60, 100))
  362.                         end
  363.                         if PedIsInCombat(ped) then
  364.                             if PedIsDoingTask(ped, "/Global/AI_EDGAR_5_B", true) then
  365.                                 FightingSpeech(ped)
  366.                             end
  367.                             if PedHasWeapon(ped, 342) then
  368.                                 if PedMePlaying(ped, "Default_KEY") and not PedIsDoingTask(ped, "/Global/AI_EDGAR_5_B", true) then
  369.                                     PedSetAITree(ped, "/Global/AI_EDGAR_5_B", "Act/AI/AI_EDGAR_5_B.act")
  370.                                 end
  371.                             else
  372.                                 if math.random(1682) == 500 then
  373.                                     PedSetWeapon(ped, 342, 1)
  374.                                 end
  375.                                 if PedHasWeapon(PedGetTargetPed(ped), 342) then
  376.                                     if PedMePlaying(ped, "Default_KEY") and not PedIsDoingTask(ped, "/Global/AI_EDGAR_5_B", true) then
  377.                                         PedSetAITree(ped, "/Global/AI_EDGAR_5_B", "Act/AI/AI_EDGAR_5_B.act")
  378.                                     elseif PedMePlaying(ped, "Default_KEY") and not SoundSpeechPlaying(ped) and math.random(400) < 4 then
  379.                                         SoundPlayScriptedSpeechEvent(ped, "M_5_B", 4, "large")
  380.                                     end
  381.                                 else
  382.                                     if PedMePlaying(ped, "Default_KEY") and not PedIsDoingTask(ped, "/Global/AI", true) then
  383.                                         PedSetAITree(ped, "/Global/AI", "Act/AI/AI.act")
  384.                                     end
  385.                                 end
  386.                                 if PedMePlaying(ped, "Default_KEY") and math.random(250) == 25 then
  387.                                     PedSetActionNode(ped,"/Global/DO_Striker_A/Offense/Medium/HeavyAttacks","Act/Anim/DO_Striker_A.act")
  388.                                 end
  389.                             end
  390.                         else
  391.                             if PedMePlaying(ped, "Default_KEY") and not PedIsDoingTask(ped, "/Global/AI", true) then
  392.                                 PedSetAITree(ped, "/Global/AI", "Act/AI/AI.act")
  393.                             end
  394.                             if PedHasWeapon(ped, 342) then
  395.                                 PedDestroyWeapon(ped, 342)
  396.                             end
  397.                         end
  398.                     end
  399.                 end
  400.                
  401.                 -- Gary:
  402.                 if PedIsModel(ped, 130) or PedIsModel(ped, 160) then
  403.                     if not MissionActiveSpecific("6_B") then
  404.                         if PedMePlaying(ped, "Default_KEY") and not PedIsPlaying(ped, "/Global/Nemesis", true) and PedHasWeapon(ped, -1) then
  405.                             PedSetActionTree(ped, "/Global/Nemesis", "Act/Anim/Nemesis.act")
  406.                         end
  407.                         if GameGetPedStat(ped, 11) < 50 then
  408.                             PedOverrideStat(ped, 11, math.random(50, 100))
  409.                         elseif GameGetPedStat(ped, 13) < 50 then
  410.                             PedOverrideStat(ped, 13, math.random(50, 100))
  411.                         end
  412.                         if PedIsInCombat(ped) then
  413.                             if PedMePlaying(ped, "Default_KEY") then
  414.                                 if garyBricksThrow and DistanceBetweenPeds2D(ped, PedGetTargetPed(ped)) >= 3 and math.random(481) <= 3 then
  415.                                     PedSetActionNode(ped, "/Global/Nemesis/Special/Throw", "Act/Anim/Nemesis.act")
  416.                                     Wait(math.random(200, 500))
  417.                                     SoundPlayScriptedSpeechEvent(ped, "M_6_B", 15, "large")
  418.                                 end
  419.                                 if not PedIsDoingTask(ped, "/Global/GaryAI", true) then
  420.                                     PedSetAITree(ped, "/Global/GaryAI", "Act/AI/AI_Gary.act")
  421.                                 end
  422.                                 FightingSpeech(ped)
  423.                             end
  424.                         else
  425.                             if PedMePlaying(ped, "Default_KEY") and not PedIsDoingTask(ped, "/Global/AI", true) then
  426.                                 PedSetAITree(ped, "/Global/AI", "Act/AI/AI.act")
  427.                             end
  428.                             if PedHasWeapon(ped, 311) then
  429.                                 PedDestroyWeapon(ped, 311)
  430.                             end
  431.                         end
  432.                     end
  433.                 end
  434.  
  435.                 -- Fatty (wrestle):
  436.                 if PedIsModel(ped, 122) then
  437.                     if not MissionActiveSpecific("C_Wrestling_1") and not MissionActiveSpecific("C_Wrestling_2") and not MissionActiveSpecific("C_Wrestling_3") and not MissionActiveSpecific("C_Wrestling_4") and not MissionActiveSpecific("C_Wrestling_5") then
  438.                         if PedIsInCombat(ped) then
  439.                             if DistanceBetweenPeds2D(ped, PedGetTargetPed(ped)) <= 3 then
  440.                                 if PedMePlaying(ped, "Default_KEY") and not PedIsPlaying(ped, "/Global/J_Grappler_A", true) and PedHasWeapon(ped, -1) then
  441.                                     --fattyHP = PedGetHealth(ped)
  442.                                     --PedSetStatsType(ped, "STAT_J_GRAPPLER_A")
  443.                                     --PedSetHealth(ped, fattyHP)
  444.                                     PedSetActionTree(ped, "/Global/J_Grappler_A", "Act/Anim/J_Grappler_A.act")
  445.                                 end
  446.                             else
  447.                                 if PedMePlaying(ped, "Default_KEY") and not PedIsPlaying(ped, "/Global/N_Striker_A", true) and PedHasWeapon(ped, -1) then
  448.                                     --fattyHP = PedGetHealth(ped)
  449.                                     --PedSetStatsType(ped, "STAT_N_STRIKER_A")
  450.                                     --PedSetHealth(ped, fattyHP)
  451.                                     PedSetActionTree(ped, "/Global/N_Striker_A", "Act/Anim/N_Striker_A.act")
  452.                                 end
  453.                             end
  454.                         else
  455.                             if PedMePlaying(ped, "Default_KEY") and not PedIsPlaying(ped, "/Global/N_Striker_A", true) and PedHasWeapon(ped, -1) then
  456.                                 --fattyHP = PedGetHealth(ped)
  457.                                 --PedSetStatsType(ped, "STAT_N_STRIKER_A")
  458.                                 --PedSetHealth(ped, fattyHP)
  459.                                 PedSetActionTree(ped, "/Global/N_Striker_A", "Act/Anim/N_Striker_A.act")
  460.                             end
  461.                         end
  462.                     end
  463.                 end
  464.  
  465.                 -- Bob:
  466.                 if PedIsModel(ped, 121) then
  467.                     if PedGetFaction(ped) ~= 2 then
  468.                         PedSetFaction(ped, 2)
  469.                     end
  470.                     if PedMePlaying(ped, "Default_KEY") and not PedIsPlaying(ped, "/Global/J_Grappler_A", true) and PedHasWeapon(ped, -1) then
  471.                         PedSetActionTree(ped, "/Global/J_Grappler_A", "Act/Anim/J_Grappler_A.act")
  472.                     end
  473.                 end
  474.  
  475.                 -- Vance (Pirate costume):
  476.                 if PedIsModel(ped, 173) then
  477.                     if MiniObjectiveGetIsComplete(16) then -- Vance's(pirate costume) faction changed to greaser after you beat him on wrecked ship island
  478.                         if PedGetFaction(ped) ~= 4 then
  479.                             PedSetFaction(ped, 4)
  480.                         end
  481.                     end
  482.                 end
  483.  
  484.             end
  485.         end
  486.     end
  487. end
  488.  
  489. function FightingSpeech(PED)
  490.     if PedMePlaying(PED, "Default_KEY") and not SoundSpeechPlaying(PED) then
  491.         if PedGetTargetPed(PED) ~= gPlayer and SoundSpeechPlaying(PedGetTargetPed(PED), "FIGHTING") or math.random(400) < 4 then
  492.             SoundPlayAmbientSpeechEvent(PED, math.random(2) == 1 and "FIGHTING" or (math.random(2) == 1 and "LAUGH_CRUEL" or "LAUGH_FRIENDLY"))
  493.         elseif (PlayerIsTaunting(PED) and math.random(6) > 4) or math.random(400) < 4 then
  494.             SoundPlayAmbientSpeechEvent(PED, math.random(2) == 1 and "FIGHTING" or (math.random(2) == 1 and "LAUGH_CRUEL" or "LAUGH_FRIENDLY"))
  495.         end
  496.     end
  497. end
  498.  
  499. function PlayerIsTaunting(PED)
  500.     if PedGetTargetPed(gPlayer) == PED and (SoundSpeechPlaying(gPlayer, "PLAYER_TAUNT") or SoundSpeechPlaying(gPlayer, "PLAYER_TAUNT_COMBAT") or SoundSpeechPlaying(gPlayer, "PLAYER_TAUNT_COMBAT_SHOVE")) then
  501.         return true
  502.     end
  503.     return false
  504. end
  505.  
  506. local thread_NPCfFS;
  507. function NPC_Full_Fighting_Style_mod()
  508.     LoadAnims()
  509.     SoundLoadBank("MISSION\\1_B.bnk")
  510.     --ide()
  511.     thread_NPCfFS = CreateThread("T_NPC_Full_Fighting_Style")
  512. end
  513.  
  514. function main()
  515.     while not SystemIsReady() or AreaIsLoading() do
  516.         Wait(0)
  517.     end
  518.     NPC_Full_Fighting_Style_mod()
  519.     while true do
  520.         Wait(0)
  521.         if F_PlayerIsDead() then
  522.             TerminateThread(thread_NPCfFS)
  523.             thread_NPCfFS = CreateThread("T_NPC_Full_Fighting_Style")
  524.         end
  525.     end
  526. end
  527. --[[
  528. function ide()
  529.     local SetupPed = {
  530.         {10, "NDLead_Earnest", "NDlead_Earnest_W", 0, "Medium", "NERD", "STAT_N_EARNEST", "F_Nerds", "N_Striker", "N_Ranged", "Straf_Nerd", "/Global/N_Earnest", "Act/Anim/N_Earnest.act"},
  531.         {19, "JKlead_Ted", "JKlead_Ted_W", 0, "Large", "JOCK", "STAT_J_TED", "F_Jocks", "J_Striker", "null", "null", "/Global/J_Ted", "Act/Anim/J_Ted.act"},
  532.         {}
  533.     }
  534.     for num = 1, table.getn(SetupPed) do
  535.         local Data, Texture = SetupPed[num], function()
  536.             if ChapterGet() == 2 then
  537.                 return SetupPed[num][3]
  538.             else
  539.                 return SetupPed[num][2]
  540.             end
  541.         end
  542.     end
  543.     SetupPedObject(Data[1], Data[2], Texture(), Data[4], Data[5], Data[6], Data[7], Data[8], Data[9], Data[10], Data[11], 1, Data[12], Data[13], "/Global/AI", "Act/AI/AI.act")
  544. end
  545. ]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement