Jump to content
Sign in to follow this  
cryptonat

Handling Titan Missile Damage

Recommended Posts

I'm currently trying to write an emp missile script.

private["_unit","_damage","_source","_projectile","_part","_curWep"];
_unit = _this select 0;
_part = _this select 1;
_damage = _this select 2;
_source = _this select 3;
_projectile = _this select 4;

_curWep = currentWeapon _source;

if(!isNull _source) then {
	if(_projectile in ["M_Titan_AA","M_Titan_AT","M_Titan_AP"] && _curWep in ["launch_B_Titan_F","launch_I_Titan_F","launch_O_Titan_F","launch_titan_f","launch_B_Titan_short_F","launch_I_Titan_short_F","launch_O_Titan_short_F","launch_titan_short_f"]) then {
			private["_vehicle"];
			_damage = false;
			if(vehicle _unit != _unit) exitWith {};
			_vehicle = vehicle _unit;
			[_vehicle] spawn crypt_fnc_EMP;
	};
};

_damage;

Yes, I have the proper eventhandler set up for the player. The problem is that the missile's damage is not being intercepted and handled. The script doesn't even reach the point where _damage = false;. What am I doing incorrectly?

Thanks.

Edited by cryptonat
spelling

Share this post


Link to post
Share on other sites

https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HandleDamage

the return should be a number, not a bool, and more confusingly it won't be 0 just because you want to disable damage, it should be the damage level you want the target to be at.

"_curWep = currentWeapon _source;" - not guaranteed that the currentweapon will be the missle launcher (travel time)

Share this post


Link to post
Share on other sites

I would split this into two scripts, one that uses a fired event handler, and the one here now, get rid of the currentweapon variable here, stick it in the other script which runs as soon as the weapon is fired, then have that script send over the variable to the script pasted above (if you want maximum efficiency, put an if statement checking for what weapon is fired before sending data).

Share this post


Link to post
Share on other sites

Thanks PabstMirror and austin_Medic. I'll give these tips a shot when I get back from work this evening and let you know how it went.

Share this post


Link to post
Share on other sites

I'm looking at making the Fired event handler script, but what I don't understand is how I am supposed to pass on the damage and script information to the target hit. How would I let the target know the information from this script? Should I just monitor position until objNull of the projectile and apply the EMP script with the nearestObject command? Is there a better way?

Thanks for your input.

EDIT: I guess let me clarify the emp script. Basically all the emp script will do is damage the Engine to 1 for a period of time then restore its damage to the previous value, or even back to 0, don't care I just need to disable the vehicle for a short period of time. Easy enough. But I need to cancel ALL damage from the titan projectile and activate the emp script.

Edited by cryptonat

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
Sign in to follow this  

×