Getting unit to flee
Posted: Sun Jul 17, 2016 3:51 am
I want to make the clone officer flee instead of die. And only him. How is this done?
Thanks
Thanks
Thanks!SetClassProperty("rep_inf_ep3_officer", "FleeLikeAHero", "1")
You should review the list of ODF parameters. You can manipulate just about anything with SetClassProperty if you know what to target and change.SkinnyODST wrote:Thanks!SetClassProperty("rep_inf_ep3_officer", "FleeLikeAHero", "1")
so would I do the same thing to give the chaingun limited ammo??SetClassProperty("rep_inf_ep3_officer", "FleeLikeAHero", "1")
SetClassProperty("", "", "")SkinnyODST wrote:Oh and also, would I do the same thing to give the chaingun limited ammo??SetClassProperty("rep_inf_ep3_officer", "FleeLikeAHero", "1")
The chaingun still has infinite ammo, I want it to have like 500 ammo or something.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.
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.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")
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 RoundsPerClipAnthonyBF2 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.