Changing Weapon data

Interesting mapping tools and mapping help.

Moderator: Morax

Changing Weapon data

Postby Jip » 03 Aug 2015, 11:40

Hello everyone,

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
Jip
Avatar-of-War
 
Posts: 51
Joined: 12 Jul 2015, 22:25
Has liked: 3 times
Been liked: 11 times
FAF User Name: Jip

Re: Changing Weapon data

Postby Turkey » 06 Aug 2015, 03:27

As far as I can tell, ChangeDamage(n) just doesn't work. In the past I've worked around it with AddDamageMod(n).

Don't know much about the blueprint stuff, though.
Turkey
Crusader
 
Posts: 26
Joined: 08 Feb 2015, 01:01
Has liked: 2 times
Been liked: 2 times
FAF User Name: Turkey


Return to Mapping

Who is online

Users browsing this forum: No registered users and 1 guest