Jump to content
Phantom Hawk

How to remove missiles form a static turret when fired

Recommended Posts

Im working on a custom static missile launcher and im wondering how to make the missiles disappear once they are fired anyone know how?

Share this post


Link to post
Share on other sites

Use a hide animation, defined in model.cfg. Here some sample for the mk29 sea sparrow launcher:

class CfgSkeletons {
        class mk29 {
                isDiscrete=1;
                skeletonInherit = "";
                skeletonBones[]= {
                        "mainTurret","",
                        "MainGun","mainTurret",
                        "caps","MainGun",
                        "cap1", "MainGun",
                        "cap2", "MainGun",
                        "cap3", "MainGun",
                        "cap4", "MainGun",
                        "cap5", "MainGun",
                        "cap6", "MainGun",
                        "cap7", "MainGun",
                        "cap8", "MainGun"
                };
        };
...
class CfgModels {
        class mk29 {
                SectionsInherit = "";
                Sections[] = {"mainTurret", "mainGun"};
                SkeletonName = "mk29";
                class Animations {
...
						class cap1 {
                                type = "hide";
                                source = "cap1_source";
                                selection = "cap1";
                                minValue = 0;
                                maxValue = 1;
                                hideValue = 0.5;
                        };
...

Code for the fired eventhandler that hides the capX_source and spawns the missile at the right place:

 

// Written by TeTeT for Nimtech
// move missile spawn point and cap hiding around

//      fired = "(_this select 0) animateSource ['cap1_source', 1]; [_this select 0,_this select 6,'rim7_spawn1','MissileBase'] call BIS_fnc_missileLaunchPositionFix;";

// params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_mag", "_projectile"];
params ["_unit", "_projectile"];

// systemChat str (vehicle _unit);
// systemChat str _projectile;

private _missileSpawns = [
        ['cap1_source', 'rim7_spawn1'],
        ['cap2_source', 'rim7_spawn2'],
        ['cap3_source', 'rim7_spawn3'],
        ['cap4_source', 'rim7_spawn4'],
        ['cap5_source', 'rim7_spawn5'],
        ['cap6_source', 'rim7_spawn6'],
        ['cap7_source', 'rim7_spawn7'],
        ['cap8_source', 'rim7_spawn8']
];

// implicitly initializing currentMissile to 0
private _currentMissile = _unit getVariable ["currentMissile", 0];
private _missileSpawn = _missileSpawns select _currentMissile;

// systemChat str _missileSpawn;
_unit animateSource [_missileSpawn select 0, 1, true];
[_unit, _projectile, _missileSpawn select 1, 'MissileBase'] call BIS_fnc_missileLaunchPositionFix;

private _nextMissile = (_currentMissile + 1) % (count _missileSpawns);
_unit setVariable ["currentMissile", _nextMissile, true];

// systemChat str _nextMissile;

// place caps on, probably better in a reloaded event handler?
if (_nextMissile isEqualTo 0) then {
        [_unit, _missileSpawns] spawn {
                params ["_unit", "_missileSpawns"];
                sleep 1;
                {
                        _unit animateSource [_x select 0, 0];
                        sleep 0.1;
                } forEach _missileSpawns;
                _unit;
        };
};
_unit;

 

Share this post


Link to post
Share on other sites
19 hours ago, Phantom Hawk said:

Do you have a model set up for this I could use for reference?

 

Nope, sorry, the sea sparrow launcher and RAM that uses this is not even released yet.

Share this post


Link to post
Share on other sites

I am wondering if you mean stationary, instead of static? I ask because I will be creating some stationary defense systems myself (eventually), but I want them to have soldier interaction. In my mind I thought they would be done as if a vehicle, but give them zero power to move - effectively making them stationary. "Static" sounds like not even turret animations, but maybe that's just me.

Try making it an unpowered vehicle if you want animation and interactive use.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×