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


Author Topic: change ped fighting style  (Read 7563 times)

0 Members and 1 Guest are viewing this topic.

Offline feliiperh

  • Jr. Member
  • **
  • Posts: 13
    • View Profile
change ped fighting style
« on: April 19, 2015, 11:33:58 AM »
How to change a ped fighting style?
It's possible to change just the fighting style without change the faction just in ide.img?

deadpoolXYZ

  • Guest
Re: change ped fighting style
« Reply #1 on: April 19, 2015, 12:46:28 PM »
Ide.img editing is kinda old now since everyone uses lua scripting. The only usefulness of ide editing is that all the changes you make to a ped apply both to his freeroam version and scripted spawn version (fighting style, stats, AI, etc). This means that (as far as I know) with lua you can't make changes to the freeroam version of that ped.

Well enough talk... yes, you can change the fighting style without changing the faction. You have to use the "swap" method.

Let's say you want the generic male students fighting style (GS_Male_A). You have to copy the fighting style code from one ped and paste it over jimmy's fighting style. Then you have to copy Jimmy's fighting style and paste it over that ped's one.

Jimmy's default fighting style and other stuff:
Code: [Select]
player..player......Medium..PLAYER1.STAT_PLAYER.Grap....null....null....null....ÿÿÿÿ/Global/Player..Act/Player.act../Global/PlayerAI....Act/PlayerAI.act....N_Jimmy
Jimmy with students fighting style:
Code: [Select]
player..player......Medium..PLAYER1.STAT_PLAYER.Grap....null....null....null....ÿÿÿÿ/Global/GS_Male_A...Act/Anim/GS_Male_A.act../Global/PlayerAI....Act/PlayerAI.act....N_Jimmy
Gordon's default:
Code: [Select]
GN_WhiteBoy.GN_WhiteBoy_W.......Medium..STUDENT.STAT_GS_MALE_A..Straf_Male..null....null....null......../Global/GS_Male_A...Act/Anim/GS_Male_A.act../Global/AI..Act/AI/AI.act...N_Gordon
Gordon with Jimmy fighting style:
Code: [Select]
GN_WhiteBoy.GN_WhiteBoy_W.......Medium..STUDENT.STAT_GS_MALE_A..Straf_Male..null....null....null......../Global/Player..Act/Player.act../Global/AI..Act/AI/AI.act...N_Gordon
If you want the lua method (which is easier) here it is:
Code: [Select]
PedSetActionTree(gPlayer, "/Global/GS_Male_A", "Act/Anim/GS_Male_A")
This is just a quick copy paste of a function so if you want to learn how to use it there are plenty of lua tutorials so check them out.

Offline DaBOSS54320

  • Hero Member
  • ****
  • Posts: 3,398
  • Gender: Female
    • View Profile
Re: change ped fighting style
« Reply #2 on: April 19, 2015, 03:16:21 PM »
Here, I'll explain step by step how to do it in LUA script modding if you'd like to do that instead. Plus if you learn LUA you can do many other things beyond setting styles too.

Step 1) Get LuaC, the LUA compiler for Bully, and install it with the help of the included ReadMe.txt.

Step 2) Get a IMG tool for Bully (IMGTool 2.0 partially works but it is meant for GTA, and I highly suggest using the one linked for best performance)

Step 3) This is optional, and if you don't do this use regular notepad instead. But I really suggest you get notepad++.

Step 4) Make a new file in notepad/notepad++. Name it whatever you like and save it as a file of type "LUA" (file extension .lua). Then, in that source file (A .lua file is a source file for LUA script) include the code below.

Code: [Select]
function MissionSetup()
  AreaTransitionXYZ(0,270,-110,6)
  LoadAnimationGroup("G_Striker")
  PedSetActionTree(gPlayer,"/Global/G_Striker_A","Act/Anim/G_Striker_A.act")
end

function main()
  while PedIsAlive(gPlayer) do
    Wait(0)
  end
end

Step 5a) Go to the line with LoadAnimationGroup("G_Striker") and PedSetActionTree(gPlayer, "/Global/G_Striker_A", "Act/Anim/G_Striker_A.act"). These 2 lines have code called "function calls". A function call in a LUA script tells Bully to do something, and the things inside the () of a function call are called "arguments". The arguments provide extra information the function call needs to do the thing that its doing to Bully. In the case of the function "LoadAnimationGroup" we need to provide an argument with the name of the animation group to be loaded. We need to put this in quotes. Then on the next line, the function call "PedSetActionTree" takes 3 arguments (which you separate with commas). First, the ped (character) to set the action tree of. We use gPlayer (without quotes) to specify the player. gPlayer is a variable, that represents the player's ped (don't worry about what a variable is now it's not super important to your current needs). The next 2 arguments is the action tree, and file (both in quotes). An action tree is basically what we call a style. Technically it is what will proceed each action node of the style (an action node is an action in Bully, such as fighting moves or actions in general like sit/talk/sit/walk/run/etc). When we set the action tree, it will determine what action nodes are used by the ped with that action tree (in our case, gPlayer, the player). Luckily it's easy to set action trees because they all follow the same pattern. "/Global/" then the style name. Next we'll find a style name and set it now that you know all of that. (TIP: Action tree and action file names are not case sensitive)

