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


Author Topic: How do Action Nodes Work?  (Read 14491 times)

0 Members and 1 Guest are viewing this topic.

Offline Screenracer

  • Jr. Member
  • **
  • Posts: 33
    • View Profile
Re: How do Action Nodes Work?
« Reply #15 on: March 27, 2014, 10:56:03 AM »
Try " if IsButtonPressed(2, 1) then " (zoom in)
and " elseif IsButtonPressed(14, 0) then "  (look back)

Wont compile. With this error:

"luac: fs.lua:54: 'until' expected <to close 'repeat' at line 53> near 'elseif'"


GlobalImportScript("SObjTest.lua")
ImportScript("Library/LibTable.lua")
ImportScript("SZone.lua")
ImportScript("2_B.lua")

  l_0_0 = 60
 
MissionSetup = function()
  local l_1_0 = 270
  local l_1_1 = -110
  local l_1_2 = 6.4000000953674
  AreaTransitionXYZ(0, l_1_0, l_1_1, l_1_2)
  LoadAnimationGroup("G_Johnny")
PedSetTypeToTypeAttitude(0, 13, 1)
PedSetTypeToTypeAttitude(1, 13, 3)
PedSetTypeToTypeAttitude(2, 13, 2)
PedSetTypeToTypeAttitude(3, 13, 1)
PedSetTypeToTypeAttitude(4, 13, 2)
PedSetTypeToTypeAttitude(5, 13, 2)
PedSetTypeToTypeAttitude(6, 13, 2)
PedSetTypeToTypeAttitude(7, 13, 2)
PedSetTypeToTypeAttitude(8, 13, 2)
PedSetTypeToTypeAttitude(9, 13, 2)
PedSetTypeToTypeAttitude(10, 13, 2)
PedSetTypeToTypeAttitude(11, 13, 1)
end

TL_Buttons = function()
        if IsButtonPressed(2, 1) then if IsButtonPressed(2, 1) then
          px,py,pz = PlayerGetPosXYZ()
        TextPrintString("Player Pos: "..px..",  "..py..",  "..pz.."Area:"..AreaGetVisible(), 4, 2)
         Wait(1000)
        elseif IsButtonPressed(7, 0) then if IsButtonPressed(2, 1) then
          PedSetActionNode(gPlayer, "/Global/G_Johnny/Cinematic/ThroatGrab", "Act/Anim/G_Johnny")
                 Wait(1000)
    end
end

main = function()
  Load("Act/Dialog.act")
  Load("Act/Debug.act")
  F_TableInit()
  CreateThread("TL_Buttons")
  gMissionRunning = true
  while gMissionRunning do
    UpdateTextQueue()
    TL_Buttons()
      Wait(0)
   end
end

main = function()
repeat
        elseif IsButtonPressed(14, 0) then if IsButtonPressed(2, 1) then
          px,py,pz = PlayerGetPosXYZ()
        TextPrintString("Player Pos: "..px..",  "..py..",  "..pz.."Area:"..AreaGetVisible(), 4, 2)
         Wait(1000)
        elseif IsButtonPressed(14, 0) then if IsButtonPressed(2, 1) then
          PedSetActionNode(gPlayer, "/Global/G_Johnny/Cinematic/ThroatGrab", "Act/Anim/G_Johnny")
                 Wait(1000)
             end
Wait(0)
until not Alive

   end
 
   MissionCleanup = function()
  EnablePOI()
  gMissionRunning = false
end
« Last Edit: March 27, 2014, 11:08:41 AM by Screenracer »

Offline Reath

  • Jr. Member
  • **
  • Posts: 26
  • Gender: Male
    • View Profile
Re: How do Action Nodes Work?
« Reply #16 on: March 27, 2014, 11:09:10 AM »
How about this?
Code: [Select]
GlobalImportScript("SObjTest.lua")
ImportScript("Library/LibTable.lua")
ImportScript("SZone.lua")
ImportScript("2_B.lua")

  l_0_0 = 60
 
MissionSetup = function()
  local l_1_0 = 270
  local l_1_1 = -110
  local l_1_2 = 6.4000000953674
  AreaTransitionXYZ(0, l_1_0, l_1_1, l_1_2)
  LoadAnimationGroup("G_Johnny")
PedSetTypeToTypeAttitude(0, 13, 1)
PedSetTypeToTypeAttitude(1, 13, 3)
PedSetTypeToTypeAttitude(2, 13, 2)
PedSetTypeToTypeAttitude(3, 13, 1)
PedSetTypeToTypeAttitude(4, 13, 2)
PedSetTypeToTypeAttitude(5, 13, 2)
PedSetTypeToTypeAttitude(6, 13, 2)
PedSetTypeToTypeAttitude(7, 13, 2)
PedSetTypeToTypeAttitude(8, 13, 2)
PedSetTypeToTypeAttitude(9, 13, 2)
PedSetTypeToTypeAttitude(10, 13, 2)
PedSetTypeToTypeAttitude(11, 13, 1)
end

