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


Author Topic: Change model without changing behavior/style?  (Read 7416 times)

0 Members and 1 Guest are viewing this topic.

Offline Mirror

  • Newbie
  • *
  • Posts: 0
    • View Profile
Change model without changing behavior/style?
« on: September 06, 2015, 04:11:02 PM »
How can you do a model swap without changing anything about how the player behaves, or how enemies retaliate?

For example if you switch to a female character with any of the player selectors, you'll often instantly counter attacks, and it seems as though attacking other people has no effect on their hostility.
Is there a way to just switch the model without changing anything else?

Offline Unknownsoldier

  • Hero Member
  • ****
  • Posts: 2,773
    • View Profile
Re: Change model without changing behavior/style?
« Reply #1 on: September 06, 2015, 04:56:50 PM »
PlayerSwapModel("model")
PedSetActionTree(gPlayer, "/Global/Player", "Act/Player.act")
PedSetAITree(gPlayer, "/Global/PlayerAI", "Act/PlayerAI.act")
PedSetFaction(gPlayer, 13)

IDK

Offline Mirror

  • Newbie
  • *
  • Posts: 0
    • View Profile
Re: Change model without changing behavior/style?
« Reply #2 on: September 06, 2015, 06:00:42 PM »
Thanks for the quick reply.

I'm not familiar with anything at this point, but from what I've read I assume it's LUA, so I'll take a look at the tutorial on this site and give it a shot.

Offline Unknownsoldier

  • Hero Member
  • ****
  • Posts: 2,773
    • View Profile
Re: Change model without changing behavior/style?
« Reply #3 on: September 06, 2015, 07:56:36 PM »
oh, okay, good luck. :D

Offline Mirror

  • Newbie
  • *
  • Posts: 0
    • View Profile
Re: Change model without changing behavior/style?
« Reply #4 on: September 06, 2015, 10:04:56 PM »
Geh, looks like this is beyond me after all. I have a couple questions...

Mainly, where do I put the script? I can't decompile existing .lur files so I can't Wing it and stick it wherever I think would make sense.
I assume I have to make a compiled lua file and put it in the image file, but does it have to replace something, or can it be something new?

Also, when I use it, will it just run the way you wrote it, or do I have to bind it to a button press or some other condition?

Lastly, where you wrote "model", does that want a file name, the number associated with peds?

If it seems like I'm clueless, it's because I am  -___-


Offline Unknownsoldier

  • Hero Member
  • ****
  • Posts: 2,773
    • View Profile
Re: Change model without changing behavior/style?
« Reply #5 on: September 06, 2015, 11:40:43 PM »
Geh, looks like this is beyond me after all. I have a couple questions...

Mainly, where do I put the script? I can't decompile existing .lur files so I can't Wing it and stick it wherever I think would make sense.
I assume I have to make a compiled lua file and put it in the image file, but does it have to replace something, or can it be something new?

Also, when I use it, will it just run the way you wrote it, or do I have to bind it to a button press or some other condition?

Lastly, where you wrote "model", does that want a file name, the number associated with peds?

If it seems like I'm clueless, it's because I am  -___-
The place where I put "model" you get a name from the default.ide (Bully folder\Objects). And here's an example: PlayerSwapModel("PRH3_Justin")

Download and install this: http://www.bully-board.com/index.php?action=downloads;sa=downfile&id=60

And for compiling it, you've got to download the archive with the tools in it. First install the "vcsetup" stuff, and if you have 32 bit, use the x86 one. After that, move the LuaC.exe to the folder where your mods are. Since you are just beginning modding, i'd recommend you do this:

open that main drive(i have it clicked in blue on the screenshot above), and you should see a bunch of folders. I know i am going to sound like im talking to someone who's never used a computer before, but I know you probably have. i'll just be detailed JUST IN CASE you get confused:
Go to your Bully folder. Go into the Scripts folder, and right click in there, and click New, then create a New Folder. You can rename it to "Mods" or whatever you want to.

In there, you'll create new folders for each of your mods. And yes, you can name the folders WHATEVER you want.

Drag the LuaC.exe into that folder.

Now that you have your first folder, because windows has permission issue. ONLY DO THIS IF YOU HAVE YOUR BULLY FOLDER IN THE PROGRAM FILES FOLDER:
Move your Bully Scholarhip Edition folder, to another directory. Mine is in C:\Games\Bully.

I created a folder called Games in my C drive called Games. Just drag it there or something. anywhere else.

Once you've done that, open the mods folder you created, and download the following package:
http://www.mediafire.com/download/a1l7k9av7xfx8xj/help.zip
(If that doesn't work, please tell me if you can't download it.)

Drag all the files in there to your mod folder. Not your "Mods" folder, i mean like your "Car Mod" folder.

Now, copy the BullyIMG.exe to your main bully folder.

go back to the mod folder, Right click compile.bat, and change the C:\Games\BULLY\BullyIMG -script "img.txt" part to the folder of your Bully main folder. But KEEP the BullyIMG.exe part in there.

