Fractal Softworks Forum

Please login or register.

Login with username, password and session length

Author Topic: Can I modifiy shot properties during a shot's lifetime?  (Read 2510 times)

rogerbacon

  • Commander
  • ***
  • Posts: 151
    • View Profile
Can I modifiy shot properties during a shot's lifetime?
« on: January 02, 2016, 06:44:16 AM »

I'm thinking of creating a weapon that fires expanding projectiles. I'd like to be able to alter the shot's size and collisionRadius over the shot's lifetime. Is this possible? Has anyone done anything like this?

Logged

Snrasha

  • Admiral
  • *****
  • Posts: 705
    • View Profile
Re: Can I modifiy shot properties during a shot's lifetime?
« Reply #1 on: January 02, 2016, 07:17:06 AM »

Maybe:  (CombatEngineAPI engine)
engine.spawnProjectile(ship, weapon, weaponId, origin, amount, shipVelocity)

When you add a script everyframeweaponeffectplugin.   You can give multiple thing, also change damage(if firing: more turn rate, for example with a beam)

After test (and for me, shotlife time = distance projectile with weapon), my weapon have 0 damage at 200 range, 9999 between 200 at 800 then 0.
« Last Edit: January 02, 2016, 10:52:22 AM by Snrasha »
Logged
I am pretty bad on english. So, sorry in advance.

Gladiator Society
Add battle options on Com Relay/ Framework for modders for add their own bounty.

Sanguinary Autonomist Defectors A fan-mod of Shadowyard.

StarSchulz

  • Captain
  • ****
  • Posts: 458
    • View Profile
Re: Can I modifiy shot properties during a shot's lifetime?
« Reply #2 on: January 02, 2016, 01:44:35 PM »

The only thing i can think of is the orion artillery from the SCY mod. the shot starts out slow but increases in velocity as it goes.

Snrasha

  • Admiral
  • *****
  • Posts: 705
    • View Profile
Re: Can I modifiy shot properties during a shot's lifetime?
« Reply #3 on: January 02, 2016, 02:07:02 PM »

My weapon can easy now decrease damage with range and increase velocity. But, i have not idea how change size of the projectile...


EDIT: Now i have ALL MY WEAPON WHO HAVE 100% shoot ennemi.  You know Vulcan weapon? With homing projectile? xD
« Last Edit: January 02, 2016, 02:29:34 PM by Snrasha »
Logged
I am pretty bad on english. So, sorry in advance.

Gladiator Society
Add battle options on Com Relay/ Framework for modders for add their own bounty.

Sanguinary Autonomist Defectors A fan-mod of Shadowyard.

Zaphide

  • Admiral
  • *****
  • Posts: 799
    • View Profile
Re: Can I modifiy shot properties during a shot's lifetime?
« Reply #4 on: January 03, 2016, 03:09:19 AM »

You can alter the collision radius (I assume) with DamagingProjectileAPI.SetCollisionRadius().

I have a script (EveryFrameWeaponEffectPlugin) that alters projectiles launched by a weapon every frame. Basic structure is (within the advance() method):
Code
for (DamagingProjectileAPI proj : engine.getProjectiles())
            {
                if(proj == null || proj.getProjectileSpecId() == null || !proj.getProjectileSpecId().equalsIgnoreCase("your_projectile_spec_id"))
                    continue; // Skip projectiles we don't care about

                if(proj == null || !proj.getWeapon().equals(weapon))
                    continue; // Skip projectiles that were not fired by this weapon

                // Found projectile so do stuff to it
                ....
            }
 
             

But I can't see a way to adjust the size. Perhaps you could despawn the projectile and respawn it (but bigger) with the same velocity?

Code to remove is simple:
Code
engine.removeEntity(proj);

and then you could spawn a new projectile in same place with same velocity. Seems kind of a roundabout way to do it but you could request API changes :)
Logged