TL_Buttons = function()
        if IsButtonPressed(2, 1) and IsButtonPressed(2, 1) then --"and" not then if
          px,py,pz = PlayerGetPosXYZ()
        TextPrintString("Player Pos: "..px..",  "..py..",  "..pz.."Area:"..AreaGetVisible(), 4, 2)
         Wait(1000)
        elseif IsButtonPressed(7, 0) and IsButtonPressed(2, 1) then
          PedSetActionNode(gPlayer, "/Global/G_Johnny/Cinematic/ThroatGrab", "Act/Anim/G_Johnny")
                 Wait(1000)
    end
end

main = function()
  Load("Act/Dialog.act")
  Load("Act/Debug.act")
  F_TableInit()
  CreateThread("TL_Buttons")
  gMissionRunning = true
  while gMissionRunning do
    UpdateTextQueue()
    TL_Buttons()
      Wait(0)
   end
end

main = function()
repeat
TL_Buttons()  --just put everything you want to repeat in your TL_Buttons function
Wait(0)
until not Alive

   end
 
   MissionCleanup = function()
  EnablePOI()
  gMissionRunning = false
end
You can put -code] before your script and -/code] after it, so it won't be messy. Replace the dash with [

Offline Screenracer

  • Jr. Member
  • **
  • Posts: 33
    • View Profile
Re: How do Action Nodes Work?
« Reply #17 on: March 27, 2014, 11:13:04 AM »
That compiled, waiting for another error... :/

Offline Screenracer

  • Jr. Member
  • **
  • Posts: 33
    • View Profile
Re: How do Action Nodes Work?
« Reply #18 on: March 27, 2014, 11:15:54 AM »
I go ingame, press the look behind button and nothing happens.

Offline Reath

  • Jr. Member
  • **
  • Posts: 26
  • Gender: Male
    • View Profile
Re: How do Action Nodes Work?
« Reply #19 on: March 27, 2014, 11:20:29 AM »
This IsButtonBeingPressed(14,0) is the look behind one.

And just replace "IsButtonPressed(2, 1) and IsButtonPressed(2, 1)" with IsButtonBeingPressed(2,0)

Offline Screenracer

  • Jr. Member
  • **
  • Posts: 33
    • View Profile
Re: How do Action Nodes Work?
« Reply #20 on: March 27, 2014, 11:28:28 AM »
That worked. But when I use it, Jimmy does the T pose as well as the victim and the victim goes flying in the t pose. How do I fix this? :O

Offline Reath

  • Jr. Member
  • **
  • Posts: 26
  • Gender: Male
    • View Profile
Re: How do Action Nodes Work?
« Reply #21 on: March 27, 2014, 11:34:00 AM »
That usually happens if the animation for it hasn't loaded. You had LoadAnimationGroup("G_Johnny"). So I don't know.

Ah! I see.
PedSetActionNode(gPlayer, "/Global/G_Johnny/Cinematic/ThroatGrab", "Act/Anim/G_Johnny")
Maybe you just forgot to put .act where you load the node.
Try this
PedSetActionNode(gPlayer, "/Global/G_Johnny/Cinematic/ThroatGrab", "Act/Anim/G_Johnny.act")

Offline Screenracer

  • Jr. Member
  • **
  • Posts: 33
    • View Profile
Re: How do Action Nodes Work?
« Reply #22 on: March 27, 2014, 11:37:15 AM »
Same thing happens.

Also, heres a video of the error for anyone who has no idea what im talking about.

https://www.youtube.com/watch?v=s18gJfrdV1Y

Offline WhenLifeGivesYouLemons

  • xfire: 1emonthatsme
  • Sr. Member
  • ***
  • Posts: 971
  • Gender: Male
  • 波動バースト
    • View Profile
Re: How do Action Nodes Work?
« Reply #23 on: March 27, 2014, 11:41:06 AM »
Try " if IsButtonPressed(2, 1) then " (zoom in)
and " elseif IsButtonPressed(14, 0) then "  (look back)
the 1 in (2, 1) is for the second controller

Use (2, 0)

Offline Reath

  • Jr. Member
  • **
  • Posts: 26
  • Gender: Male
    • View Profile
Re: How do Action Nodes Work?
« Reply #24 on: March 27, 2014, 11:43:14 AM »
Well, if the node is loading the .act, and you have the right LoadAnimation, I don't know.
I know it works for me, the only difference being johnny spawns and with his boss style, which might load whatever animation you need into the game.

@Lemon
I didn't notice the 1.. What is that for anyways? Controller?

Offline Screenracer

  • Jr. Member
  • **
  • Posts: 33
    • View Profile
