Page 1 of 1

Fixing Buggy Classes

Posted: Wed Apr 06, 2016 3:00 am
by MrMew
Is it possible to fix a buggy class such as the ep2 jet trooper from the kamino campaign level. Whenever award pistol is given and the weapon switched the game will crash.
And can I give the jet trooper with the sniper rifle the ability to jet?

Re: Fixing Buggy Classes

Posted: Wed Apr 06, 2016 4:52 am
by Anakin
1) i never noticed that bug are you using custom units??
2) fakeconsole can add jet to every unit

Re: Fixing Buggy Classes

Posted: Wed Apr 06, 2016 2:11 pm
by AnthonyBF2
The manual way to fix is these steps:

- Reference rep_inf_default_jettrooper.odf
1) Copy the award weapon slots data from rep_inf_default_jettrooper.odf to rep_inf_ep2_jettrooper_rifleman.odf
2) Erase the jetpack flying codes in rep_inf_ep2_jettrooper_sniper.odf and copy over all of the jetpack information from rep_inf_default_jettrooper.odf

Re: Fixing Buggy Classes

Posted: Thu Apr 07, 2016 2:14 am
by MrMew
I assume these are the odfs in C:\BF2_ModTools\assets\sides\rep\odf, because I tried doing that for the sniper and it still doesn't have a jump jet.

Re: Fixing Buggy Classes

Posted: Thu Apr 07, 2016 3:16 am
by AnthonyBF2
MrMew wrote:I assume these are the odfs in C:\BF2_ModTools\assets\sides\rep\odf, because I tried doing that for the sniper and it still doesn't have a jump jet.
You are not supposed to edit the files in the assets folder. You need to look up the tutorial for how to create a custom side and then you edit the odf files in the custom side then you will get your changes.

Re: Fixing Buggy Classes

Posted: Thu Apr 07, 2016 5:17 am
by MrMew
Diet Dr. Pepper. So I cant just add a line to the game mode Luas to change this at all?

Re: Fixing Buggy Classes

Posted: Thu Apr 07, 2016 9:52 am
by AnthonyBF2
You can using SetClassProperty.
Look in the ODF files for what commands you need and manipulate the character using SetClassProperty with the ODF setting you want to change. In an ODF file, anything under [Properties] can be changed with SetClassProperty.

Re: Fixing Buggy Classes

Posted: Fri Apr 08, 2016 1:31 am
by MrMew
Is this close to being right:
SetClassProperty("rep_inf_ep2_jettrooper_sniper", "JetJump = "5.0" ")
SetClassProperty("rep_inf_ep2_jettrooper_sniper", "JetPush = "8.0" ")
SetClassProperty("rep_inf_ep2_jettrooper_sniper", "JetAcceleration = "30.0" ")
SetClassProperty("rep_inf_ep2_jettrooper_sniper", "JetEffect = "rep_sfx_jetpack" ")
SetClassProperty("rep_inf_ep2_jettrooper_sniper", "JetType = "hover" ")
SetClassProperty("rep_inf_ep2_jettrooper_sniper", "JetFuelRechargeRate = "0.12" ")
SetClassProperty("rep_inf_ep2_jettrooper_sniper", "JetFuelCost = "0.16" ")
SetClassProperty("rep_inf_ep2_jettrooper_sniper", "JetFuelInitialCost = "0.25" ")
SetClassProperty("rep_inf_ep2_jettrooper_sniper", "JetFuelMinBorder = "0.24" ")

I got an error while munging:

C:\BF2_ModTools\ToolsFL\Bin\luac.exe: ..\..\common\scripts\123\123g_eli.lua:18: `)' expected near `5.0'
ERROR[scriptmunge scripts\123\123g_eli.lua]:Could not read input file.ERROR[scriptmunge scripts\123\123g_eli.lua]:Could not read input file. [continuing]
2 Errors 0 Warnings

ERROR[levelpack mission\123g_eli.req]:Expecting bracket, but none was found.
File : munged\pc\123g_eli.script.req(1)...

ucft <--
ERROR[levelpack mission\123g_eli.req]:Expecting bracket, but none was found.
File : munged\pc\123g_eli.script.req(1)...

ucft <--

2 Errors 0 Warnings

Not really sure what the errors regarding the ucft is.

Re: Fixing Buggy Classes

Posted: Fri Apr 08, 2016 1:51 am
by AnthonyBF2
You never use = inside of SetClassProperty or SetProperty (for objects)

Your should be:

Code: Select all

SetClassProperty("rep_inf_ep2_jettrooper_sniper", "JetJump", "5.0")
SetClassProperty("rep_inf_ep2_jettrooper_sniper", "JetPush", "8.0")
SetClassProperty("rep_inf_ep2_jettrooper_sniper", "JetAcceleration", "30.0")
SetClassProperty("rep_inf_ep2_jettrooper_sniper", "JetEffect", "rep_sfx_jetpack")
SetClassProperty("rep_inf_ep2_jettrooper_sniper", "JetType", "hover")
SetClassProperty("rep_inf_ep2_jettrooper_sniper", "JetFuelRechargeRate", "0.12")
SetClassProperty("rep_inf_ep2_jettrooper_sniper", "JetFuelCost", "0.16")
SetClassProperty("rep_inf_ep2_jettrooper_sniper", "JetFuelInitialCost", "0.25")
SetClassProperty("rep_inf_ep2_jettrooper_sniper", "JetFuelMinBorder", "0.24")
SetClassProperty("", "", "")
The first "" is the slot for the class you're going to manipulate. The second "" slot is the class's ODF property you're changing, and the third "" slot is for the values.

Re: Fixing Buggy Classes

Posted: Fri Apr 08, 2016 6:10 am
by MrMew
Hypothetically what happens if I may have accidentally edited a file in the asset file and munge a new world? Would it warrant a spawn bug for that unit?

Re: Fixing Buggy Classes

Posted: Fri Apr 08, 2016 9:32 am
by AnthonyBF2
The "spawn bug" is a multiplayer only error which happens randomly. The files in the assets folder are to be used as a reference or to make custom sides. Nothing terrible will happen but I would recommend backing up your project folder and re-installing mod tools.

Re: Fixing Buggy Classes

Posted: Sat Apr 09, 2016 3:56 am
by MrMew
The spawn bug was occurring in SP, but it appears it was due to the script. So that's fixed. However I've been playing around with changing weapons using the lua (makes getting a jet trooper with sniper easier), and is there some sort of issue when replacing the primary weapon of the rep_inf_ep3_officer (clone commander class) with the rep_inf_rifle, because as soon as I start the map the game crashes. And the weapon is loaded because another unit with the weapon is in the script.

Re: Fixing Buggy Classes

Posted: Sat Apr 09, 2016 9:36 am
by AnthonyBF2
I know you can change primary weapons with SetClassProperty, I am unsure with unlockable weapons. For the primary 4 slots, the Property you would change is:

WeaponName1 Sniper rifle, shotgun, rockets
WeaponName2 pistol, command pistol
WeaponName3 and WeaponName4 are throwable items like detpacks and grenades