Getting unit to flee

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
SkinnyODST
Lieutenant Colonel
Lieutenant Colonel
Posts: 545
Joined: Mon Jul 04, 2016 10:56 pm
Location: My other account
Contact:

Getting unit to flee

Post by SkinnyODST »

I want to make the clone officer flee instead of die. And only him. How is this done?

Thanks
User avatar
AnthonyBF2
Sith
Sith
Posts: 1255
Joined: Wed Aug 21, 2013 3:55 pm
Projects :: PS2+PSP Overhaul

Re: Getting unit to flee

Post by AnthonyBF2 »

SetClassProperty("rep_inf_ep3_officer", "FleeLikeAHero", "1")
SkinnyODST
Lieutenant Colonel
Lieutenant Colonel
Posts: 545
Joined: Mon Jul 04, 2016 10:56 pm
Location: My other account
Contact:

Re: Getting unit to flee

Post by SkinnyODST »

SetClassProperty("rep_inf_ep3_officer", "FleeLikeAHero", "1")
Thanks!
User avatar
AnthonyBF2
Sith
Sith
Posts: 1255
Joined: Wed Aug 21, 2013 3:55 pm
Projects :: PS2+PSP Overhaul

Re: Getting unit to flee

Post by AnthonyBF2 »

SkinnyODST wrote:
SetClassProperty("rep_inf_ep3_officer", "FleeLikeAHero", "1")
Thanks!
You should review the list of ODF parameters. You can manipulate just about anything with SetClassProperty if you know what to target and change.

You can also do a lot with SetProperty which is for objects and map items. SetClassProperty is for anything that's a controllable entity such a vehicle or troops.

http://www.secretsociety.com/forum/down ... meters.txt
SkinnyODST
Lieutenant Colonel
Lieutenant Colonel
Posts: 545
Joined: Mon Jul 04, 2016 10:56 pm
Location: My other account
Contact:

Re: Getting unit to flee

Post by SkinnyODST »

SetClassProperty("rep_inf_ep3_officer", "FleeLikeAHero", "1")
so would I do the same thing to give the chaingun limited ammo??
User avatar
AnthonyBF2
Sith
Sith
Posts: 1255
Joined: Wed Aug 21, 2013 3:55 pm
Projects :: PS2+PSP Overhaul

Re: Getting unit to flee

Post by AnthonyBF2 »

SkinnyODST wrote:
SetClassProperty("rep_inf_ep3_officer", "FleeLikeAHero", "1")
Oh and also, would I do the same thing to give the chaingun limited ammo??
SetClassProperty("", "", "")

I'm going to do a quick run down for this code. The first set of brackets is the target. In the target bracket, you can put the string name for a vehicle, turret, troop or anything else that can be controlled by human or AI. The second bracket is the target what slot. This is where you fill in what you want to change about the target. The last set of brackets is the value brackets, this is where you put your value of what you want to happen.

In the ODF parameter list you can see a list of anything that makes anything in the game work. For example, under the Soldier class you would find things like MaxHealth, MaxSpeed, JumpHeight, etc.

In your case of wanting unlimited ammo, you'd first check the weapon slot of the weapon you want to be unlimited. Let's say the weapon slot is 4. You'd fill in the target bracket for the character with the weapon, the second bracket with WeaponAmmo4 and the value bracket with 0. Using 0 may seem odd but that's how the ODF processing works, in the SWBF2 game engine, 0 often equals infinite. Using 0 allows a weapon ammo to be unlimited.

Once you learn ODF and SetClassProperty you can do tons of things that would normally require building entirely new sides, which is a whole different thing to learn. ODF + SetClassProperty is pretty much a huge shortcut. A person could compile a new all.lvl that totals 178MB just for a few small tweaks like ammo and health, or they could use 3 or 4 lines of Lua code to get the same outcome. Review the ODF list again and again. I still use this list to this day after modding for years to see if there's anything I never used or forgot about or to find something I need to produce a desired outcome.
SkinnyODST
Lieutenant Colonel
Lieutenant Colonel
Posts: 545
Joined: Mon Jul 04, 2016 10:56 pm
Location: My other account
Contact:

Re: Getting unit to flee

Post by SkinnyODST »

