donpachiyarou 5 Posted February 5, 2023 Hi Im thinking idea that 1.missile fired from soldier to vehicle which has very small vehicle attached to the missile to be able to be locked on from intercepting missile,and this missile go to the vehicle 2. missile which aims to shoot down the fired missile are launched from the aimed vehicle,this missile has ProtectionZone_F attaced to crash into the missile,and this missile go to the small vehicle attached to the missile 3.attack/intercepting missile crash in the air and attached object will deleteted soon player addEventHandler ["FiredMan", { params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle"]; if ( (("M_Titan_AT"==_this select 4) && (random 100 < 30)) or (("M_PG_AT"==_this select 4) && (random 100 < 40)) or (("M_Scalpel_AT"==_this select 4) && (random 100 < 40)) or (("Missile_AGM_01_F"==_this select 4) && (random 100 < 40)) or (("Missile_AGM_02_F"==_this select 4) && (random 100 < 30)) or (("M_NLAW_AT_F"==_this select 4) && (random 100 < 98)) ) then { private _tgt=missileTarget _projectile; private _dirAndUp = [vectorDir _projectile, vectorUp _projectile]; _ggk=createVehicle ["M_NLAW_AT_F",_tgt modeltoworld [0,0,3],[],0,"CAN_COLLIDE"]; private _hdg=[0,0,0] getdir getCameraViewDirection _unit; _ggk setdir (_hdg-180); private _ggkpit=_tgt call BIS_fnc_getPitchBank; [_ggk,((_ggkpit select 0)+5),0] call BIS_fnc_setPitchBank; _dmy2=createVehicle ["ProtectionZone_F",_ggk modeltoworld [0,0,0],[],0,"CAN_COLLIDE"]; _dmy2 setvectorUp[0,0.99,0.01]; _dmy2 setObjectTexture [0,"#(rgb,8,8,3)color(1,0,1,0.5,ca)"]; _dmy2 attachto[_ggk,[0,0,0]]; _dmy2 setObjectScale 0.15; private _position = getPosWorld _projectile; deleteVehicle _projectile; _tama= _ammo; _new = _ammo createVehicle [0,0,0]; _new setPosWorld [_position select 0,(_position select 1)+1.5,(_position select 2)+1.9]; _new setVectorDirAndUp _dirAndUp; _new setMissileTarget _tgt; _dmy=createVehicle ["B_MRAP_01_gmg_F",[0,0,0],[],0,"CAN_COLLIDE"]; _dmy engineOn true; _dmy attachto[_new,[0,5,0]]; _dmy setObjectScale 0.01; _ggk setMissileTarget _dmy; [_unit,_ggk,_new,_dmy2,_dmy] spawn { params ["_unit","_ggk","_new","_dmy2","_dmy"]; while{alive _new}do {sleep 1;systemchat "msl stil alive";}; hint "missile intercepted"; deletevehicle _dmy2;deletevehicle _dmy;}; }; }]; and this code works if Soldier/Vehicle both are on flat place.But if soldier or vehicle are on angled place, intercept missile will crash into the ground or fly into the air Attack missile trace the original route well(=the route if this code doesnt exist) via "SetVectorDirandUp" but intercept missile which is planed to fly along the SetPitchBank&SetDir will not fly along the route which is Attack Missile's reverse/opposite route. So,I think,if i can make the Attack Missile's "_dirAndUp" become Opposite Vector,Intercept missile will fly on the reverse route which Attack Missile will fly, and intercept the attack missile without crashing into the ground How can i do this?Fixing this problem without Math knowledge is really difficulut,Help me Plz thanks! 1 Share this post Link to post Share on other sites
pierremgi 4906 Posted February 7, 2023 Good idea. Try something like that: player addEventHandler ["FiredMan", { params ["", "", "", "", "", "", "_projectile"]; private _tgt = missileTarget _projectile; private _counterMissile = createVehicle ["ammo_Missile_AA_R77",_tgt modelToWorld [0,0,5],[],0,"CAN_COLLIDE"]; _counterMissile setDir (_tgt getdir _projectile); _projectile setMissileTarget objNull; _counterMissile setVelocityModelSpace [0,0,3.6 * (velocityModelSpace _projectile #1)]; [_projectile,_counterMissile] spawn { params ["_projectile","_counterMissile"]; while {sleep 0.001; alive _projectile} do { _velProj = velocityModelSpace _projectile; _counterMissile setVelocityModelSpace [-(_velProj #0), (_velProj #1), -(_velProj #2)]; _dist = _projectile distanceSqr _counterMissile; if (_dist < 1600) exitWith { private _fakeMissile = createVehicle ["HelicopterExploSmall",_projectile modelToWorld [0,0,0],[],0,"CAN_COLLIDE"]; deleteVehicle _projectile; deleteVehicle _counterMissile; }; }; }; }]; Share this post Link to post Share on other sites
donpachiyarou 5 Posted February 18, 2023 Hi thanks for reply I tried your method and the countermissile works well if Fired soldier and aimed vehicle are on the same level,or soldier low &vehicle high position but if soldier high&vehicle low position,the countermissile usually crash into the ground. Is there other way to make the countermissile fly opposite route of Original Attack Missile and make those two missiles crash? anyway,I appreciate for your reply Share this post Link to post Share on other sites
donpachiyarou 5 Posted June 17, 2023 Hi i found a way to Shot Down Incoming missile by (this code is written in OnPlayerRespawn.sqf) 1.create B_TargetSoldier and attach him to the fired missile 2.create Tigris near the Target and add ProtectionZone(invisible&size changed ) to the fired bullet which will be deleted after Tigris dead.and make tigris watch&fire the B_TargetSoldier every 0.05sec 3.missile will be shot down easliy because of the ProtectionZone attached to bullet.after missile's death,Tigris&TargetSoldier will be deleted (_ggk=Abbreviations of "GeiGeKi"(jpn)=Intercept, _tama=Bullet) player addEventHandler ["FiredMan", { params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle"]; if ("M_NLAW_AT_F"==_this select 4)then { private _tgt=missileTarget _projectile; _dmy= [ [0,0,0],0,"B_TargetSoldier",west]call BIS_fnc_spawnVehicle; (_dmy select 0) attachto[_projectile,[0,5,0]]; private _ranpos=[(getpos _tgt),15,30,10,0,0.7,0]call BIS_fnc_findSafePos; _ggk= [_ranpos,0,"O_APC_Tracked_02_AA_F",east]call BIS_fnc_spawnVehicle; (_ggk select 0) reveal (_dmy select 0); (_ggk select 0) dowatch (_dmy select 0); (_ggk select 0) doTarget (_dmy select 0); (_ggk select 0) dofire (_dmy select 0); (_ggk select 0) addEventHandler ["Fired", {params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"]; _tama="ProtectionZone_F" createvehicle [0,0,0];_tama attachto[(_this select 6),[0,5,0]];_tama setObjectScale 0.05; [_tama,_unit]spawn{params["_tama","_unit"];while{alive _unit}do{sleep 5;};deletevehicle _tama;}; }]; [_projectile,_ggk,_dmy] spawn { params ["_projectile","_ggk","_dmy"]; while{alive _projectile}do {sleep 0.05;(_ggk select 0) doTarget (_dmy select 0);(_ggk select 0) dofire (_dmy select 0)}; hint "missile intercepted"; deletevehicle (_ggk select 0);deletevehicle (_dmy select 0);}; }; }]; but this way has problem,this way runs well only the FIRST Spawn BUT After player's respawn,Tigris spawns as many as number of player's respawn(if player respawn 5 times,then 5 tigris appears) and they wont watch the dummy soldier and they wont fire anything.How Can I fix this problem?I tryed createvehicle instead of spawnvehicle but same defect happens(6/17),and I always tryed change the random spawn position from (getpos _tgt) to (getpos _unit) then same defect hapens(6/18)(Many tigris appears around the firer),Deleting EH from "MPRespawn"via removeEventHandler always didnt change anything(6/19) Is there any kinds of way to Stop EH running multiple times?someone please help me thanks. 1 Share this post Link to post Share on other sites
h4wek 43 Posted July 7, 2023 Done but for larger scale https://steamcommunity.com/sharedfiles/filedetails/?id=2957393571 Share this post Link to post Share on other sites
donpachiyarou 5 Posted July 17, 2023 Hi player addEventHandler ["FiredMan", { params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle"]; if ( (("M_NLAW_AT_F"==_this select 4)or("M_Titan_AT"==_this select 4)or("M_PG_AT"==_this select 4)or("Missile_AGM_02_F"==_this select 4)or("M_Scalpel_AT"==_this select 4)or("M_AT"==_this select 4)) &&( (missileTarget _projectile) iskindof "LandVehicle")&&(random 100 < 50) )then { private _teki=missileTarget _projectile; private _g1="M_NLAW_AT_F" createvehicle [0,0,0];//PCML good private _ang=getdir _unit; _g1 setdir (_ang-180); _g1 setpos [getpos _teki select 0,getpos _teki select 1,(getpos _teki select 2)+12]; private _kabe="ProtectionZone_Invisible_F" createvehicle [0,0,0]; _kabe attachto[_g1,[0,9,0]]; _kabe setObjectScale random[0.1,0.2,0.3]; private _caf="CMflare_Chaff_Ammo" createvehicle [0,0,0]; _caf attachto[_g1,[0,0,0]]; private _dmy="B_Boat_Transport_01_F" createvehicle [0,0,0]; _dmy setObjectTextureGlobal [0, ""]; _dmy attachto[_projectile,[0,5,0]]; private _nkm=attachedObjects _projectile; _teki reveal (_nkm select 0);_teki dowatch (_nkm select 0); _teki dotarget (_nkm select 0);_teki dofire (_nkm select 0); _g1 reveal _dmy;_g1 setMissileTarget _dmy; [_projectile,_teki,_dmy,_g1,_kabe,_nkm]spawn{params["_projectile","_teki","_dmy","_g1","_kabe","_nkm"];while{alive _projectile}do {sleep 0.05;_g1 setMissileTarget _dmy; _teki reveal (_nkm select 0);_teki dowatch (_nkm select 0);_teki dotarget (_nkm select 0);_teki dofire (_nkm select 0);_g1 setVelocityModelSpace [0,50,0.4];}; hint "missile intercepted";deletevehicle _kabe;deletevehicle _dmy; }; } else{}; }]; this code works well even after multiple respawn."B_Boat_Transport_01_F" can be completely transparent by setobjecttextureglobal(others cant be transparent).so it looks natural(few shadow can be seen but it not big problem) and slow(50m/s) PCML missile as intercepting missile can chase fired missile and crash into the missile(other missile cant move so quickly,they crash into ground) Make enemy AI vehicle shot the incoming missile is not working at all,but First Objective "Intercepting Anti-Tank Missile by Missile" can be accomplished. thanks for your help!!! Share this post Link to post Share on other sites