Bully-Board

Bully Modding Section => Script Modding => LUA Scripting Help => Topic started by: Gustavinzaum on September 27, 2016, 06:16:54 PM

Title: Need help with fighting moves!!!
Post by: Gustavinzaum on September 27, 2016, 06:16:54 PM
hello everyone, i am trying to put some fighting moves for jimmy to use in the game, but most of them are not working, and when i set an ActionTree for gPlayer, it just doesnt move when the game starts, follow my script below.

Code: [Select]
main = function()
  Wait(500) -- Wait 0.5 seconds. This is needed for some scenarios.
  -- Setup code goes here.
  repeat
    -- Constantly running code goes here.
LoadAllAnim()
Fighting()
    Wait(0) -- Waits 0 seconds. Seems pointless but leave this in!
  until not Alive
end

function LoadAllAnim()
  LoadAnimationGroup("Authority")
  LoadAnimationGroup("Boxing")
  LoadAnimationGroup("B_Striker")
  LoadAnimationGroup("CV_Female")
  LoadAnimationGroup("CV_Male")
  LoadAnimationGroup("DO_Edgar")
  LoadAnimationGroup("DO_Grap")
  LoadAnimationGroup("DO_StrikeCombo")
  LoadAnimationGroup("DO_Striker")
  LoadAnimationGroup("F_Adult")
  LoadAnimationGroup("F_BULLY")
  LoadAnimationGroup("F_Crazy")
  LoadAnimationGroup("F_Douts")
  LoadAnimationGroup("F_Girls")
  LoadAnimationGroup("F_Greas")
  LoadAnimationGroup("F_Jocks")
  LoadAnimationGroup("F_Nerds")
  LoadAnimationGroup("F_OldPeds")
  LoadAnimationGroup("F_Pref")
  LoadAnimationGroup("F_Preps")
  LoadAnimationGroup("G_Grappler")
  LoadAnimationGroup("G_Johnny")
  LoadAnimationGroup("G_Striker")
  LoadAnimationGroup("Grap")
  LoadAnimationGroup("J_Damon")
  LoadAnimationGroup("J_Grappler")
  LoadAnimationGroup("J_Melee")
  LoadAnimationGroup("J_Ranged")
  LoadAnimationGroup("J_Striker")
  LoadAnimationGroup("LE_Orderly")
  LoadAnimationGroup("Nemesis")
  LoadAnimationGroup("N_Ranged")
  LoadAnimationGroup("N_Striker")
  LoadAnimationGroup("N_Striker_A")
  LoadAnimationGroup("N_Striker_B")
  LoadAnimationGroup("P_Grappler")
  LoadAnimationGroup("P_Striker")
  LoadAnimationGroup("PunchBag")
  LoadAnimationGroup("Qped")
  LoadAnimationGroup("Rat_Ped")
  LoadAnimationGroup("Russell")
  LoadAnimationGroup("Russell_Pbomb")
  LoadAnimationGroup("Straf_Dout")
  LoadAnimationGroup("Straf_Fat")
  LoadAnimationGroup("Straf_Female")
  LoadAnimationGroup("Straf_Male")
  LoadAnimationGroup("Straf_Nerd")
  LoadAnimationGroup("Straf_Prep")
  LoadAnimationGroup("Straf_Savage")
  LoadAnimationGroup("Straf_Wrest")
  LoadAnimationGroup("TE_Female")
end