Re: How do Action Nodes Work?
« Reply #25 on: March 27, 2014, 11:44:31 AM »
Well, if the node is loading the .act, and you have the right LoadAnimation, I don't know.
I know it works for me, the only difference being johnny spawns and with his boss style, which might load whatever animation you need into the game.

@Lemon
I didn't notice the 1.. What is that for anyways? Controller?

Im going to try to use LoadAnimation("G_Johnny") in STimeCycle. Would that work?

Offline Reath

  • Jr. Member
  • **
  • Posts: 26
  • Gender: Male
    • View Profile
Re: How do Action Nodes Work?
« Reply #26 on: March 27, 2014, 11:45:09 AM »
It should work.

Offline Screenracer

  • Jr. Member
  • **
  • Posts: 33
    • View Profile
Re: How do Action Nodes Work?
« Reply #27 on: March 27, 2014, 11:59:42 AM »
The button dosnt work all of a sudden. What button is 2,0? and 1,0?

And what buttons are 14,0 and 15,0?

The button probly dosnt work because of what I added to the script. Right?

GlobalImportScript("SObjTest.lua")
ImportScript("Library/LibTable.lua")
ImportScript("SZone.lua")
ImportScript("2_B.lua")

  l_0_0 = 60
 
MissionSetup = function()
  local l_1_0 = 270
  local l_1_1 = -110
  local l_1_2 = 6.4000000953674
  AreaTransitionXYZ(0, l_1_0, l_1_1, l_1_2)
  LoadAnimationGroup("G_Johnny")
  LoadAnimationGroup("Nemesis")
PedSetTypeToTypeAttitude(0, 13, 1)
PedSetTypeToTypeAttitude(1, 13, 3)
PedSetTypeToTypeAttitude(2, 13, 2)
PedSetTypeToTypeAttitude(3, 13, 1)
PedSetTypeToTypeAttitude(4, 13, 2)
PedSetTypeToTypeAttitude(5, 13, 2)
PedSetTypeToTypeAttitude(6, 13, 2)
PedSetTypeToTypeAttitude(7, 13, 2)
PedSetTypeToTypeAttitude(8, 13, 2)
PedSetTypeToTypeAttitude(9, 13, 2)
PedSetTypeToTypeAttitude(10, 13, 2)
PedSetTypeToTypeAttitude(11, 13, 1)
PedSetPedToTypeAttitude(Gary, 13, 0)
PedSetPedToTypeAttitude(Gary, 1, 1)
PedSetPedToTypeAttitude(Gary, 2, 1)
PedSetPedToTypeAttitude(Gary, 3, 1)
PedSetPedToTypeAttitude(Gary, 4, 1)
PedSetPedToTypeAttitude(Gary, 5, 1)
PedSetPedToTypeAttitude(Gary, 6, 1)
PedSetPedToTypeAttitude(Gary, 7, 1)
PedSetPedToTypeAttitude(Gary, 8, 1)
PedSetPedToTypeAttitude(Gary, 9, 1)
PedSetPedToTypeAttitude(Gary, 10, 1)
PedSetPedToTypeAttitude(Gary, 11, 1)
PedSetPedToTypeAttitude(Gary, 12, 1)
end

TL_Buttons = function()
        if IsButtonPressed(2, 0) and IsButtonPressed(2, 0) then --"and" not then if
          px,py,pz = PlayerGetPosXYZ()
        TextPrintString("Player Pos: "..px..",  "..py..",  "..pz.."Area:"..AreaGetVisible(), 4, 2)
         Wait(1000)
        elseif IsButtonPressed(14, 0) and IsButtonPressed(14, 0) then
          PedSetActionNode(gPlayer, "/Global/G_Johnny/Cinematic/ThroatGrab", "Act/Anim/G_Johnny.act")
                 Wait(1000)
    end
end

TL_Buttons = function()
        if IsButtonPressed(1, 0) and IsButtonPressed(1, 0) then --"and" not then if
          px,py,pz = PlayerGetPosXYZ()
        TextPrintString("Player Pos: "..px..",  "..py..",  "..pz.."Area:"..AreaGetVisible(), 4, 2)
         Wait(1000)
        elseif IsButtonPressed(15, 0) and IsButtonPressed(15, 0) then
          PedSetActionNode(gPlayer, "/Global/Nemesis/HeavyAttacks/SuperUppercut", "Act/Anim/Nemesis.act")
                 Wait(1000)
    end
end

main = function()
  Load("Act/Dialog.act")
  Load("Act/Debug.act")
  F_TableInit()
  CreateThread("TL_Buttons")
  gMissionRunning = true
  while gMissionRunning do
    UpdateTextQueue()
    TL_Buttons()
      Wait(0)
   end
end