Step 5b) So now we need to find a action tree name. We can do this 2 ways. The first way (easier) would be to open "/Bully Root Folder/Objects/default.ide" in notepad/notepad++, then look for a ped you want and scroll to the right until you find their action tree. Don't confuse it with the AI tree though. Then right after their action tree, will also be their action file name, very conveniently. Another way to find a action tree name (a full list of action trees) would be to open "/Bully Root/Act/Act.img" with the IMG tool you downloaded earlier. Inside are ".cat" files. Not all of these are styles for peds, but some are. Usually you can tell if it's a style by if it has a letter, then an underscore, representing which faction the style is (Like B_ for Bullies, P_ for preps, G_ for greasers, or DO_ for dropouts, etc). We don't need to open the .cat files but just get the name of it, as that name is the style name. We put that name after "/Global/" and we have our action tree name. (For example, "/Global/P_Striker_A") make sure not to include .cat of course. So put that action tree name you now have as the 2nd argument to our "PedSetActionTree" function call. Next we'll get the action file, skip the next step if you already have it from default.ide.

Step 5c) Now we need our action file name. This is fairly simple as it also follows a pattern for all the ped fighting styles. It's just "Act/Anim/"<style>".act" for all styles but the player style. If it's the player's style (Named "Player") then it's just "Act/Player.act" without the "Anim" part. For all other ped styles though, it is what I said before. So for example, "Act/Anim/DO_Striker_A.act". The action file is just the .act file that the style's nodes are in. You may wonder where these .act files are.... well, you actually can't find them in your game as they were only used during development. But forms of them exist as ".cat" files in Act.img that we explored earlier. You don't really need to do anything with that knowledge now but it may just be useful later. And as you probably guessed, use this action file name as the 3rd argument to PedSetActionTree. So now we have our action tree and action file, so you should have your complete function call to PedSetActionTree. But... did you load the animations for it right?

Step 5d) If you use a style that isn't loaded, you will fail to play it's animations and do an animationless T pose. So we better load the animation group for the style you use. We can find animation group names in "/Bully/Stream/World.img" as .agr files. AGR being short for "Animation Group". Find an animation group name that sounds like what you need (hopefully you can just imply what it is from your style name) and use it as the 1 and only argument in the "LoadAnimationGroup" function call. If you're not 100% sure what animation group to load, just load multiple that you think may be it. Some styles may use multiple animation groups. You won't hurt anything be loading unneeded animation groups so don't be scared. If you need to load multiple, just make another line of code in your script that calls "LoadAnimationGroup" again by skipping a line under our first "LoadAnimationGroup" call and make another. So now we have a script that will load animations for our style and set it on the player.... now we need to actually put it in the game.

Step 6) We have our LUA source file, but for Bully to understand our script and run it we need to compile it. We'll do this of course with the LUA compiler you downloaded earlier (LuaC.exe). First open "cmd.exe" (Use the "Run" option in windows or locate cmd.exe in C:/Windows/System32") then switch to the directory (location) that LuaC.exe is in using the CD command. (For example if your LuaC.exe is in C:/LUA you'd do "CD C:/LUA"). Next we need to run LuaC, which can be done by putting "LuaC" in the command prompt but, we also need to tell LuaC what exactly to do, which file to compile. To do this we pass "command line arguments" to it by writing some things after "LuaC" in the command prompt. First write your "LuaC" for executing LuaC.exe, then after that and a space put: -o ArcRace1.lur. The -o stands for "output" and the "ArcRace1.lur" part is the name of the output file, or compiled file. You'll see why it must be named that later. Then after that and another space, put the name of the script we made earlier. If that script is in the same directory/location as LuaC.exe you can just write the name of the LUA file (with .lua on the end of course) and if it's not you'll need to specify it's directory. Another thing, you have to put it in quotes if there are any spaces in the directory name/file name. So for example if LuaC.exe was in C:/LUA and my script file was named "Style.lua" and also in C:/LUA... you'd do this in cmd.exe:
CD C:/LUA
LuaC -o "ArcRace1.lur" "Style.lua"
Then it will either tell you an error in your script that you'll have to fix, or say nothing if it compiled successfully. If it did compile right, you'll have a new file called "ArcRace1.lur". Next we'll put that compiled script file in Bully so it can run it.

Step 7) For our script to run, we need to put it in Bully. We'll have to replace a script for it to run as we can't easily add an entirely new one. The file "ArcRace1.lur" already in Bully's scripts is a script file that is used when the arcade machine in the boy's dorm is played. So if we put our modded "ArcRace1.lur" there instead, that script will run instead of the arcade game. All scripts in Bully are in /Bully/Scripts/Scripts.img as .lur files. So open up that Scripts.img, and find the ArcRace1.lur and delete it. This is very important because adding our ArcRace1.lur won't replace it, but just have a duplicate, so we must delete it first. Next, we have to add our ArcRace1.lur that we compiled. So add it, and then simply close the window (If you're using IMG Tool 2.0 like I told you not to you have to rebuild then save and close instead, but if you used the IMG tool I linked to you earlier it auto-saves and all you gotta do is close the window)

Step Fun) We have now created a script, compiled it, and replaced it in Bully's scripts files. So now when you start up Bully and go to the boy's dorm's arcade machine, our modded script should run. If you did the script right, you should see Jimmy teleport in front of the dorm outside (This is what the AreaTransitionXYZ function did) and then have his fighting style changed to whatever you set it as earlier. However since the buttons/keys that control the player cannot activate all types of action nodes, we sadly cannot perform every action/attack in the style this way. But you can still get a portion of the style's moves and get the walk/run/stance of the style.

If you have any problems or encounter any errors doing this, please leave another reply on this topic and I'll try to help you through it. Also from doing this you've learned some of the basics of LUA script modding in Bully. There is far more to script modding too, and I suggest you keep going to make bigger mods as it can be quite fun. Good luck and have fun!
« Last Edit: April 19, 2015, 03:58:01 PM by DaBOSS54320 »