I've been figuring out the scripting possibilities in Supreme Commander and they appear to be endless.
Right now I'm trying to change weapons real time (or, currently: at initialization).
However, this appears to work quite strangely or not work at all.
- Code: Select all
group = ScenarioUtils.CreateArmyGroup("Hostiles", "SpecialDefend_"..faction);
for c, defense in group do
local defenseMultiplier = 5;
local WeaponA = defense:GetWeapon(1);
-- Radius is changed, damage is not.
-- Increase the damage and range.
WeaponA:ChangeDamage(110);
WeaponA:ChangeMaxRadius (150);
-- This does change the damage however.
defense:GetBlueprint().Weapon[1].Damage = 110;
-- Works
-- Increase rate of fire (ROF) and adds randomness
WeaponA:SetFiringRandomness(1);
WeaponA:ChangeRateOfFire(3);
local WeaponBluePrint = WeaponA:GetBlueprint();
-- Doesn't work at all
WeaponBluePrint.MuzzleVelocity = 100;
WeaponBluePrint.ProjectileLifetime = 50;
-- But it does show the changes.
LOG(repr(Weapon));
LOG(repr(defense));
defense:SetCanTakeDamage(false);
end
Now my question is: How do I change for example the muzzle velocity?
Right now, when you log the blueprint afterwards, it shows that the muzzle velocity (and projectile lifetime) is changed, but it doesn't have any effect ingame.
What am I doing wrong?
Lots of love,
Jip