Heatseeker 0 Posted September 11, 2006 Its strange that my search didnt return any results.. I want to tick one obj once 2 squads enter a trigger area, but since the map is coopable one of the groups might never exist (disabled in mp selection window) so i cant refer to it, count it or group it with a trigger.. What is my best alternative? I believe something could be done with gamelogics but im not sure how. (group gl with squad and place it inside trigger would ensure the squad is present even if not really there?).. Countside is an option i would like to avoid. Opinions, ideas, options much apretiated . Share this post Link to post Share on other sites
sanctuary 19 Posted September 11, 2006 If you make a "non-playable" AI in the second group , does this AI never exist if the player tick the disable AI feature ? It could be a good way to have the 2nd group to always exist and move even if there are no players in it at all. As if i remember well, only the units set to "playable" never exist if you disable AI in the briefing setup. Share this post Link to post Share on other sites
deanosbeano 0 Posted September 11, 2006 cant you count units after the map starts and then apply this new number of units into the obj done = eqaution ? sorry for vague answer, mp is not my bag. Share this post Link to post Share on other sites
Chris Death 0 Posted September 11, 2006 Well, a working solution is: to name each individum of the two playable groups (e.g: w1, w2, w3). Then make an init.sqs and put this code inside: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> group_array = [] "if (alive _x) then {group_array = group_array + [_x]}" foreach [w1,w2,w3,w4,e1,e2,e3,e4] :note - in this example there are two groups each of them four members. One group is named w1 to w4, the second group e1 to e4. group_array will contain all of the units from these two groups, being alive at start of the mission. Now it doesn't matter which units have been choosen or disabled at player's selection screen. btw - what was your problem with countside? In multiplayer countside is an important thing when checking e.g: how many guys of a group are alive, since dead groupmembers may be considered local but not global sometimes. Also dead guys are on civi side and still part of a group in some situations (especially in multiplayer). ~S~ CD Share this post Link to post Share on other sites
Heatseeker 0 Posted September 12, 2006 Ok, Sanctuary's way is how i've done once and it works but i dont like it, i would like to find a better/diferent way. @Chris I like, the array checks all the guys but how do i use it to see if they are all inside some trigger area? (condition). How about ingame? Can i make an array of all the west guys that are present (enabled) on the mission? @All What about game logics, they can be grouped to and activate triggers, can they be grouped to a soldier group? This would ensure that the squad that never was would always be present. Thanks all for your replies . Share this post Link to post Share on other sites
Messiah 2 Posted September 12, 2006 how about thinking outside the box a little? place a trigger activated by the side your groups are on, and activated by 'not present'. IN each trigger write the following on activation: group1notthere = true and group2notthere = true or something to that effect. So now you have a simple method of checking if the groups have been spawned at all, i.e. if they exist. Make sure the tirgger has a timeout of, say, 2 seconds or so (make the area is large enough), so that it wont be activated once the players move away from it. You just want it to be an initial check now, group a trigger to each group, the triggers that you want to set off when both groups are present. In each trigger write the following in the relevant condition line: this OR group1notthere and this OR group2notthere and in the onactivation field of both triggers have something like: trigger1activated = true and trigger2activated = true and then a final trigger that has the condition of: trigger1activated AND trigger2activated so, in essence what happens is the mission starts, the two initial triggers check if there are any groups not present. If they are, the triggers wont be activated and timeout after 2 seconds. The groups move off, activate their relevant triggers and the final trigger checks if both groups have arrived in that area and then you can activate what you want to happen from then (in your case, your objective) if one of the groups doesnt exist, then the relevant first trigger will activate, sending tyhe variable true - so the groups previously grouped trigger will still activate, allowing the only remaining group to activate its trigger and carry the mission on. sorry if my explanation is a litle rusty, trying to explain it as simply as possible, and have probably ended up making it harder Share this post Link to post Share on other sites
Chris Death 0 Posted September 12, 2006 Or you do it the array way by using this condition in trigger: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">"_x in thislist" count group_array == "alive _x" count group_array AND "alive _x" count group_array > 0 :note - it doesn't matter of which side the guys in the array are. ~S~ CD Share this post Link to post Share on other sites
Messiah 2 Posted September 12, 2006 of course, but i'm just offering a simple, fuss free solution without the need for complicating things.... much Share this post Link to post Share on other sites
Heatseeker 0 Posted September 12, 2006 Both sound like good solutions . I tried to set a variable if the squad was not alive once, but since the squad was not even there the game couldnt check their status.. so i had to find some alternative (i did but it was ugly). The trigger above squad+variable is something simple i should have come up on my own, the intro should cover the timeout so the triggers can be small, good/simple tip Messiah. I will try the array, shouldnt matter if there is a possibility that one extra unit might join either group (either group might capture an east guy) wright? Thank you both for your assistance . Share this post Link to post Share on other sites
Chris Death 0 Posted September 12, 2006 Well, if you join somebody to the group you will do it with a command anyway (may it be a script or trigger or waypoint). In the same onActivation line or script you can add him to the array aswell: group_array = group_array + [that_guy] @Messiah you may be right in some case but you did also use 5 triggers where one would do the job aswell. Imagine that when using 5 different groups instead of two: then we already at 11 triggers. Sure it's simple, but then we could also go for the 1 trigger for each man method. ~S~ CD Share this post Link to post Share on other sites
Messiah 2 Posted September 12, 2006 no problems heatseeker - it always takes a few minds to work out an easy solution to a problem. chris, yeah i know - if there were more triggers, i certainly wouldnt have suggested that method as it would have become more work than it was worth, but for smaller missions and for people who are a little scared of more complicated commands and arrays, its a nice alternative i find.... bis used virtually no scripting or any clever little commands with the original missions, just clever use of triggers and variables. for some reason i enjoy and prefer finding alternatives to scripting and longer commands - i doubt it does much to improve things, but its something I like Share this post Link to post Share on other sites
Heatseeker 0 Posted September 15, 2006 This isnt working.. Trigger condition: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> "_x in thislist" count group_array == "alive _x" count group_array AND "alive _x" count group_array > 0 Init.sqs: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> group_array = [] "if (alive _x) then {group_array = group_array + [_x]}" foreach [player00,player01,player02,player03,player04,player05] I made sure there were no typos, the units were named wright and inside the trigger area.. Also, i dont understand the trigger condition.. why so many counts? Can anyone be so kind to "translate" it for me? . Share this post Link to post Share on other sites
Chris Death 0 Posted September 15, 2006 What doesn't work? Do you get an error message, or is there just not happening anything. When posting this i've tested it off course before, and it was everything working fine. What are the trigger's activation criteria? Explanation: If the number of guys from the group array inside the trigger's area is equal to the number of guys from the group array who are still alive, and if the number of guys who are alive in group array is more than 0, the trigger should become activated. Now with more than one sentence: The first count is for check, how many guys of group_array are inside the trigger area. The second count is for check how many guys of group_array are alive and will be compared to the first count. The third count ensures that the trigger doesn't become true, if the whole group is not alive anymore. Imagine the number of living guys in group array = 0, and not one guy of them is inside the trigger area. 0 = 0 (the comparisation) and the trigger would become active even if there were nobody alive. ~S~ CD Share this post Link to post Share on other sites
Heatseeker 0 Posted September 16, 2006 No typos or anything, it wasnt showing the hint i used to test it, likely an error on my end, thanks for the translation, it helps me understand it all much better now . edit: The reason why it didnt work was because of missing activation: west/present I thought the array check/count would tick the trigger on its own without the need for these but the trigger requires the west present activation and only then counts the array, confusing stuff . Still, major help solving one problem that was pissing me off for quite a while, life makes sense again . Share this post Link to post Share on other sites
Chris Death 0 Posted September 18, 2006 Yeah, Heatseeker - i was going to tell you about the trigger activation thingy (that's why i asked you in an earlier post). The list of a trigger contains only objects which match with given activation conditions. A west/present trigger will only contain west units inside it's list. An anybody/present trigger will feature units of all sides in it's list. It's not weird, it's even mentioned in the comref btw. ~S~ CD Share this post Link to post Share on other sites
Heatseeker 0 Posted September 18, 2006 There is one minor problem though, it doesnt detect the guys if they are inside a vehicle, i could force an eject i guess. Maybe it works if i put vehicle betwean the count and the array? . Share this post Link to post Share on other sites
Chris Death 0 Posted September 18, 2006 Nah, no need to force them out of their vehicles, it's just a question of what you're checking for. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">"vehicle _x in thislist" count group_array == "alive _x" count group_array AND "alive _x" count group_array > 0 To be honest i totally forgot on that case that they're probably in vehicles, so i didn't consider it in previous code. Now it should work fine. explanation: now you're checking for the vehicle of each member of group_array inside the trigger's list. Now it doesn't matter wether a unit is inside a vehicle or not. ~S~ CD Share this post Link to post Share on other sites
Heatseeker 0 Posted September 18, 2006 I forgot about it too but there is always the possibility of finding an abandoned truck somewhere so i gave it a try. Thanks alot for your assistance CD . Share this post Link to post Share on other sites