Forged Alliance Forever Forged Alliance Forever Forums 2015-08-06T03:27:11+02:00 /feed.php?f=53&t=10493 2015-08-06T03:27:11+02:00 2015-08-06T03:27:11+02:00 /viewtopic.php?t=10493&p=106796#p106796 <![CDATA[Re: Changing Weapon data]]>
Don't know much about the blueprint stuff, though.

Statistics: Posted by Turkey — 06 Aug 2015, 03:27


]]>
2015-08-03T11:40:08+02:00 2015-08-03T11:40:08+02:00 /viewtopic.php?t=10493&p=106472#p106472 <![CDATA[Changing Weapon data]]>
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:
   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

Statistics: Posted by Jip — 03 Aug 2015, 11:40


]]>