Dutch 10 Posted January 9, 2011 Hello, I am looking for someone who can help me with a specific trigger condition code for a capture zone trigger. I have browsed this forum and got some suitable code from existing PVP pack scripts but do not have the skill/knowledge to make them suitable/applicable for my PVP concept. Bottom side of this post describes what I am exactly trying to achieve. Some help, even if its small would be much appreciated. If you need more info, let me know. Best regards, E. Dutch ------------------------------- The trigger im talking about is an area trigger. In order to gain control over the area within the ellipse, the OPFOR has to seize and hold this trigger zone for a certain set time (using timeout). Below are the intended conditions for the trigger to be activated: Number of T90 tanks in triggerzone => 2 (can be any T90 vehicle on the map) These two T90s when inside the triggerzone must be operational, meaning having a working turret, engine and tracks The two T90s must be crewed by at least 2 or more players per tank (Only Russian crewmen class must be able to count for this) These four Russian crewmen players must be alive The above four conditions must be met for 5 minutes for the trigger to fire off Now if the above conditions seem to be too hard to realize with a code, this could be an alternative. Triggerzone must contain => 2 T90 tank (can be any T90 vehicle on the map) Damage level for those 2 T90A's within the trigarea must be <= 0.5 Russian crewmen class players in trigger zone must be => 4 and must be alive The above three conditions must be met for at least 5 minutes for the trigger to activate Other info which may be useful to know: - Mission uses latest ACE version - JIP allowed - Mission uses simple vehicle respawn script for all vehicles - Mission uses "base" respawn for players - ACE wounding sys module is on Share this post Link to post Share on other sites
demonized 20 Posted January 9, 2011 Search for isKindOf, typeOf, getDammage, on http://community.bistudio.com/wiki/Armed_Assault:_Actions_List and it will probably be easier to do it in a script run from trigger instead of using the init line. Share this post Link to post Share on other sites
shuko 59 Posted January 9, 2011 I don't if/how you can check for damage to a specific part, so I used just a overall damage check. {_x iskindof "T90" && damage _x < 0.8 && ({_x iskindof "RU_Soldier_Crew" && alive _x} count crew _x >= 2)} count thislist >= 2 Share this post Link to post Share on other sites
bhaz 0 Posted January 9, 2011 Perhaps a combination of canMove to check the tracks / engine and canFire for the turrets? Share this post Link to post Share on other sites
shuko 59 Posted January 9, 2011 True true... {_x iskindof "T90" && canmove _x && canfire _x && ({_x iskindof "RU_Soldier_Crew" && alive _x} count crew _x >= 2)} count thislist >= 2 Share this post Link to post Share on other sites
Dutch 10 Posted January 9, 2011 (edited) True true... {_x iskindof "T90" && canmove _x && canfire _x && ({_x iskindof "RU_Soldier_Crew" && alive _x} count crew _x >= 2)} count thislist >= 2 Tx for the response guys. I tried this code in the trig and it works on my SP editor, but im wondering , will this work when playing with 70 people on a dedi as well? And what about locality and JIP? And will this code work on 3 other similar trigger zones simultanously as well? Will the condition checks not lag the server? Edited January 9, 2011 by Dutch Share this post Link to post Share on other sites
shuko 59 Posted January 9, 2011 It's just a trigger, so it's affected by same rules as any other. All triggers are local, which should be taken into account with JIP. I'd advice you to create the trigger only on the server with createTrigger command (or make a script loop to check the zones). Obviously, the checks will tax the server a certain amount, but if you need it checked, then it needs to be done, way or the other. It's not related to anything, so you can have any number of them. Share this post Link to post Share on other sites
Dutch 10 Posted January 9, 2011 (edited) It's just a trigger, so it's affected by same rules as any other. All triggers are local, which should be taken into account with JIP. I'd advice you to create the trigger only on the server with createTrigger command (or make a script loop to check the zones). Obviously, the checks will tax the server a certain amount, but if you need it checked, then it needs to be done, way or the other. It's not related to anything, so you can have any number of them. Ok lets say i go for creating the trigger on server ( i assume this makes the function/trigger global?). I was thinking entering something like this to create the trigger, but how/where do i do that? red1zone=createTrigger["SomeObject",getPos red1mark]; red1zone setTriggerArea[150,150,0,false]; red1zone setTriggerActivation["OPFOR","PRESENT",true]; red1zone setTriggerStatements["{_x iskindof "T90" && canmove _x && canfire _x && ({_x iskindof "RU_Soldier_Crew" && alive _x} count crew _x >= 2)} count thislist >= 2", "red1done=1", "red1done=0"]; red1zone setTriggerTimeout [300, 300, 300, true ] Edited January 9, 2011 by Dutch Share this post Link to post Share on other sites
bhaz 0 Posted January 10, 2011 (edited) The simple route would be in init.sqf: if (isServer) then { red1zone = createTrigger ["SomeObject", getPos red1mark]; red1zone setTriggerArea [150, 150, 0, false]; red1zone setTriggerActivation ["OPFOR", "PRESENT", true]; red1zone setTriggerStatements ["{_x iskindof 'T90' && canmove _x && canfire _x && ({_x iskindof 'RU_Soldier_Crew' && alive _x} count crew _x >= 2)} count thislist >= 2", "red1done=1", "red1done=0"]; red1zone setTriggerTimeout [300, 300, 300, true]; }; BTW, use single quotes when inside of double quotes, or the engine will shit bricks. I changed it above. Edited January 10, 2011 by bhaz Share this post Link to post Share on other sites
Dutch 10 Posted January 10, 2011 (edited) Ok thanks. But wouldnt this result in the trigger being added up each time a player JIPs? I could timagine this would reset timeout counters in the process as well or am i wrong in this? On another topic, the canFire condition works (at least if you have no ammo to shoot with, didnt test with damaged barrel yet)ect. As for the canMove condition, its name is a bit misleading. Damage level on tracks did have influence on this, becuase as soon as one track went out, the trig became inactive, but the tank was still able to "move" with the other track And i also tested with fuel=0 and in this case the canMove still counted as true whilst the tank could not move at all since it was out of fuel. So my question would be, is there a way to make the triggercode in post #5 have the vehicles check on: - Working tracks = true? - Working engine = true? - Working main gun = true? - Rotateble turret = true? Or maybe this would be too complicated and to much unnecesary load on the server? Edited January 10, 2011 by Dutch Share this post Link to post Share on other sites
shuko 59 Posted January 10, 2011 Expecting too much from a 10yo engine. Share this post Link to post Share on other sites
bhaz 0 Posted January 10, 2011 Ok thanks.But wouldnt this result in the trigger being added up each time a player JIPs? Init only runs once for each machine, and for JIP - only on their machine. The clients will skip past the isServer section. As for the rest, I guess it's possible - but complicated way beyond belief, and an impossible amount of effort for one mission. Share this post Link to post Share on other sites
Dutch 10 Posted January 10, 2011 Ok, ill take your advice on the Iserver code you provided earlier, sounds good :) As for the advanced conditions regarding the tanks, maybe i'd have to look in setfuel > # or setdamage <# instead to make it better accomplishable. But i expect that setdamage wont really work with ACE right? (armor system etc) Just fyi, the mission im building is meant to be a template for a new original PVP concept/serie. Once the website and project have been released i'll let you know. Share this post Link to post Share on other sites
Gekkibi 11 Posted January 10, 2011 "if (fuel object != 0) then {...};" for "I still have some fuel left". damage object isn't working for vehicles in ACE. It always returns 0 when not totally destroyed, and 1 when completely destroyed (Say, hitting a tank multiple times to engine and wait until it is all black). Share this post Link to post Share on other sites
Dutch 10 Posted January 12, 2011 The simple route would be in init.sqf Ok, i tried this and tested it both SP editor and on new created MP session on my comp but both tests failed. The new trigger was not created or was not working. Any idea what could be wrong? This is my init.sqf. - Red1 is how i intend the created trigger to be named. - Red1marker is a ellipse marker placed on map via editor. setViewDistance 4000; enableSaving [false, false]; [color="Purple"]if (isServer) then { red1 = createTrigger ["EmptyDetector", getMarkerPos "red1marker"]; red1 setTriggerArea [100, 80, 0, false]; red1 setTriggerActivation ["OPFOR", "PRESENT", true]; red1 setTriggerType "SWITCH"; red1 setTriggerText "text on"; red1 setTriggerStatements ["{_x iskindof 'T90' && canmove _x && canfire _x && ({_x iskindof 'RU_Soldier_Crew' && alive _x} count crew _x >= 2)} count thislist >= 2", "red1done=1, hint 'red1 is on',red1marker setMarkerBrush 'SOLID'", "red1done=0, hint 'red1 is off',red1marker setMarkerBrush 'Border'"]; red1 setTriggerTimeout [10, 10, 10, true]; };[/color] waitUntil {alive player}; player addEventHandler ["Killed", {[_this select 0] spawn {hideBody (_this select 0)}}]; Share this post Link to post Share on other sites
shuko 59 Posted January 12, 2011 There is no "OPFOR" side, it's "EAST". Share this post Link to post Share on other sites
fatty86 10 Posted January 12, 2011 I've been working on a scripted solution for this - I think I've finally cracked it. A fun puzzle to work on, definitely the most complicated thing I have written for ArmA so far :) Place a named trigger (e.g. tanktrigger1) to define the area to be captured, then from anywhere: nul = [tanktrigger1] execvm "tankchecker.sqf"; This is tankchecker.sqf: _trigger = _this select 0; _trigger setVariable ["captured", false, true]; while {true} do { scopename "tankchecker"; if (({_x iskindof "T90" && canmove _x && canfire _x && ({_x iskindof "RU_Soldier_Crew" && alive _x} count crew _x >= 2)} count (list _trigger)) >= 2) then { if !(_trigger getVariable "captured") then { _trigger setVariable ["time", time, true]; hint format ["Tanks began to capture %1",_trigger]; while {_timer = (time - (_trigger getVariable "time"));_timer < 300} do { if (({_x iskindof "T90" && canmove _x && canfire _x && ({_x iskindof "RU_Soldier_Crew" && alive _x} count crew _x >= 2)} count (list _trigger)) < 2) then { hint format ["Tanks failed to capture %1",_trigger]; breakTo "tankchecker"; }; sleep 5; }; _trigger setVariable ["captured", true, true]; hint format ["%1 was captured after five minutes.",_trigger]; breakTo "tankchecker"; }; } else { if (_trigger getVariable "captured") then {hint format ["%1 was lost.",_trigger];}; _trigger setVariable ["captured", false, true]; sleep 5; breakTo "tankchecker"; }; }; Share this post Link to post Share on other sites