function Fighting()
if IsButtonBeingPressed(15,0) then
PedSetActionNode(gPlayer, "/Global/G_Johnny/Offense/Medium/HeavyAttacks/RoundHouseKick","Act/Anim/G_Johnny.act")
elseif IsButtonBeingPressed(8,0) then
PedSetActionNode(gPlayer, "/Global/BOSS_Darby/Offense/Short/Grapples/HeavyAttacks/Catch_Throw","Act/Anim/BOSS_Darby.act")
elseif IsButtonBeingPressed(3,0) then
PedSetActionNode(gPlayer, "/Global/BOSS_Darby/Offense/Medium/HeavyAttacks/StraightPunch", "Act/Anim/BOSS_Darby.act")
elseif IsButtonBeingPressed(14,0) then
PedSetActionNode(gPlayer, "/Global/BOSS_Darby/Offense/Short/Strikes", "Act/Anim/BOSS_Darby.act")
elseif IsButtonBeingPressed(9,0) then
PedSetActionNode(gPlayer, "/Global/BOSS_Darby/Offense/Medium/HeavyAttacks/Hook2", "Act/Anim/BOSS_Darby.act")
elseif IsButtonBeingPressed(2,0) then
PedSetActionNode(gPlayer, "/Global/P_Striker_B/Offense/Short/Strikes/HeavyAttacks", "Act/Anim/P_Striker_B.act")
end
end
im modding on stimecycle script
Title: Re: Need help with fighting moves!!!
Post by: Gustavinzaum on September 27, 2016, 07:01:58 PM
true, but i try to put it inside the fighting function just like that
Code: [Select]
PedSetActionTree(gPlayer, "Global/BOSS_Darby","Act/Anim/Boss_Darby.act")and just like i said jimmy goes kinda frozen, cant walk, jump and stuff.
does that have anything to do with SetAITree or something like that? dont even know if that function exists
Title: Re: Need help with fighting moves!!!
Post by: Altamurenza on September 27, 2016, 07:05:30 PM
And for action tree issue, you make a mistake like PedSetActionTree(gPlayer,"Global/--[[moves]]","Act/Anim/--[[moves]].act"), it's missing " / " before " Global ", the action tree should be PedSetActionTree(gPlayer,"/Global/--[[moves]]","Act/Anim/--[[moves]].act")
Title: Re: Need help with fighting moves!!!
Post by: Gustavinzaum on September 27, 2016, 07:33:37 PM
lol just to see if you guys were paying attention
Title: Re: Need help with fighting moves!!!
Post by: Gustavinzaum on September 27, 2016, 09:21:06 PM
so i should try putting it above the repeat function?
Title: Re: Need help with fighting moves!!!
Post by: Gustavinzaum on September 27, 2016, 10:55:28 PM
Code: [Select]
main = function()
  Wait(500) -- Wait 0.5 seconds. This is needed for some scenarios.
  -- Setup code goes here.
  LoadAllAnim()
  PedSetActionTree(gPlayer, "/Global/BOSS_Darby","Act/Anim/BOSS_Darby.act")
  repeat
    -- Constantly running code goes here.
Fighting()
    Wait(0) -- Waits 0 seconds. Seems pointless but leave this in!
  until not Alive
end

function LoadAllAnim()
  LoadAnimationGroup("Authority")
  LoadAnimationGroup("Boxing")
  LoadAnimationGroup("B_Striker")
  LoadAnimationGroup("CV_Female")
  LoadAnimationGroup("CV_Male")
  LoadAnimationGroup("DO_Edgar")
  LoadAnimationGroup("DO_Grap")
  LoadAnimationGroup("DO_StrikeCombo")
  LoadAnimationGroup("DO_Striker")
  LoadAnimationGroup("F_Adult")
  LoadAnimationGroup("F_BULLY")
  LoadAnimationGroup("F_Crazy")
  LoadAnimationGroup("F_Douts")
  LoadAnimationGroup("F_Girls")
  LoadAnimationGroup("F_Greas")
  LoadAnimationGroup("F_Jocks")
  LoadAnimationGroup("F_Nerds")
  LoadAnimationGroup("F_OldPeds")
  LoadAnimationGroup("F_Pref")
  LoadAnimationGroup("F_Preps")
  LoadAnimationGroup("G_Grappler")
  LoadAnimationGroup("G_Johnny")
  LoadAnimationGroup("G_Striker")
  LoadAnimationGroup("Grap")
  LoadAnimationGroup("J_Damon")
  LoadAnimationGroup("J_Grappler")
  LoadAnimationGroup("J_Melee")
  LoadAnimationGroup("J_Ranged")
  LoadAnimationGroup("J_Striker")
  LoadAnimationGroup("LE_Orderly")
  LoadAnimationGroup("Nemesis")
  LoadAnimationGroup("N_Ranged")
  LoadAnimationGroup("N_Striker")
  LoadAnimationGroup("N_Striker_A")
  LoadAnimationGroup("N_Striker_B")
  LoadAnimationGroup("P_Grappler")
  LoadAnimationGroup("P_Striker")
  LoadAnimationGroup("PunchBag")
  LoadAnimationGroup("Qped")
  LoadAnimationGroup("Rat_Ped")
  LoadAnimationGroup("Russell")
  LoadAnimationGroup("Russell_Pbomb")
  LoadAnimationGroup("Straf_Dout")
  LoadAnimationGroup("Straf_Fat")
  LoadAnimationGroup("Straf_Female")
  LoadAnimationGroup("Straf_Male")
  LoadAnimationGroup("Straf_Nerd")
  LoadAnimationGroup("Straf_Prep")
  LoadAnimationGroup("Straf_Savage")
  LoadAnimationGroup("Straf_Wrest")
  LoadAnimationGroup("TE_Female")
end

