Bully-Board

Bully Modding Section => Script Modding => Topic started by: Kikymaki on January 02, 2016, 06:51:33 AM

Title: Help me
Post by: Kikymaki on January 02, 2016, 06:51:33 AM
hey,
can someone teach me how to make strafe with block on lua script ??
Title: Re: Help me
Post by: DarkHero on January 02, 2016, 08:34:56 AM
Code: [Select]
portScript("\\Library\\LibTable.lua") -- imports the LibTable library
ImportScript("\\Library\\LibPed.lua") -- imports the LibPed library
local l_0_0 = false
 
MissionSetup = function() -- basic mission setup function which is used in almost all bully scripts
  local l_1_0 = 270 -- X coords
  local l_1_1 = -110 -- Y coords
  local l_1_2 = 6.4000000953674 -- Z coords
 
  PlayerSetHealth(200) -- gives the player 200 health
  AreaTransitionXYZ(0, l_1_0, l_1_1, l_1_2)
 
end
 
MissionCleanup = function()
end -- end statement
 
function IsMoving()
  local s = 0.08 -- sensitivity
  return GetStickValue(16,c) > s or GetStickValue(16,c) < -s or GetStickValue(17,c) > s or GetStickValue(17,c) < -s
end

function Block()
   if IsButtonPressed(10,0) and IsButtonBeingPressed(12,0) and not PedIsValid(PedGetGrappleTargetPed(gPlayer)) then
      PedSetActionTree(gPlayer,"/Global/Player","Act/Player.act")
   elseif IsButtonBeingReleased (10,0)  and not PedIsValid(PedGetGrappleTargetPed(gPlayer)) then
      PedSetActionTree(gPlayer,"/Global/B_Striker_A", "Act/Anim/B_Striker_A.act")
end
end

main = function()
  F_MissionSetup()
  gMissionRunning = true
  while gMissionRunning do
  IsMoving()
  Block()
 if IsButtonPressed(14,0) then
  PedSetActionTree(gPlayer, "/Global/Nemesis/Offense/Short/Strikes/LightAttacks/JAB", "Act/Anim/Nemesis.act")
  elseif IsButtonPressed(10,0) and IsMoving() and not isStrafing and not PedIsValid(PedGetGrappleTargetPed(gPlayer)) then
     ExecuteActionNode(gPlayer,"/Global/B_Striker_A/Default_KEY/ExecuteNodes/LocomotionOverride/Combat","Act/Anim/B_Striker_A")
 isStrafing = true
  elseif (not IsButtonPressed(10,0) or not IsMoving()) and isStrafing and not PedIsValid(PedGetGrappleTargetPed(gPlayer)) then
     PedSetActionTree(gPlayer,"/Global/B_Striker_A", "Act/Anim/B_Striker_A")
     isStrafing = false
  elseif PedIsValid(PedGetTargetPed()) and not PedIsValid(PedGetGrappleTargetPed(gPlayer)) then
     local x,y,z = PedGetPosXYZ(PedGetTargetPed())
     PedFaceXYZ(gPlayer,x,y,z)
  end
  UpdateTextQueue()
    Wait(0)
  end
end
Title: Re: Help me
Post by: DaBOSS54320 on January 02, 2016, 09:11:24 AM
Code: [Select]
ImportScript("\\Library\\LibTable.lua")
ImportScript("\\Library\\LibPed.lua")
local l_0_0 = false
 
MissionSetup = function()
  local l_1_0 = 270
  local l_1_1 = -110
  local l_1_2 = 6.4000000953674
 
  PlayerSetHealth(200)
  AreaTransitionXYZ(0, l_1_0, l_1_1, l_1_2)
 
end

F_MissionSetup = function()

LoadAnimationGroup("P_Striker_B")
LoadAnimationGroup("P_Grappler_A")
LoadAnimationGroup("BOSS_Darby")

end
 
MissionCleanup = function()
end
 
main = function() 
  F_MissionSetup()
gMissionRunning = true
  while gMissionRunning do
if IsButtonPressed(8,0) then
 PedSetActionNode(gPlayer, "/Global/P_Striker_B/Defense/Evade/EvadeCounter","act/anim/P_Striker_B.act")
 elseif IsButtonPressed(8,0) then
 ExecuteActionNode(gPlayer, "/Global/BOSS_Darby/Defense/Block/Block/BlockHits/HitsLight/...", "act/anim/BOSS_Darby.act")
