News: Welcome back to Bullworth! If you haven't already, you will need to reset your password..


Author Topic: Speech Function  (Read 2162 times)

0 Members and 1 Guest are viewing this topic.

Offline bullymodder74

  • Jr. Member
  • **
  • Posts: 51
  • Gender: Male
  • Bully Mods
    • View Profile
Speech Function
« on: February 04, 2016, 03:14:55 PM »
 Only works a function  :(

Code: [Select]
function MissionSetup()
 PlayerSetHealth(500)
 AreaTransitionXYZ(0, 270, -110, 6)
 SoundPlayStream("MS_PrepFight.rsm", 0.6)
 PlayerSwapModel("PR2nd_Bif")
 PedSetAITree(gPlayer, "/Global/PlayerAI","Act/PlayerAI.act")
 TextPrintString("P_Striker_A Mod Fighting Style and Strafe", 4, 1)
 Wait(4000)
 TextPrintString("By: Bully Modder74", 4, 1)
 Wait(4000)
 TextPrintString("Enjoy!", 3, 1)
end

function MissionCleanup()
 collectgarbage()
end

function main()
 while true do
  if IsButtonPressed(12,0) then
   SoundPlayScriptedSpeechEvent(gPlayer, "CHATTER")
  end
  f_strafe()
  F_FightingStyle()
  Wait(0)
 end
end


function MissionCleanup()
 collectgarbage()
end

function main()
 while true do
  if IsButtonPressed(8,0) then
   SoundPlayScriptedSpeechEvent(gPlayer, "FIGHT")
  end
  f_strafe()
  F_FightingStyle()
  Wait(0)
 end
end




function f_strafe()
 if IsButtonPressed(10,0) and IsMoving() and not isStrafing and not PedIsValid(PedGetGrappleTargetPed(gPlayer)) then
  PedSetActionNode(gPlayer,"/Global/P_Striker_A/Default_KEY/ExecuteNodes/LocomotionOverride/Combat/CombatBasic","Act/Anim/P_Striker_A.act")
  isStrafing = true
 elseif (not IsButtonPressed(10,0) or not IsMoving()) and isStrafing and not PedIsValid(PedGetGrappleTargetPed(gPlayer)) then
  PedSetActionTree(gPlayer,"/Global/P_Striker_A", "Act/Anim/P_Striker_A.act")
  isStrafing = false
 elseif isStrafing then
  local x,y,z = PedGetPosXYZ(PedGetTargetPed())
  PedFaceXYZ(gPlayer,x,y,z)
 end
end

IsMoving = function()
 local s = 0.08
 return GetStickValue(16,0) > s or GetStickValue(16,0) < -s or GetStickValue(17,0) > s or GetStickValue(17,0) < -s
end



function F_FightingStyle()
 if IsButtonPressed(7,0) and IsButtonPressed(8,0) then
  PedSetActionNode(gPlayer, "/Global/P_Striker_A/Offense/Short/Strikes/LightAttacks/LeftHook","Act/Anim/P_Striker_A.act")
  elseif IsButtonPressed(3,0) then
  PedSetActionNode(gPlayer, "/Global/Ambient/HarassMoves/HarassShort/Shoves","Act/Conv/Ambient.act")
 elseif IsButtonPressed(1,0) then
  PedSetActionNode(gPlayer, "/Global/Actions/Offense/RunningAttacks/RunningAttacksDirect","Globals/GlobalActions.act")
 elseif IsButtonPressed(14,0) then
  PedSetActionNode(gPlayer, "/Global/Ambient/Sitting_Down/SitHigh","Act/Anim/Ambient.act")
  elseif IsButtonPressed(0,0) then
  PedSetAITree(gPlayer, "/Global/AIActionOpps/Cheering","Act/AI/AI.act")
 end
end