main = function()
repeat
TL_Buttons()  --just put everything you want to repeat in your TL_Buttons function
Wait(0)
until not Alive

   end
 
   MissionCleanup = function()
  EnablePOI()
  gMissionRunning = false
end

Offline Reath

  • Jr. Member
  • **
  • Posts: 26
  • Gender: Male
    • View Profile
Re: How do Action Nodes Work?
« Reply #28 on: March 27, 2014, 12:02:26 PM »
The button dosnt work all of a sudden. What button is 2,0? and 1,0?

And what buttons are 14,0 and 15,0?
14 should be look back.
15? Crouch I guess.

3 should be zoom out.
2 should be zoom in.
1 should be the right arrow, the one you use for checking what missions there are.
0 should be the left one, for checking classes.

Offline Reath

  • Jr. Member
  • **
  • Posts: 26
  • Gender: Male
    • View Profile
Re: How do Action Nodes Work?
« Reply #29 on: March 27, 2014, 12:07:00 PM »
Code: [Select]
GlobalImportScript("SObjTest.lua")
ImportScript("Library/LibTable.lua")
ImportScript("SZone.lua")
ImportScript("2_B.lua")

  l_0_0 = 60
 
MissionSetup = function()
  local l_1_0 = 270
  local l_1_1 = -110
  local l_1_2 = 6.4000000953674
  AreaTransitionXYZ(0, l_1_0, l_1_1, l_1_2)
  LoadAnimationGroup("G_Johnny")
  LoadAnimationGroup("Nemesis")
PedSetTypeToTypeAttitude(0, 13, 1)
PedSetTypeToTypeAttitude(1, 13, 3)
PedSetTypeToTypeAttitude(2, 13, 2)
PedSetTypeToTypeAttitude(3, 13, 1)
PedSetTypeToTypeAttitude(4, 13, 2)
PedSetTypeToTypeAttitude(5, 13, 2)
PedSetTypeToTypeAttitude(6, 13, 2)
PedSetTypeToTypeAttitude(7, 13, 2)
PedSetTypeToTypeAttitude(8, 13, 2)
PedSetTypeToTypeAttitude(9, 13, 2)
PedSetTypeToTypeAttitude(10, 13, 2)
PedSetTypeToTypeAttitude(11, 13, 1)
PedSetPedToTypeAttitude(Gary, 13, 0)
PedSetPedToTypeAttitude(Gary, 1, 1)
PedSetPedToTypeAttitude(Gary, 2, 1)
PedSetPedToTypeAttitude(Gary, 3, 1)
PedSetPedToTypeAttitude(Gary, 4, 1)
PedSetPedToTypeAttitude(Gary, 5, 1)
PedSetPedToTypeAttitude(Gary, 6, 1)
PedSetPedToTypeAttitude(Gary, 7, 1)
PedSetPedToTypeAttitude(Gary, 8, 1)
PedSetPedToTypeAttitude(Gary, 9, 1)
PedSetPedToTypeAttitude(Gary, 10, 1)
PedSetPedToTypeAttitude(Gary, 11, 1)
PedSetPedToTypeAttitude(Gary, 12, 1)
end

TL_Buttons = function()
        if IsButtonPressed(2, 0) then --"and" not then if
          px,py,pz = PlayerGetPosXYZ()
        TextPrintString("Player Pos: "..px..",  "..py..",  "..pz.."Area:"..AreaGetVisible(), 4, 2)
         Wait(1000)
        elseif IsButtonPressed(14, 0) then
          PedSetActionNode(gPlayer, "/Global/G_Johnny/Cinematic/ThroatGrab", "Act/Anim/G_Johnny.act")
                 Wait(1000)
    end
end

TL_Buttons = function()
        if IsButtonPressed(1, 0) then --"and" not then if
          px,py,pz = PlayerGetPosXYZ()
        TextPrintString("Player Pos: "..px..",  "..py..",  "..pz.."Area:"..AreaGetVisible(), 4, 2)
         Wait(1000)
        elseif IsButtonPressed(15, 0) then
          PedSetActionNode(gPlayer, "/Global/Nemesis/HeavyAttacks/SuperUppercut", "Act/Anim/Nemesis.act")
                 Wait(1000)
    end
end

main = function()
  Load("Act/Dialog.act")
  Load("Act/Debug.act")
  F_TableInit()
  CreateThread("TL_Buttons")
  gMissionRunning = true
  while gMissionRunning do
    UpdateTextQueue()
    TL_Buttons()
      Wait(0)
   end
end

--[[
main = function()
repeat
TL_Buttons()  --just put everything you want to repeat in your TL_Buttons function
Wait(0)
until not Alive

   end
 
   MissionCleanup = function()
  EnablePOI()
  gMissionRunning = false
end
--]]
Don't name two functions with the same name. I fixed some of it up for you and commented out the extra main.