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


Author Topic: Hello modders i need help  (Read 2052 times)

0 Members and 1 Guest are viewing this topic.

Offline denizthebest

  • Jr. Member
  • **
  • Posts: 85
  • Half way there.
    • View Profile
Hello modders i need help
« on: June 10, 2015, 07:36:57 AM »
Hi guys i have a simple question where exactly should i put PedSetActionTree(gPlayer, .............................)
i putted in function main but it doesnt works  :confused:

Offline AfterLife

  • The Reaper
  • Sr. Member
  • ***
  • Posts: 830
  • Gender: Male
  • I'm from the AfterLife...
    • View Profile
Re: Hello modders i need help
« Reply #1 on: June 10, 2015, 07:49:16 AM »
Please read the entire Lua tutorial by some of our fellow members before asking questions like these.

Offline Unknownsoldier

  • Hero Member
  • ****
  • Posts: 2,773
    • View Profile
Re: Hello modders i need help
« Reply #2 on: June 10, 2015, 08:33:02 AM »
you need to find 2 parts to the node u want. we will use /Global/Player.(it just makes u idle)

PedSetActionNode(gPlayer, "/Global/Player", "Act/Player.act")

for example we wil use "/Global/N_Earnest/Offense/FireSpudGun", "act/anim/N_Earnest.act"

so u do PedSetActioNode(gPlayer, "/Global/N_Earnest/Offense/FireSpudGun", "act/anim/N_Earnest.act")
boom. u got urself a node. u hav to put udner isbuttonpressed so do like this:

function thing()
  if IsButtonBeingPressed(button, 0) then
       PedSetActionNode(gPlayer, "/Global/N_Earnest/Offense/FireSpudGun", "act/anim/N_Earnest.act")
  end
end

boom again. i helpt u. ;)

Offline DaBOSS54320

  • Hero Member
  • ****
  • Posts: 3,398
  • Gender: Female
    • View Profile
Re: Hello modders i need help
« Reply #3 on: June 10, 2015, 10:07:03 AM »
He wanted to know where to set the tree, not a specific node.

You should set the tree in MissionSetup, or at least outside of any loops. Remember how the function works, it takes 3 arguments.

1 - The ped's id to set the action tree of (gPlayer is the player's)
2 - The action tree (An action tree is the root of all action nodes in the style. So for example "/Global/P_Striker_A")
3 - The action file, which is where the actions (tree and nodes) of the style are located. All NPC styles are in the Act/Anim directory, and are just the title of the style with the file extension ".act". You won't find an Act/Anim folder with ACT (action) files in it, but the release version of them are in cat files in Act/Act.img. Luckily we don't really need it to find where the act files are because they all follow the same pattern of being in Act/Anim and having the .act extension. With finding nodes it may of been nice to have the ACT files but I guess we weren't that fortunate. So in short, "Act/Anim/P_Striker_A.act".

A complete call to the function could look like this: PedSetActionTree(gPlayer,"/Global/P_Striker_A","Act/Anim/P_Striker_A.act" and I would suggest putting it in MissionSetup, but make sure it is after AreaTransitionXYZ, because AreaTransitionXYZ must be the first function called inside of MissionSetup.

Offline Unknownsoldier

  • Hero Member
  • ****
  • Posts: 2,773
    • View Profile
Re: Hello modders i need help
« Reply #4 on: June 10, 2015, 03:58:46 PM »
He wanted to know where to set the tree, not a specific node.
That's kinda what I showed in my post..