Capt MacTavish 3 Posted April 13, 2018 Hi everyone, I am stuck on somethan. I'm making a mission in a pre defined area where a player can spawn ai via a addAction. My issue right now is, the player can spawn the mission over and over. That by itself will cause a lot of problems. Others might have a better idea on how to go about this but I thought it would be a good idea before the script spawns the mission it would check to see if there are any OPFOR Units Alive within the marker or a trigger area if there is the mission will not spawn, if there is'nt then the mission will spawn. I don't know how to successfully make a check for opfor units (not players, just AI). Any help would be very much appreciated thank you. Share this post Link to post Share on other sites
pierremgi 4862 Posted April 13, 2018 You need to add a condition in your addAction. As you can see the 8th parameter is a string for this purpose. How did you define the spawn position? (trigger, marker, coordinates?) You should write your code here. Share this post Link to post Share on other sites
Capt MacTavish 3 Posted April 13, 2018 @pierremgi Thanks for the reply. I'm not sure I understand fully. From what I understand about that condition is that it can connect to say a marker and or trigger with the given variable name, is that correct ? If yes then wonderful, if not then I'm still stuck on running a check if any opfor units are alive in the given area. I'm just trying to understand. Share this post Link to post Share on other sites
Grumpy Old Man 3545 Posted April 13, 2018 2 hours ago, Capt MacTavish said: @pierremgi Thanks for the reply. I'm not sure I understand fully. From what I understand about that condition is that it can connect to say a marker and or trigger with the given variable name, is that correct ? If yes then wonderful, if not then I'm still stuck on running a check if any opfor units are alive in the given area. I'm just trying to understand. Post some more info on what you actually got. Cheers 1 Share this post Link to post Share on other sites
Capt MacTavish 3 Posted April 13, 2018 @Grumpy Old Man I have a area that I am making pre made missions (By default there are no spawned AI). The way you activate a mission is a laptop with a addaction, when the player chooses a mission I want it to go through a checker to see if any opfor units are alive. I'm not sure if I should use a Trigger or a Marker that covers the mission radius to see if there are any OPFOR units alive. If you have any more questions let me know, hopefully we can figure this out. Share this post Link to post Share on other sites
zagor64bz 1225 Posted April 13, 2018 4 hours ago, Capt MacTavish said: The way you activate a mission is a laptop with a addaction, POST THE ADDACTION CODE YOU'RE USING 2 Share this post Link to post Share on other sites
Grumpy Old Man 3545 Posted April 13, 2018 6 hours ago, Capt MacTavish said: If you have any more questions let me know, hopefully we can figure this out. There are many solutions to your problem, I'm certainly not listing them all. If you show your current approach/snippet it's easier to go from there. You can use markers, objects, pre stored positions, relative positions and whatever else there can be (like selectBestPlaces) to get a position. To simply check if any opfor units are alive on the entire map you can use this: count (allUnits select {alive _x AND side isEqualTo east}) > 0;//returns true if any opfor units are alive in the mission count (allUnits select {alive _x AND side isEqualTo east AND _x distance "SomeMarkerName" < 500}) > 0;//returns true if any opfor units are alive and within 500m of "SomeMarkerName" named marker in the mission Cheers 3 Share this post Link to post Share on other sites
Capt MacTavish 3 Posted April 13, 2018 @zagor64bz this addAction["Mission Menu", {createDialog "dppMainMenu";}]; All I asked was how to just check to see if there are any opfor units within a marker, that's all. I am NEW to arma scripting and mission editing and therefore naturally I have questions on how to go about certain things. What is a good technique, what's the right way. @Grumpy Old Man Thanks for your help, I will try that out and see what happens. And zagor you don't have to be rude about it, If I knew how to do all of this I wouldn't of posted... Sorry for any confusion. If you want the entire path then tell me. Laptop with a addAction with the code above that opens a dialog that contains the mission options. The actual code that spawns the mission is very long. At the moment there is no other code to look at. I wanted to get this figured out before I do the rest of it. There is no code that pertains the check for opfor units because I didn't know how to make it so therefore there is none. Share this post Link to post Share on other sites
zagor64bz 1225 Posted April 13, 2018 20 hours ago, pierremgi said: How did you define the spawn position? (trigger, marker, coordinates?)You should write your code here. 17 hours ago, Grumpy Old Man said: Post some more info on what you actually got. 8 hours ago, Grumpy Old Man said: If you show your current approach/snippet it's easier to go from there. I didn't meant to be rude kid, but I couldn't avoid to ask myself if you had clear what info people need to be able to help ya! So I was sure to ask you in a simple and clear way. 35 minutes ago, Capt MacTavish said: this addAction["Mission Menu", {createDialog "dppMainMenu";}]; And see....you got the message across pretty clear, isn't it? I'm not by any means an expert or a scripter, but since I passed the 5000 hrs mark of game I'm starting to get a grasp of a few things. Sometime I can help, sometime not.But one thing I do for sure: I pay attention on what others say when I ask for help. Anyway dude, no disrespect intended! Peace and love brotha! 1 Share this post Link to post Share on other sites
Capt MacTavish 3 Posted April 13, 2018 @zagor64bz I apologise, I was running on fumes when I replied to grumpy. I'm just passing 4000 hrs myself and I have learnt a lot, it's just I had no idea how to combine for example alive, getpos, getmarkerpos, units etc( not saying that those are the correct ones to use ) together to make what I need. I will try to be more clear in the future when I post. I absolutley love making stuff in arma, this is probably the only game I couldn't get tired of playing. I'm basically making a training mission for my community and I just want to make sure when I make something it not only works but it works well and made the right way. If this works then the only other thing I can think of to add to it would be when the player opens the dialog, if a mission is "active" a message would appear saying "Mission Active". These two things do the same thing, do you think it would be better to run a check upon opening the dialog or when the player chooses a mission ? Share this post Link to post Share on other sites
zagor64bz 1225 Posted April 14, 2018 I'm no script expert, like I stated before, but something just came up in my mind: where do you run the addaction? In a trigger? Because it may more simple than what you think. try this: - Place a trigger, as big as the marker -type:none -Activation: OPFOR -Activation Type: NOT present on act: target addAction["Mission Menu", {createDialog "dppMainMenu";}]; By target, use the variable name of whatever or whoever is the target of the addaction.(player, object name). This way it should make the addaction available only when no OPFOR are present in the area. Not tested but try it out. This a simple approach via editor. Share this post Link to post Share on other sites
Capt MacTavish 3 Posted April 14, 2018 I run it on a laptop which is in a safehaven, basically a respawn point where the player is safe from being killed and can rearm. I thought of putting the addAction on a trigger but I didn't want the player to have access to the menu while playing the mission, only when he is inside the safezone. Share this post Link to post Share on other sites
Capt MacTavish 3 Posted April 14, 2018 @Grumpy Old Man Any chance you can add a if, then and else to this please ? count (allUnits select {alive _x AND side isEqualTo east AND _x distance "SomeMarkerName" < 500}) > 0; Share this post Link to post Share on other sites
HazJ 1289 Posted April 14, 2018 this addAction ["Mission Menu", {createDialog "dppMainMenu";}, [], 0, false, false, "", "count (allUnits select {alive _x && side isEqualTo opfor && _x distance 'SomeMarkerName' < 500}) > 0"]; ^^ This will make the action only show if the condition in TRUE. this addAction ["Mission Menu", { if (count (allUnits select {alive _x && side isEqualTo opfor && _x distance "SomeMarkerName" < 500}) > 0) then { createDialog "dppMainMenu"; } else { hintSilent "GET OUT OF HERE"; }; }]; ^^ This will show action always but won't open the dialog unless true. I may of got confused with the exact condition you want but you get the idea. It is 5 am here. 1 Share this post Link to post Share on other sites
pierremgi 4862 Posted April 14, 2018 4 hours ago, Capt MacTavish said: I run it on a laptop which is in a safehaven, basically a respawn point where the player is safe from being killed and can rearm. I thought of putting the addAction on a trigger but I didn't want the player to have access to the menu while playing the mission, only when he is inside the safezone. Perhaps I'm wrong but you seems to me mixing several things. When I read you, I understand the laptop is already in a "safe zone". So, why do you need to check if any enemy is present? The addAction on a laptop applies within 15m 50m of the laptop and the player pointing in its direction. are you sure you need something else? I gave you the link to addAction command. You should read it. 1 Share this post Link to post Share on other sites
Grumpy Old Man 3545 Posted April 14, 2018 5 minutes ago, pierremgi said: The addAction on a laptop applies within 15m of the laptop and the player pointing in its direction. addAction on an object will pop up at 50m, if no radius is passed as parameter, as in the thread starters example. I doubt this has always been the case, no idea when this got changed, used to be 15m. Cheers 2 Share this post Link to post Share on other sites
pierremgi 4862 Posted April 14, 2018 Yep good remark. I was on an old limitation. 1 Share this post Link to post Share on other sites
Capt MacTavish 3 Posted April 14, 2018 @pierremgi The safezone is just a respawn point where the player won't be killed upon respawning. He can change a loadout and if he want's to stop the mission, change it etc he can from there. The mission area is about 100-200m away from the respawn point, the purpose if for training only. To have fun and do different missions either alone or with friends. I guess I am very bad at explaining things haha. Short explanation: I get my gear, I pick a mission and I walk over to the mission area for some fun :) Thank you @Grumpy Old Man @pierremgi and @HazJ for helping me! It's fixed now and if anyone else finds it helpful, have at it :) this addAction ["Mission Menu", { if (count (allUnits select {alive _x && side _x isEqualTo opfor && _x distance getMarkerPos "dieselPowerPlantChecker" < 251}) > 0) then { hintSilent "OPFOR Units still in AO"; } else { createDialog "dppMainMenu"; }; }]; Share this post Link to post Share on other sites
pierremgi 4862 Posted April 14, 2018 Note: alive _x && side _x isEqualTo OPFOR is redundant. All killed are civilian. Just: side _x isEqualTo EAST . 1 Share this post Link to post Share on other sites
HazJ 1289 Posted April 14, 2018 Isn't the condition to check alive opfor/east units? Without the side check, it would include other units that belong to other sides? Unless I misunderstood. 1 Share this post Link to post Share on other sites
Grumpy Old Man 3545 Posted April 14, 2018 48 minutes ago, pierremgi said: Note: alive _x && side _x isEqualTo OPFOR is redundant. All killed are civilian. Just: side _x isEqualTo EAST . Indeed, also dead units aren't inside allUnits array, thanks for pointing that out. Tested with me and an opfor unit on the map while shooting the poor bastard: oneachframe {hintsilent str (allunits apply {side _x})} After killing the opfor the array only showed [WEST]. You could also use the condition inside the addActions condition field, so the action won't show if there's opfor in the AO: this addAction ["Mission Menu", { createDialog "dppMainMenu"; },[],0,true,true,"","count (allUnits select {side _x isEqualTo opfor && _x distance getMarkerPos 'dieselPowerPlantChecker' < 251}) > 0",15]; This will also limit the action range to 15m using the last parameter, instead of the default 50. Cheers 2 Share this post Link to post Share on other sites