SetClassProperty("", "", "")

I'm going to do a quick run down for this code. The first set of brackets is the target. In the target bracket, you can put the string name for a vehicle, turret, troop or anything else that can be controlled by human or AI. The second bracket is the target what slot. This is where you fill in what you want to change about the target. The last set of brackets is the value brackets, this is where you put your value of what you want to happen.

In the ODF parameter list you can see a list of anything that makes anything in the game work. For example, under the Soldier class you would find things like MaxHealth, MaxSpeed, JumpHeight, etc.

In your case of wanting unlimited ammo, you'd first check the weapon slot of the weapon you want to be unlimited. Let's say the weapon slot is 4. You'd fill in the target bracket for the character with the weapon, the second bracket with WeaponAmmo4 and the value bracket with 0. Using 0 may seem odd but that's how the ODF processing works, in the SWBF2 game engine, 0 often equals infinite. Using 0 allows a weapon ammo to be unlimited.

Once you learn ODF and SetClassProperty you can do tons of things that would normally require building entirely new sides, which is a whole different thing to learn. ODF + SetClassProperty is pretty much a huge shortcut. A person could compile a new all.lvl that totals 178MB just for a few small tweaks like ammo and health, or they could use 3 or 4 lines of Lua code to get the same outcome. Review the ODF list again and again. I still use this list to this day after modding for years to see if there's anything I never used or forgot about or to find something I need to produce a desired outcome.
The chaingun still has infinite ammo, I want it to have like 500 ammo or something.
This is what I did
SetClassProperty("rep_weap_inf_chaingun", "WeaponAmmo2", "5")

Then I tried this
SetClassProperty("rep_inf_ep3_officer", "WeaponAmmo2", "5")
User avatar
AnthonyBF2
Sith
Sith
Posts: 1255
Joined: Wed Aug 21, 2013 3:55 pm
Projects :: PS2+PSP Overhaul

Re: Getting unit to flee

Post by AnthonyBF2 »

Attempt one is a guaranteed failure because SetClassProperty doesn't work on weapons, a gun isn't a class. Attempt two looks good and there is nothing wrong with it. The issue is that the weapon is built as a heat up / cool down type so it doesn't use an ammo count. To make an ammo limit for a recharge type weapon you'd have to build a new side and edit the weapon ODF file manually.
ZoomV
Rebel Warrant Officer
Rebel Warrant Officer
Posts: 308
Joined: Thu Aug 15, 2013 11:27 am
Projects :: Old Republic Map pack
Games I'm Playing :: BF2 SWTOR and GW2
xbox live or psn: No gamertag set
Location: Belsavis, Maximum Security Ward

Re: Getting unit to flee

Post by ZoomV »

SkinnyODST wrote:
The chaingun still has infinite ammo, I want it to have like 500 ammo or something.
This is what I did
SetClassProperty("rep_weap_inf_chaingun", "WeaponAmmo2", "5")

Then I tried this
SetClassProperty("rep_inf_ep3_officer", "WeaponAmmo2", "5")
You have to set the chaingun itself to use ammo. Setting the commander's weaponammo property only sets the number of clips the weapon has, which is meaningless if the weapon has infinite shots per clip.

rep_inf_chaingun needs to have RoundsPerClip property set to something non-negative in order for ammo to become limited.
AnthonyBF2 wrote:Attempt one is a guaranteed failure because SetClassProperty doesn't work on weapons, a gun isn't a class. Attempt two looks good and there is nothing wrong with it. The issue is that the weapon is built as a heat up / cool down type so it doesn't use an ammo count. To make an ammo limit for a recharge type weapon you'd have to build a new side and edit the weapon ODF file manually.
Technically heat and ammo are not mutually exclusive. Weapons can be either or, but can also be both heat and ammo based at the same time. In fact as far as the engine is concerned all weapons are both heat and ammo based, however ammo weapon simply don't have a heatpershot value and heat weapons lack a RoundsPerClip

Fun Fact: the original build for my TORfront mod used weapons that where both ammo and heat. I scrapped this since it was somewhat awkward as the UI portrays heat weird when ammo is still in play. However the operative's rifle still uses both ammo and heat.
Post Reply