Cryptdik 5 Posted April 11, 2017 So I'm trying to make an enemy mortar that will not only shoot at your position once when you become detected with all 8 rounds, but rather 4 at a time over multiple instances of being detected (with an ammo box next to it for reloading.) The idea is for a sniper mission, you can attract the mortars attention but it will only shoot directly at the first point you are detected. This way I'm trying to make it fire a few times at you, wait five seconds, and open fire again if you are still in detection until the mortar gets sniped. What I did is make the trigger that detects BLU by OPFOR and onact does this: mortar1 commandArtilleryFire [getposatl (thislist select 0), "8Rnd_82mm_Mo_shells", 3]; sleep 5; artytrig2 setTriggerActivation ["WEST", "EAST D", true]; I set up five extra triggers that use the same thing but each leading up, from artytrig2 to artytrig3 and so on, but I turned off the initial activation for the extra triggers so they only get activated one by one. I get "Error Generic Error In Expression", what do I have wrong? Share this post Link to post Share on other sites
pierremgi 4898 Posted April 12, 2017 Probably due to the sleep command. You need to spawn you code if you want some scheduled effect: 0 = thislist spawn {_target = _this select 0; ....}; 1 Share this post Link to post Share on other sites
Cryptdik 5 Posted April 12, 2017 Great call, it works really well. Put it to a 10 second delay for the trigger instead and it gives a perfect amount of time between mortar barrages. Share this post Link to post Share on other sites
Cryptdik 5 Posted April 12, 2017 I'm now looking at reducing it to one trigger based on this So I now have one trigger set to repeatable with this: Condition: this && conditiontime<time OnAct: arty1 commandArtilleryFire [getposatl (thislist select 0), "8Rnd_82mm_Mo_shells", 4]; conditiontime=time+10 It half-works. Seems like the response time is extremely delayed and it doesn't seem to fire more than one barrage. Anything off here? I'm trying to make it so it will wait 10 seconds after a barrage command before being able to be repeated. Share this post Link to post Share on other sites
pierremgi 4898 Posted April 12, 2017 yes, you have to rearm the trigger. So, it must be deactivated then activated. Try this way: condition: this && isNil "myVariable" On act: arty1 commandArtilleryFire [getposatl (thislist select 0), "8Rnd_82mm_Mo_shells", 4]; myVariable = true On deact: 0 = [] spawn {sleep 5; myVariable = nil} Share this post Link to post Share on other sites
Cryptdik 5 Posted April 13, 2017 Works great, but I notice in multiplayer it seems to fire at you a few times in different spots youve been detected (which is good) but it seems to cut out early. I think the mortars start off with what, 16 shells without an ammo box? It only seems to get through about the first 8 and stops firing. I'm going to test it more and see what's happening. Thanks for the help so far. Share this post Link to post Share on other sites
Midnighters 152 Posted April 13, 2017 14 hours ago, Cryptdik said: Works great, but I notice in multiplayer it seems to fire at you a few times in different spots youve been detected (which is good) but it seems to cut out early. I think the mortars start off with what, 16 shells without an ammo box? It only seems to get through about the first 8 and stops firing. I'm going to test it more and see what's happening. Thanks for the help so far. Reloading time maybe? I don't think they have 16 shells. Share this post Link to post Share on other sites
pierremgi 4898 Posted April 13, 2017 There is also a minimu distance for any artillery fire. I think the mortar unit will not fire if the player is within 100 meters (approx). There is also a workaround for unlimited rounds: 0 = thislist spawn {while {alive mortar1} do {mortar1 doArtilleryFire [ getposatl (_this select 0) , mortar1 currentMagazineTurret [0],4]; mortar1 addMagazineTurret [mortar1 currentMagazineTurret [0], [0], 4]; sleep 15}}; Share this post Link to post Share on other sites
Cryptdik 5 Posted April 13, 2017 So I stuck that in the trigger's onact in place of the original script Condition: this && isNil "myVariable" Onact: 0 = thislist spawn {while {alive mortar1} do {mortar1 doArtilleryFire [getposatl (_this select 0) , mortar1 currentMagazineTurret [0],4]; mortar1 addMagazineTurret [mortar1 currentMagazineTurret [0], [0], 4]; sleep 10}}; myVariable = true OnDeact: 0 = [] spawn {sleep 5; myVariable = nil} I'm using the NATO Mk6 mortar to do this with but it won't fire and gives me the error " no entry '.model' " I looked that up and it seems to be more related to people creating new factions and the like. Edit: Ha! Got it working. Went back to the first OnAct and turned it into this: mortar1 addMagazineTurret ["8Rnd_82mm_Mo_shells", [0,8]]; mortar1 commandArtilleryFire [getposatl (thislist select 0), "8Rnd_82mm_Mo_shells", 4]; myVariable = true Thanks immensely for the help! Only thing besides this is I'm trying to trigger a squad hunting the player down to make the perfect base that can defend itself. Share this post Link to post Share on other sites
pierremgi 4898 Posted April 13, 2017 Confirmed. I don't know why this currentMagazine returns the right magazine. But scope seems "private" or something like that. It finally works if you launch the mission twice. One of the weird behavior of some Arma's commands. For hunting the player, do the same thing: addWaypoint for your team, SAD type and setWaypointPosition in the loop (with mortar). An updated position every 10 seconds sounds fine. Share this post Link to post Share on other sites