Now double click the img.txt, change the "C:/Games/BULLY/Scripts/Scripts.img" to your Bully root. BUT KEEP THE /Scripts/Scripts.img part in there. Also, dont use \(backslashes). use the /'s. Now before you can compile, open the LUAC Bully.rar again, and drag the msvcr90d.dll to C:\Windows\System32

Now back to your mod folder, you are ready to mod!

If you haven't already, download notepad++, which you can get from here:
https://notepad-plus-plus.org/download/v6.8.3.html

In case you're wondering, YES it's free.

Once you've installed it, right click the .lua file, and open in Notepad++. Or, you can do what I did, which is optional, right click the .lua file, go to Properties, and where it says "Open with", click Change, and change to Notepad++. What that will do, is it will allow you to open the file by just double clicking it. Once you've finished editing it, save it, with CTRL+S or anything. Then, double click the "Compile.bat". it will tell you if there are any errors, and status of the transfer.

And i'm sorry I forgot this part, but before you can compile so simply, right click computer, and go to Properties. Or if you're using a windows 8/8.1, go back the "This PC" or "Computer" directory, now right click "This PC" or "Computer", go to Properties. On the left side, you should see a part that says Advanced system settings:

Click advanced system settings. and you should see this:

Click Environment Variables.

On the bottom pane, scroll down until you see Path on the left. Click Path, then click Edit.

be VERY CAREFUL here, and do EXACTLY as I say.


That "LuaC" part wont be there for you.

What you'll do now, on the bottom text box, go ALL the way to the end of it, then add this:
;C:\BullyRoot\Scripts\Mods\LuaC.exe

Change BullyRoot to the folder your Bully folder is in. And include the ";" in it. Now click "OK" on all the windows.

Now, all you gotta do to compile mods, is click the "compile.bat".

And you'll never have to edit them again!

And yeah, my Variable thing is different cause i have a lot of things in it.

The reason why I can't copy it, and give it to you directly is 2 reasons.
1. Your luac might be in a different folder
2. If you change certain things in there to mine, we may not have the same programs, which can mess up your computer.

This is mine, but do NOT use it, or your computer may get messed up:
C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\LuaC\bin;C:\Program Files\Common Files\Autodesk Shared\;C:\Program Files (x86)\Skype\Phone\

(jesus i didnt know it was that long XD)

So, any questions, reply and ask. :D

Offline Mirror

  • Newbie
  • *
  • Posts: 0
    • View Profile
Re: Change model without changing behavior/style?
« Reply #6 on: September 07, 2015, 02:47:58 AM »
Thanks for the help so far. Looks like I was missing a few steps, or at least, a lot of stuff that makes it easier.

So I got to the point where it compiled it, and replaced it, however it doesn't do anything in the game. Does it only execute it when you play the game that script is associated with? If so, how can I get it to work during normal gameplay?

Offline DaBOSS54320

  • Hero Member
  • ****
  • Posts: 3,398
  • Gender: Female
    • View Profile
Re: Change model without changing behavior/style?
« Reply #7 on: September 07, 2015, 04:14:21 AM »
In reality you can replace ANY script, just be careful because if you don't include the original script with your replacement then obviously the functionality that script was supposed to provide won't be available to the game (and thus the game may mess up)

Replace ArcRace1.lur: the script will run when you use the arcade machine in the boy's dorm.
If you replace ArcRace1.lur, you'll only need to provide 2 functions. MissionSetup and main. MissionSetup will run first then main. The script actually expects 3 functions (MissionCleanup being the third) but I sort of consider it optional because if you don't use it the script will just stop working and MissionCleanup isn't called until the script is terminated so it doesn't matter if you have it or not really.

