Page 1 of 1

LUA SetClassProperty commands questions (SOLVED)

Posted: Tue Oct 27, 2009 12:49 pm
by yukisuna
yes, i have read all the lua threads, but i couldnt find what to write; i tryed SetClassProperty("myweaponname","Shotdelay*",0.3) and such but nothing happens!


* SingleClick/SalvoCount/SalvoDelay etc.


and, is it possible to change a weapons ordnance commands (MaxDamage/DamageFinalDamage etc.) this way?


i read what SHOOT ME DEAD! wrote, and he said he could change weapon properties, so i thought i should ask some of the professional lua coders...

ok, thank you! :D

Re: LUA SetClassProperty commands questions

Posted: Tue Oct 27, 2009 12:56 pm
by mswf
No. (If I remember this correctly)
You cannot edit .odf properties through .lua commands. I'm not sure about this, but you could try to let the .lua activate parts of the .odf that are already in the .odf.

Re: LUA SetClassProperty commands questions

Posted: Tue Oct 27, 2009 1:10 pm
by MandeRek
mswf wrote:No. (If I remember this correctly)
You cannot edit .odf properties through .lua commands. I'm not sure about this, but you could try to let the .lua activate parts of the .odf that are already in the .odf.
Not entirely true, you can change all properties for an unit/vehicle/prop odf, which are possible parameters for those (so not "SkeletonLowrez" for vehicles, etc.) Weapons are not to be changed through lua. What I suggest, is make another weapon odf with the changes you want, and add this line:
Hidden/Spoiler:
SetClassProperty("theclassusingthenewweapon", "WeaponName1"(or 2, 3, whatever slot it's in), "newweaponodfname")
The weaponodf, however, needs to be loaded. I did this by making a 'dummyunit' odf, with this as a weapon, and I didn't use it in the teamsetup. Still, all weapons he has will be loaded Note: This is how i changed the old BF0 heroes; i made a new dummyunit in a new side, with a lot of new forcepowers, and changed the old unit odfs through these SetClassProperty lines to have the new weapons ;)

Re: LUA SetClassProperty commands questions (SOLVED)

Posted: Wed Oct 28, 2009 6:29 pm
by [RDH]Zerted
MandeRek is right. We can't change weapon properties through the Lua the way you want to change them.

MandeRek's work around is the best way to do it. However if you only wanted to change the weapon's damage, another way to do it would be to listen for objects being damaged. When the object is damaged, check to see what weapon damaged it. If it's the right weapon, increase/decrease the object's health based on how you wanted to change the weapon.