elseif IsButtonPressed(10,0) and IsMoving() and not isStrafing and not PedIsValid(PedGetGrappleTargetPed(gPlayer)) then
     ExecuteActionNode(gPlayer,"/Global/B_Striker_A/Default_KEY/ExecuteNodes/LocomotionOverride/Combat","Act/Anim/B_Striker_A")
 isStrafing = true
  elseif (not IsButtonPressed(10,0) or not IsMoving()) and isStrafing and not PedIsValid(PedGetGrappleTargetPed(gPlayer)) then
     PedSetActionTree(gPlayer,"/Global/B_Striker_A", "Act/Anim/B_Striker_A")
     isStrafing = false
  elseif PedIsValid(PedGetTargetPed()) and not PedIsValid(PedGetGrappleTargetPed(gPlayer)) then
     local x,y,z = PedGetPosXYZ(PedGetTargetPed())
     PedFaceXYZ(gPlayer,x,y,z)
  end
  UpdateTextQueue()
    Wait(0)
  end
end

Press the Space key to use the Block.

EDIT: I added the Block Darby, for he is much better than normal Block.

It might help if you actually created the IsMoving function before trying to use it... by the looks of it I think the script would just crash if you tried to use it now. There's a bunch of other issues with the script too by the way but not really any that make it stop working other than the IsMoving one.
Title: Re: Help me
Post by: DarkHero on January 02, 2016, 10:43:51 AM
Code: [Select]
ImportScript("\\Library\\LibTable.lua")
ImportScript("\\Library\\LibPed.lua")
local l_0_0 = false
 
MissionSetup = function()
  local l_1_0 = 270
  local l_1_1 = -110
  local l_1_2 = 6.4000000953674
 
  PlayerSetHealth(200)
  AreaTransitionXYZ(0, l_1_0, l_1_1, l_1_2)
 
end

F_MissionSetup = function()

LoadAnimationGroup("P_Striker_B")
LoadAnimationGroup("P_Grappler_A")
LoadAnimationGroup("BOSS_Darby")

end
 
MissionCleanup = function()
end
 
main = function() 
  F_MissionSetup()
gMissionRunning = true
  while gMissionRunning do
if IsButtonPressed(8,0) then
 PedSetActionNode(gPlayer, "/Global/P_Striker_B/Defense/Evade/EvadeCounter","act/anim/P_Striker_B.act")
 elseif IsButtonPressed(8,0) then
 ExecuteActionNode(gPlayer, "/Global/BOSS_Darby/Defense/Block/Block/BlockHits/HitsLight/...", "act/anim/BOSS_Darby.act")
elseif IsButtonPressed(10,0) and IsMoving() and not isStrafing and not PedIsValid(PedGetGrappleTargetPed(gPlayer)) then
     ExecuteActionNode(gPlayer,"/Global/B_Striker_A/Default_KEY/ExecuteNodes/LocomotionOverride/Combat","Act/Anim/B_Striker_A")
 isStrafing = true
  elseif (not IsButtonPressed(10,0) or not IsMoving()) and isStrafing and not PedIsValid(PedGetGrappleTargetPed(gPlayer)) then
     PedSetActionTree(gPlayer,"/Global/B_Striker_A", "Act/Anim/B_Striker_A")
     isStrafing = false
  elseif PedIsValid(PedGetTargetPed()) and not PedIsValid(PedGetGrappleTargetPed(gPlayer)) then
     local x,y,z = PedGetPosXYZ(PedGetTargetPed())
     PedFaceXYZ(gPlayer,x,y,z)
  end
  UpdateTextQueue()
    Wait(0)
  end
end

Press the Space key to use the Block.

EDIT: I added the Block Darby, for he is much better than normal Block.

It might help if you actually created the IsMoving function before trying to use it... by the looks of it I think the script would just crash if you tried to use it now. There's a bunch of other issues with the script too by the way but not really any that make it stop working other than the IsMoving one.
I fixed some bugs and added some commands that I had forgotten.

Thank you for telling DaBOSS54320.
Title: Re: Help me
Post by: Kikymaki on January 03, 2016, 09:11:49 AM
Thanks for fast reply :)
Title: Re: Help me
Post by: DarkHero on January 03, 2016, 09:16:11 AM
You are welcome!

If you need some help, do not be shy, send me a message via PM and I'll try to help you the maximum as I can.  :D