Page 1 of 1

Getting unit to flee

Posted: Sun Jul 17, 2016 3:51 am
by SkinnyODST
I want to make the clone officer flee instead of die. And only him. How is this done?

Thanks

Re: Getting unit to flee

Posted: Sun Jul 17, 2016 4:08 am
by AnthonyBF2
SetClassProperty("rep_inf_ep3_officer", "FleeLikeAHero", "1")

Re: Getting unit to flee

Posted: Sun Jul 17, 2016 6:50 am
by SkinnyODST
SetClassProperty("rep_inf_ep3_officer", "FleeLikeAHero", "1")
Thanks!

Re: Getting unit to flee

Posted: Sun Jul 17, 2016 6:53 am
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

Re: Getting unit to flee

Posted: Sun Jul 17, 2016 6:57 am
by SkinnyODST
SetClassProperty("rep_inf_ep3_officer", "FleeLikeAHero", "1")
so would I do the same thing to give the chaingun limited ammo??

Re: Getting unit to flee

Posted: Sun Jul 17, 2016 7:11 am
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.

Re: Getting unit to flee

Posted: Sun Jul 17, 2016 9:53 pm
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")

Re: Getting unit to flee

Posted: Sun Jul 17, 2016 11:14 pm
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.

Re: Getting unit to flee

Posted: Wed Jul 20, 2016 7:08 pm
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.