function Fighting()
if IsButtonBeingPressed(15,0) then
PedSetActionNode(gPlayer, "/Global/G_Johnny/Offense/Medium/HeavyAttacks/RoundHouseKick","Act/Anim/G_Johnny.act")
elseif IsButtonBeingPressed(8,0) then
PedSetActionNode(gPlayer, "/Global/BOSS_Darby/Offense/Short/Grapples/HeavyAttacks/Catch_Throw","Act/Anim/BOSS_Darby.act")
elseif IsButtonBeingPressed(3,0) then
PedSetActionNode(gPlayer, "/Global/BOSS_Darby/Offense/Short/Strikes/Unblockable/HeavyPunchCharge","Act/Anim/BOSS_Darby.act")
elseif IsButtonBeingPressed(14,0) then
PedSetActionNode(gPlayer, "/Global/BOSS_Darby/Offense/Short/Strikes/LightAttacks/LeftJab/Hook","Act/Anim/BOSS_Darby.act")
elseif IsButtonBeingPressed(9,0) then
PedSetActionNode(gPlayer, "/Global/BOSS_Darby/Offense/Short/Strikes/HeavyAttacks/Hook2","Act/Anim/BOSS_Darby.act")
elseif IsButtonBeingPressed(2,0) then
PedSetActionNode(gPlayer, "/Global/BOSS_Darby/Offense/Short/Strikes/LightAttacks/LeftHook/FinishingCross","Act/Anim/BOSS_Darby.act")
end
end
 -- In most cases, you can ignore everything below here
F_AttendedClass = function()
  if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
    return
  end
  SetSkippedClass(false)
  PlayerSetPunishmentPoints(0)
end
 
F_MissedClass = function()
  if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
    return
  end
  SetSkippedClass(true)
  StatAddToInt(166)
end
 
F_AttendedCurfew = function()
  if not PedInConversation(gPlayer) and not MissionActive() then
    TextPrintString("You got home in time for curfew", 4)
  end
end
 
F_MissedCurfew = function()
  if not PedInConversation(gPlayer) and not MissionActive() then
    TextPrint("TM_TIRED5", 4, 2)
  end
end
 
F_StartClass = function()
  if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
    return
  end
  F_RingSchoolBell()
  local l_6_0 = PlayerGetPunishmentPoints() + GetSkippingPunishment()
end
 
F_EndClass = function()
  if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
    return
  end
  F_RingSchoolBell()
end
 
F_StartMorning = function()
  F_UpdateTimeCycle()
end
 
F_EndMorning = function()
  F_UpdateTimeCycle()
end
 
F_StartLunch = function()
  if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
    F_UpdateTimeCycle()
    return
  end
  F_UpdateTimeCycle()
end
 
F_EndLunch = function()
  F_UpdateTimeCycle()
end
 
F_StartAfternoon = function()
  F_UpdateTimeCycle()
end
 
F_EndAfternoon = function()
  F_UpdateTimeCycle()
end
 
F_StartEvening = function()
  F_UpdateTimeCycle()
end
 
F_EndEvening = function()
  F_UpdateTimeCycle()
end
 
F_StartCurfew_SlightlyTired = function()
  F_UpdateTimeCycle()
end
 
F_StartCurfew_Tired = function()
  F_UpdateTimeCycle()
end
 
F_StartCurfew_MoreTired = function()
  F_UpdateTimeCycle()
end
 
F_StartCurfew_TooTired = function()
  F_UpdateTimeCycle()
end
 
F_EndCurfew_TooTired = function()
  F_UpdateTimeCycle()
end
 
F_EndTired = function()
  F_UpdateTimeCycle()
end
 
F_Nothing = function()
end
 
F_ClassWarning = function()
  if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
    return
  end
  local l_23_0 = math.random(1, 2)
end
 
F_UpdateTimeCycle = function()
  if not IsMissionCompleated("1_B") then
    local l_24_0 = GetCurrentDay(false)
    if l_24_0 < 0 or l_24_0 > 2 then
      SetCurrentDay(0)
    end
  end
  F_UpdateCurfew()
end
 
F_UpdateCurfew = function()
  local l_25_0 = shared.gCurfewRules
  if not l_25_0 then
    l_25_0 = F_CurfewDefaultRules
  end
  l_25_0()
end
 
F_CurfewDefaultRules = function()
  local l_26_0 = ClockGet()
  if l_26_0 >= 23 or l_26_0 < 7 then
    shared.gCurfew = true
  else
    shared.gCurfew = false
  end
end

here's the whole code, now jimmy is in some kind of speed bug, and the only working action node is darby's catch throw. i may be putting some functions in wrong places