Replace STimeCycle.lur: the script will run once when the game starts and will keep running. I've been told there are parts of the game this script will restart but I've never experienced it myself.
If you replace STimeCycle.lur you should include the original STimeCycle functions (http://pastebin.com/eAV2U6nj) and main. This is not a mission script so you don't use MissionSetup or MissionCleanup.

Offline Mirror

  • Newbie
  • *
  • Posts: 0
    • View Profile
Re: Change model without changing behavior/style?
« Reply #8 on: September 07, 2015, 04:54:08 AM »
Well, I ended up finding the STimeCycle stuff, and so I replaced it (keeping the original functions and everything)

However,  pasting the code there doesn't seem to do anything. I still don't know where it's supposed to go, be it posting it outside of any functions, or making a new function and then using it somehow.

Edit: If I put the code outside of any functions, I DO get a difference, but that difference is Jimmy growing taller with a messed up jaw and a female walk cycle and idle pose -___-
It's like it changed the skeleton but not the model or textures.
« Last Edit: September 07, 2015, 04:58:59 AM by Mirror »

Offline DaBOSS54320

  • Hero Member
  • ****
  • Posts: 3,398
  • Gender: Female
    • View Profile
Re: Change model without changing behavior/style?
« Reply #9 on: September 07, 2015, 06:02:38 AM »
The PlayerSwapModel and PedSwapModel functions don't just change your appearance but a lot of info about the ped. STimeCycle.lur won't help that but I was just helping you with that since you asked how to make your script run in free-roam.

The reason you got a deformed Jimmy was probably because you called the function before the ped models loaded so it didn't set the model on you but other info did change (such as size which deformed you).

All code outside of any other functions (in global scope) will run first. Then the main function.

I don't know how you can do this, I've tried to figure it out myself but without any luck.

Offline AlphaTech

  • LostInSpace
  • Sr. Member
  • ***
  • Posts: 758
  • Gender: Male
  • The name's AlphaTECH, whatca need help with?! :)
    • View Profile
Re: Change model without changing behavior/style?
« Reply #10 on: September 07, 2015, 01:49:55 PM »
Welcome to the board nice to see new members. Go to my tutorial on script modding it should help you with your setup. I'll add model swapping and style changing also.

Offline Mirror

  • Newbie
  • *
  • Posts: 0
    • View Profile
Re: Change model without changing behavior/style?
« Reply #11 on: September 07, 2015, 02:26:57 PM »
Well, here's what I did


I set it to change the model on a button press, which works,
However, it still ends up messing with the behavior. In that example I used one of the girls, and she still counters with the kick in the balls move (When grappled), and Authority doesn't behave normally (ignores everything you do)

In Cfaction part, you'll notice that I tried making it so it changes your faction and stuff all the time. However it doesn't fix the problem,  and as long as the...
 PedSetActionTree(gPlayer, "/Global/Player", "Act/Player.act")

...Part is there, it resets your animation constantly (cant do any actions).

Any ideas where I should go from here? Is there more to behavior that needs to be changed?

« Last Edit: September 07, 2015, 02:29:04 PM by Mirror »

Offline DaBOSS54320

  • Hero Member
  • ****
  • Posts: 3,398
  • Gender: Female
    • View Profile
Re: Change model without changing behavior/style?
« Reply #12 on: September 07, 2015, 02:37:53 PM »
Well as I said the PlayerSwapModel function changes a lot of the player ped's details. In your script you try to reset the action tree and AI tree but that still will only do so much. Perhaps there is a way to set your clothing to set your model?

I've tried it before but I never got it working. Maybe though if you experiment enough you'll figure something out. Here's a little bit of the SCloth.lur script (the script that defines player outfits)

Code: [Select]
  local l_1_0 = true
  local l_1_1 = false
  local l_1_2 = true
  local l_1_3 = false
  ClothingDefineOutfit("Starting", "CLT_Start", "Hair", "B_Jacket6", "none", "none", "B_Pants2", "P_Sneakers2", l_1_2, l_1_1)
  ClothingDefineOutfit("Uniform", "CLT_Uniform", "Hair", "S_Sweater5", "none", "none", "S_Pants1", "P_Sneakers2", l_1_3, l_1_1)
  ClothingDefineOutfit("Russell", "CLT_Russell", "DOlead_Russell", "DOlead_Russell", "none", "none", "DOlead_Russell", "DOlead_Russell", l_1_2, l_1_1)
  ClothingDefineOutfit("Beatrice", "CLT_Beatrice", "NDGirl_Beatrice", "NDGirl_Beatrice", "none", "none", "NDGirl_Beatrice", "NDGirl_Beatrice", l_1_2, l_1_1)
  ClothingDefineOutfit("Lola", "CLT_Lola", "GRGirl_Lola", "GRGirl_Lola", "none", "none", "GRGirl_Lola", "GRGirl_Lola", l_1_2, l_1_1)
(There's more but I didn't want to share the entire script since I wasn't the one who decompiled it)

As you can see there is some outfits that do indeed work with the player by just using ClothingSetPlayerOutfit, and there is also some outfits that look like they could be NPC models... interesting stuff.

Offline Mirror

  • Newbie
  • *
  • Posts: 0
    • View Profile
Re: Change model without changing behavior/style?
« Reply #13 on: September 07, 2015, 04:28:11 PM »
Hm, can't really see anything that I can work with there. (Then again I'm not sure I could even change outfits)

To update, at least with female characters, changing the gender to male  fixes the behavior problem for the player.
You can do it by extracting default.idb from the ide.img file, editing it with a hex editor, and then changing the gender, ( I did it based off this tutorial)
https://www.bully-board.com/index.php?topic=14726.0

Of course, this seems to have had the side effect of making that npc not appear. Huh.
I assume if you could edit default.idb easier, you could add custom peds and switch to them without effecting anything else.
Or maybe I should have just edited the player part of default.idb to have the different model? Hmm..

Offline DaBOSS54320

  • Hero Member
  • ****
  • Posts: 3,398
  • Gender: Female
    • View Profile
Re: Change model without changing behavior/style?
« Reply #14 on: September 08, 2015, 01:47:34 AM »
Fun fact: default.ide is a plain-text version of default.idb (editing it will have no effect though, the default.idb is the file that's used)

If you are a model of a ped that has a unique model status of 1 then that ped won't spawn anymore since you are that ped and the game won't allow anymore to spawn.