snkman 351 Posted February 10, 2007 Hi Guy's, well i would need some help with a Condition: I have a Trigger covering a Area: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Activated by: West, Once Not Present Condition: ? On Activate: [] exec "Scripts\alldead.sqs" Well if all West Soldiers are dead the trigger should activate Scripts\alldead.sqs. Now the part i don't know how to do: In the area which is covered by the Trigger there are 6 Artillerie's ( Named AW1 - AW6 ) and 1 Chopper ( Named Alpha_One ) and 1 Medic ( Named Medic ) Now i need to get a condition for the trigger, if all players are dead and but AW1 - AW6, Alpha_One and Medic is still alive the trigger should be Activated. i already tryed this: Trigger that covers the Area: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Activated by: West, Once Not Present Condition: this and not alive player and alive AW1 and alive AW2 and alive AW3 and alive AW4 and alive AW5 and alive AW6 and alive Alpha_One and alive Medic On Activate: [] exec "Scripts\alldead.sqs" But it doesn't work... P.S. The "not alive player" is very important becouse i use a Revive Respawn Script. Someone know's a way to do that? Share this post Link to post Share on other sites
VictorFarbau 0 Posted February 10, 2007 Hello again, cascaded AND statements like this might confuse the parser and thus lead to unpredictable results (happens to me). You could try to enclose each statement with brackets () AND () AND (). You might as well create a trigger with a custom script (much nicer and more flexible). I am busy writing my own CTI mega-mission which makes extensive use of these. All you need is a spot and the radius you want to watch. Then you could use this piece of code in a loop and make it fit to your needs: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _intruders = nearestObjects [_startpoint, ["Car","Tank", "Man","Air"], _triggerradius] IF (west countSide _intruders > 0) THEN {_alertmode = 1} Do you understand the above? Not sure how script-savvy you are. This fills an _intruders array with all objects in the _triggerradius vicinity which are of type Car, Tank, Man or Air and then counts the number of West objects in there. So Car Tank Man and Air are the classes you can identify, remove or add them as needed. West and East and Guer are the sides present in the game usually (if at least 1 object of the side exists at mission start). All clear? Cheers, Victor Share this post Link to post Share on other sites
snkman 351 Posted February 10, 2007 Hi VictorFarbau well i do not exactly understand what you trying to tell me... My knowledge in scripting is not that good. Can you plz explain me that some easyer? Okay here's what i think i understud: Create a Script: cover.sqs <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_intruders = nearestObjects [_startpoint, ["Car","Tank", "Man","Air"], _triggerradius] IF (west countSide _intruders > 0) THEN {_alertmode = 1} I create a Trigger ( Activated by West, Radius 2000 x 2000 ) On Activation: this exec "cover.sqs" B.t.w. Which class is Artillerie? Tank? Umm... i thhink i did not understand... Share this post Link to post Share on other sites
Guest Posted February 10, 2007 For getting a script to run on server only -------------------------------------------------------------- 1. Place a game logic to the map and give it a name ("server" recommended but not compulsory). 2. Use the following to start the script on server only from a script like init.sqs: Code Sample ? (local <NameOfYourGameLogic>) : [] exec "r.sqs" If the game logic is named "server": Code Sample ? (local server) : [] exec "r.sqs" This should work. --------------------------------------------------- Above is from another post, but do that for this below method. This will make the script run only on server, not on everyones machine, prolly desired approach for this, if im reading you right So, in your Init.sqs after putting in the gamelogic named server Init.sqs <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ? (local server) : [] exec "MainCheck.sqs" Heres where someone else maybe can add a better way, have very limited knowledge of MP stuff, so, with what Im going to put in here - will require all players to have names in their Init lines, to reference, because I dont know how to find out if ALL players are dead without referencing their names directly. So for this, name all playable units in their name feilds MainCheck.sqs <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ;this is just a switch to indicate when all players are dead _allPlayersDead = 0 ;this is a switch to indicate if all others are alive _allOthersAlive = 0 #MainLoop ~10 ;Be sure each of these names is exactly what is put in the name for each player ? !(alive PlayerOne) && !(alive PlayerTwo) && !(alive PlayerThree) && !(alive PlayerFour):_allPlayersDead = 1;goto "CheckOtherUnits" goto "MainLoop" #CheckOtherUnits ? (alive AW1) && (alive AW2) && (alive AW3) && (alive AW4) && (alive AW4) && (alive AW5) && (alive AW6) && (alive Alpha_One) && (alive Medic):_allOthersAlive = 1 ?(_allPlayersDead == 1) && (_allOthersAlive == 1):goto "ExecuteandExit" Exit #ExecuteandExit [] exec "Scripts\alldead.sqs" Exit I edited inital post, cause it was a little off, but anyhow, here it will loop every ten seconds, checking if all players are dead, and, if all players ARE dead, it will go to an area that will check if all those other units/vehicles are Alive, if all of them are alive, then execute your script, if even one of them is dead, in this case, it will exit and do nothing, this is what you wanted? Share this post Link to post Share on other sites
VictorFarbau 0 Posted February 11, 2007 SNKMAN, ok, so the code I showed is meant to be used in a script indeed. But this script is supposed to be used instead of a map trigger and not together with it. You can place an object (e.g. an "invisible H") called "watchme" somewhere on the map and then the script example below checks the vicinity 100m for any present / alive western soldiers (= class "Man"). If there are, then the global variable "alertmode" is set to 1. This can then be used by any other script or map trigger. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> #watchit _intruders = nearestObjects [watchme, ["Man"], 100] IF (west countSide _intruders > 0) THEN {alertmode = 1; publicVariable "alertmode";} ~1 goto "watchit" Hope this is more clear now. Victor Share this post Link to post Share on other sites
snkman 351 Posted February 11, 2007 Thank's for all your help Guy's! I'm not at home right now, so i can't try it... But tomorrow first thing i do is trying thouse thing's and report my experiance. So thank's in advance! Share this post Link to post Share on other sites
snkman 351 Posted February 12, 2007 Arg... damn it doesn't work... Well i found this script: alivecheck.sqs <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">~2 _all = [p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12] #loop westalive = 0 {if (alive _x) then {westalive = walive + 1}} foreach _all; ? westalive == 0 : goto "westdead" ~ 5 goto "loop" #westdead ~1 [] exec "Scripts\alldead.sqs" exit only bad thing after every soldier died 1 times the script will go to [] exec "Scripts\alldead.sqs" Is there a way to make it go to [] exec "Scripts\alldead.sqs" after all Soldiers are dead i mean when no Soldier is left to Revive another Soldier? Share this post Link to post Share on other sites
kronzky 5 Posted February 12, 2007 Try something like this (in SQF):<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_all = _this select 0; waitUntil { westalive=false; {if (alive _x) then {westalive=true}} forEach _all; !westalive; }; [] exec "scripts\alldead.sqs"; I left the group definition outside of the script, so it's a bit more universal. So in your specific case you'd call it with:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">nul=[[p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12]] execVM "livecheck.sqf" Share this post Link to post Share on other sites
snkman 351 Posted February 12, 2007 Hi Kronzky, well it work's but only like the other script's after all players died 1 times the [] exec "scripts\alldead.sqs"; come's... I use a revive respawn so the players should die as often as they like till one player is left to Revive them the [] exec "scripts\alldead.sqs"; should only start after all Players are completly dead. Share this post Link to post Share on other sites
kronzky 5 Posted February 12, 2007 I guess I must've misunderstood you then. What side is the player on? West? In that case I don't understant why your original trigger ("West - Not present") didn't work. That one, along with the test for the alive status of the artillery units should've covered your situation. The test for "alive player" shouldn't be necessary if player is West. A dead unit is considered "not present", so that situation would be covered by the primary trigger condition already: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Activated by: West, Once Not Present Condition: this and alive AW1 and alive AW2 and alive AW3 and alive AW4 and alive AW5 and alive AW6 and alive Alpha_One and alive Medic On Activate: [] exec "Scripts\alldead.sqs" Share this post Link to post Share on other sites
snkman 351 Posted February 13, 2007 Yes the side is "West" Well i tested it few more times with this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Activated by: West, Once Not Present Condition: this and alive AW1 and alive AW2 and alive AW3 and alive AW4 and alive AW5 and alive AW6 and alive Alpha_One and alive Medic On Activate: [] exec "Scripts\alldead.sqs" but it doesn't work... Maybee the Trigger check's the not Present first and than after all West Soldiers are dead he check's the Condition and than [] exec "Scripts\alldead.sqs" will be implemented. I have no clue. Share this post Link to post Share on other sites
Big Dawg KS 6 Posted February 13, 2007 If the players are in the same group, give that group a name, then use this as your condition: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">({alive _X} count (units playergroup) <= 0)&&({!(alive _X)} count [AW1,AW2,AW3,AW4,AW5,AW6,Alpha_One,Medic] <= 0) And it's that easy. Share this post Link to post Share on other sites
snkman 351 Posted February 14, 2007 Hi KyleSarnik, yes they are in a Group but there are 2 group's a 6 Soldiers. Well i have uploaded a example Mission. You see the 2 group's a 6 Soldiers are playable and after they are all dead the alldead.sqs should be implemented. Alivecheck Example Share this post Link to post Share on other sites
Big Dawg KS 6 Posted February 14, 2007 Then just put the players in an array and replace (units playergroup) with it. Share this post Link to post Share on other sites
snkman 351 Posted February 14, 2007 Man you are just AWESOME! It finally works! Well that's how it look's like: On Condition: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">({alive _X} count [p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12] <= 0)&&({!alive _X} count [AW1,AW2,AW3,AW4,AW5,AW6,Alpha_One,Medic] <= 0) Thank's a lot KyleSarnik Share this post Link to post Share on other sites
Big Dawg KS 6 Posted February 14, 2007 Man you are just AWESOME!  It finally works!  Well that's how it look's like: On Condition: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">({alive _X} count [p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12] <= 0)&&({!alive _X} count [AW1,AW2,AW3,AW4,AW5,AW6,Alpha_One,Medic] <= 0) Thank's a lot KyleSarnik  Hopefully now you'll see how useful the count command is going to be (it's one of my most used commands) for conditions. Share this post Link to post Share on other sites
snkman 351 Posted March 8, 2007 Hi Guy's, well i just have another little problem with the codes KyleSarnik gave me... Okay i use: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">({alive _X} count [p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12] <= 0)&&({!alive _X} count [AW1,AW2,AW3,AW4,AW5,AW6,Alpha_One,Medic] <= 0) toghetter with a Revive respawn and it work's just greate but after all soldiers died about 3 times and was Revived it will not work any longer? So i think the problem is, that after the Soldiers died a few times and was Revived the Script stop's counting the p1,p2,p3... Someone got a solution for this? Share this post Link to post Share on other sites
Big Dawg KS 6 Posted March 9, 2007 That's because that revive respawn script doesn't keep you dead when you die, the units still respawn shortly after they are killed, they're only setpos'd back to the spot where they died when they're revived. You're going to have to edit the revive respawn scripts to keep track of who's 'dead' (if it doesn't allow that already), put them in a global array, and use that for the count list. Share this post Link to post Share on other sites
snkman 351 Posted March 11, 2007 Hmm... Is it possible, that something in the Editor did not work correctly? Well i could not get a alivecheck Script to work, so i choosed another way. Like i told i use a Revive Respawn so there is a huge trigger, covers whole Sahrani that's the trigger for the Revive Respawn Script. Okay the players Respawn on a Island outside of this huge Trigger after they died and waiting to be Revived. So now i thought i can choose in the big Revive trigger: Activatet by Bluefor once ( I tryed Multiple too ) not present on Activation: this exec "Scripts\allDead.sqs" I have 4 West Soldiers standing around on Sahrani Island so i gave to each of them a independent Soldier with a higher rang than they have and set the independent Soldiers to not present. Now the 4 West Soldiers are independent too but still West. Now after all playable Soldiers are dead ( They are not covered by the huge Revive trigger cuz after they died they will Respawn on the Island outside of the trigger ) the Script should be activated but it's the same like with: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">({alive _X} count [p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12] <= 0)&&({!alive _X} count [Clark, Soldier1,Alpha_One,Medic] <= 0) it works pretty good but after i played 20 - 30 min. it doesn't works any longer... Am i too stupid or is there something wrong with the Editro? Share this post Link to post Share on other sites
Big Dawg KS 6 Posted March 11, 2007 That's not a very good method. You shouldn't be so general with your triggers, make them specific to the playable units instead of all west units. Or try this, name your west present trigger WestPresent and use this modified condition: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">({_X in list WestPresent} count [p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12] <= 0)&&({!alive _X} count [Clark, Soldier1,Alpha_One,Medic] <= 0) Share this post Link to post Share on other sites