3l0ckad3 17 Posted July 15, 2019 I normally don't have issues with scripting triggers, so, I think this one is out of my grasp. Basically, I'm trying to merge two scripts together to get a better particle effect. So, I have Phronk's random IED script, and I'm tryin' to call ALIAS script from Phronk's script, but I don't want to lose the params.. I tried to call it from his triggers, but to no avail.. 1st I ran it right after the triggers just to see what would happen, and it goes off right when I spawn, then I tried running it from the triggers, and it just kept spitting out errors.. Thnx for any help. ied.sqf iedMkr=["iedMkr0","iedMkr1","iedMkr2"]; //List of markers to spawn IEDs in iedNum=5; //Number of IEDs per marker, defined in iedMkr [Default: 5] iedDmg=false; //Can the IED be killed with weapons? [Default: false] TRUE = Yes | FALSE = Can only be disarmed Dbug=true; //Show IED markers on map? [Default: false] //!!DO NOT EDIT BELOW!! iedBlast=["Bo_Mk82","Rocket_03_HE_F","M_Mo_82mm_AT_LG","Bo_GBU12_LGB","Bo_GBU12_LGB_MI10","HelicopterExploSmall"]; iedList=["IEDLandBig_F","IEDLandSmall_F","IEDUrbanBig_F","IEDUrbanSmall_F"]; iedAmmo=["IEDUrbanSmall_Remote_Ammo","IEDLandSmall_Remote_Ammo","IEDUrbanBig_Remote_Ammo","IEDLandBig_Remote_Ammo"]; iedJunk=["Land_Garbage_square3_F","Land_Garbage_square5_F","Land_Garbage_line_F"]; if(!Dbug)then{{_x setMarkerAlpha 0;}forEach iedMkr;}; if(!isServer)exitWith{}; iedAct={_iedObj=_this select 0; if(mineActive _iedObj)then{ _iedBlast=selectRandom iedBlast; createVehicle[_iedBlast,(getPosATL _iedObj),[],0,""]; createVehicle["Crater",(getPosATL _iedObj),[],0,""]; {deleteVehicle _x}forEach nearestObjects[getPosATL _iedObj,iedJunk,4]; deleteVehicle _iedObj;};}; {private["_ieds","_trig"];_ieds=[];_iedArea=getMarkerSize _x select 0;_iedRoad=(getMarkerPos _x)nearRoads _iedArea; for "_i" from 1 to iedNum do{ if(count _ieds==iedNum*4)exitWith{}; _iedR=selectRandom _iedRoad; _ied=selectRandom iedList;_junk=selectRandom iedJunk; _ied=createMine[_ied,getPosATL _iedR,[],8];_ied setPosATL(getPosATL _ied select 2+1);_ied setDir(random 359); if(!iedDmg)then{_ied allowDamage false;}; if(round(random 2)==1)then{_iedJunk=createVehicle[_junk,getPosATL _ied,[],0,""];_iedJunk setPosATL(getPosATL _iedJunk select 2+1);_iedJunk enableSimulationGlobal false;}; _jnkR=selectRandom _iedRoad;_junk=createVehicle[_junk,getPosATL _jnkR,[],8,""];_junk setPosATL(getPosATL _junk select 2+1); _junk enableSimulationGlobal false; _trig=createTrigger["EmptyDetector",getPosATL _ied]; _trig setTriggerArea[10,10,0,FALSE,10]; _trig setTriggerActivation["ANY","PRESENT",false]; _trig setTriggerTimeout[1,1,1,true]; if(isMultiplayer)then{ _trig setTriggerStatements[ "{vehicle _x in thisList && speed vehicle _x>4}count playableUnits>0", "{if((typeOf _x)in iedAmmo)then{[_x]call iedAct;};}forEach nearestObjects[thisTrigger,[],10];", "deleteVehicle thisTrigger"];}else{ _trig setTriggerStatements[ "{vehicle _x in thisList && isPlayer vehicle _x && speed vehicle _x>4}count allUnits>0", "{if((typeOf _x)in iedAmmo)then{[_x]call iedAct;};}forEach nearestObjects[thisTrigger,[],10];", "deleteVehicle thisTrigger"];}; _ieds pushBack _ied; if(Dbug)then{ iedMkrs=[]; _iedPos=getPosWorld _ied; _mkrID=format["m %1",_iedPos]; _mkr=createMarker[_mkrID,getPosWorld _ied]; _mkr setMarkerShape"ICON";_mkr setMarkerType"mil_dot";_mkr setMarkerBrush"Solid";_mkr setMarkerAlpha 1;_mkr setMarkerColor"ColorEast"; iedMkrs pushBack _mkr;}; }; }forEach iedMkr; sleep 5; {CIVILIAN revealMine _x;EAST revealMine _x;}forEach allMines; The block I'm trying to add. null = [_ied,20, true, true] execVM "AL_bomb\alias_bomb_ini.sqf"; Share this post Link to post Share on other sites
pierremgi 4906 Posted July 15, 2019 That's because _ied (local variable) is undefined inside the trigger statement; Replace the (too heavy) code: if(isMultiplayer)then{ _trig setTriggerStatements[ "{vehicle _x in thisList && speed vehicle _x>4}count playableUnits>0", "{if((typeOf _x)in iedAmmo)then{[_x]call iedAct;};}forEach nearestObjects[thisTrigger,[],10];", "deleteVehicle thisTrigger"];}else{ _trig setTriggerStatements[ "{vehicle _x in thisList && isPlayer vehicle _x && speed vehicle _x>4}count allUnits>0", "{if((typeOf _x)in iedAmmo)then{[_x]call iedAct;};}forEach nearestObjects[thisTrigger,[],10];", "deleteVehicle thisTrigger"];}; Note: Here the condition isMultiplayer can be easily removed. by: _trig setTriggerStatements [ "{vehicle _x in thisList && && speed vehicle _x>4}count allPlayers >0", "{if(typeOf _x in iedAmmo)then{ [_x,20, true, true] execVM "AL_bomb\alias_bomb_ini.sqf"; [_x]call iedAct } }forEach nearestObjects[thisTrigger,[],10] ", "deleteVehicle thisTrigger" ]; (not tested) EDITED: execVm Alias code before the called iedAct. This way you will not wait for a iedAct completion. 1 Share this post Link to post Share on other sites
3l0ckad3 17 Posted July 16, 2019 Just now, 3l0ckad3 said: 11 hours ago, pierremgi said: That's because _ied (local variable) is undefined inside the trigger statement; Replace the (too heavy) code: if(isMultiplayer)then{ _trig setTriggerStatements[ "{vehicle _x in thisList && speed vehicle _x>4}count playableUnits>0", "{if((typeOf _x)in iedAmmo)then{[_x]call iedAct;};}forEach nearestObjects[thisTrigger,[],10];", "deleteVehicle thisTrigger"];}else{ _trig setTriggerStatements[ "{vehicle _x in thisList && isPlayer vehicle _x && speed vehicle _x>4}count allUnits>0", "{if((typeOf _x)in iedAmmo)then{[_x]call iedAct;};}forEach nearestObjects[thisTrigger,[],10];", "deleteVehicle thisTrigger"];}; Note: Here the condition isMultiplayer can be easily removed. by: _trig setTriggerStatements [ "{vehicle _x in thisList && && speed vehicle _x>4}count allPlayers >0", "{if(typeOf _x in iedAmmo)then{ [_x,20, true, true] execVM "AL_bomb\alias_bomb_ini.sqf"; [_x]call iedAct } }forEach nearestObjects[thisTrigger,[],10] ", "deleteVehicle thisTrigger" ]; (not tested) EDITED: execVm Alias code before the called iedAct. This way you will not wait for a iedAct completion. Not getting errors now, but nothing is spawning either 😕 Share this post Link to post Share on other sites