Jump to content

_Tally

Member
  • Content Count

    7
  • Joined

  • Last visited

  • Medals

Posts posted by _Tally


  1. fnc_launcherHandler = { 
    params ["_man"];
    private _handler =
    _man addEventHandler ["FiredMan", {
    	params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle"];
    	if(_weapon == secondaryWeapon _unit)
    	then{
    		_unit setVariable ["TALLY_launched", true];
    		_unit removeEventHandler [_thisEvent, _thisEventHandler];
    		systemChat "unit fired launcher";
    	};
    }];
    
    _handler;
    };
    
    
    fnc_forceLauncherFire = { 
    params["_man", "_wantedDir"];
    
    private _handler = [_man] call fnc_launcherHandler;
    private _launcher = secondaryWeapon _man;
    private _mode = (getArray (configFile >> "CfgWeapons" >> _launcher >> "modes"))#0;
    private _fired = (_man getVariable ["TALLY_launched", false]);
    private _timer = time +5;
    
    waitUntil {
    
    	if(!isNil "_wantedDir"
    	&&{(round _wantedDir) != (round(getDir _man))
    	&&{(_timer -  time)>= 1}})
    	then{_man setDir _wantedDir};
    
    	_man forceWeaponFire [_launcher, _mode];
    	_fired = (_man getVariable ["TALLY_launched", false]);
    	((time > _timer) || _fired);
    	};
    
    sleep 1;
    
    if!(_fired)then{_man removeEventHandler ["FiredMan", _handler];};
    _man setVariable ["TALLY_launched", nil];
    
    true;
    };

    This one works for me. Basically you got to spam the forceFire-command until he actually completes the action. Then use an eventHandler to kill the loop as soon as the launcher has been fired.
    Also it is far far from accurate so you might need to plug in some missile-guidance scripts.


  2. So i found a workaround (Not ideal, but it works):

    Private _OrgText = (GetObjectTextures Player select 0);
            
            {Player SetObjectTexture [0, _x]; Sleep 0.05} ForEach _CustomTextures;
            
            Player SetObjectTexture [0, _OrgText];

    _CustomTextures refers to an array that contains all the custom Textures in the mission. I use this fnc at InitPlayerLocal.sqf And it works like a charm!

    • Like 2
×