gazac 11 Posted October 10, 2013 Hi all I'm trying to do a Enemies left in this Area, this is what I have done far If I use this trigger x axis 100x100 Activation: OPFOR repeatedly Condition: hint format ["Enemies left in this Area: %1",count thislist]; counter=false; On Act: It works, but it show 'Enemies left in this Area: xx' on the screen all the time, what I want is it to show when I enter a trigger area only. --------------- so I did this 'trigger 1' it check if enemiesLeft = true in Condition; then does the On Act: trigger 1 axis 100x100 Activation: OPFOR repeatedly Condition: enemiesLeft = true; On Act: hint format ["Enemies left in this Area: %1",count thislist]; counter=false; This is where I set enemiesLeft = true in On Act: trigger 2 axis 120x120 Activation: BLUFOR Present Condition: On Act: enemiesLeft = true; This just wont work, any help please 1 Share this post Link to post Share on other sites
billw 1 Posted October 10, 2013 From the wiki: To remove the hint box from the screen, pass a null string ("") to the command. hint "" So you want hint "" in your deactivation of the box so the hint appears when you enter and disappears when you leave right? But I think it won't update when the value changes. In that case you could try and spawn a bit of script with a timer. e.g. hint.sqf while(trigger area is triggered) { write the hint text; wait 100 ms; } hint ""; trigger area: on act: spawn hint.sqf Share this post Link to post Share on other sites
cobra4v320 27 Posted October 10, 2013 Not tested. Create a trigger Area: 100x100 Activation: OPFOR Present Condition: this On Act: hint format ["Enemies left in this Area: %1",count thislist]; Share this post Link to post Share on other sites
kylania 567 Posted October 10, 2013 That'll hint once OPFOR is present but not again till they leave and come back. Share this post Link to post Share on other sites
iceman77 18 Posted October 10, 2013 (edited) init.sqf compile preProcessFile "e_counter.sqf"; e_counter.sqf TAG_Enemy_Count = { While {Player In List TrigName} Do { HintSilent format ["Enemies left in this Area: %1",count List TrigName]; sleep 1; // If updating it so frequently isn't needed, then use a bigger sleep }; }; HintSilent ""; Blufor Present Repeatedly condition: This && Player In Thislist Trigger OnAct:_handle = [] Spawn TAG_Enemy_Count Edited October 10, 2013 by Iceman77 Share this post Link to post Share on other sites
cobra4v320 27 Posted October 11, 2013 That'll hint once OPFOR is present but not again till they leave and come back. Yeah it needs a loop. Looks like Iceman77 has it covered. Share this post Link to post Share on other sites
cuel 25 Posted October 11, 2013 name: trigger1, Anybody, repeatedly condition player in thisList && {side _x == OPFOR} count thisList > 0 on act: showhints = true; on deact : showhints = false; Put a second trigger: condition showhints on act: hintSilent format ["Enemies left: %1",{side _x == OPFOR} count list [b]trigger1[/b]] This will make the hint show every time you enter the trigger but only once If you want the second trigger to refresh the hint, change the condition to showhints && ((round time) mod 2 == 0) Share this post Link to post Share on other sites
gazac 11 Posted October 12, 2013 Thanks everone for the help, but sorry to could not get any of them to work Iceman77's looks great but also could not get it to work what I did with Iceman scipt added to init.sqf compile preProcessFile "e_counter.sqf"; made script called e_counter.sqf TAG_Enemy_Count = { While {Player In List trigger1} Do { HintSilent format ["Enemies left in this Area: %1",count List trigger1]; sleep 1; }; }; HintSilent ""; Made a Trigger with 3 OPFOR in its area Trigger name: trigger1 axis: 30x30 Activation: OPFOR Present Repeatedly Made a another Trigger axis: 35x35 Activation: BLUFOR Present Repeatedly Condition: This && Player In Thislist On Act: _handle = [] Spawn TAG_Enemy_Count Don't know what I did wrong as I can see what it does, But no go. it does not show any Hint tag on the screen Again thanks for all the help Share this post Link to post Share on other sites
iceman77 18 Posted October 13, 2013 You should just use cuel's suggestion. Share this post Link to post Share on other sites
KevsNoTrev 44 Posted October 13, 2013 I have successfully used this in a "While {VariableIsCurrentlyTrue} do{ }" loop. I know you stated you were using a trigger, but this shows that you can also just use a marker. _aliveInZone = {[[getMarkerPos "NAMEofMarkerGoesHere", MarkerSize], _x] call BIS_fnc_inTrigger && side _x == opfor && alive _x} count AllUnits; The command has been updated since OA BIS_fnc_inTrigger File: inTrigger.sqf Author: Karel Moricky Description: Detects whether is position within trigger area. Parameter(s): _this select 0: OBJECT or ARRAY - Trigger or trigger area _this select 1: ARRAY or OBJECT - Position _this select 2 (Optional): BOOL - true for scalar result (distance from border) Returns: Boolean (true when position is in area, false if not). Share this post Link to post Share on other sites
gazac 11 Posted October 20, 2013 I have successfully used this in a "While {VariableIsCurrentlyTrue} do{ }" loop.I know you stated you were using a trigger, but this shows that you can also just use a marker. _aliveInZone = {[[getMarkerPos "NAMEofMarkerGoesHere", MarkerSize], _x] call BIS_fnc_inTrigger && side _x == opfor && alive _x} count AllUnits; KevsnoTrev, I have been playing around with this, but can't get it to show the hint count no matter what I do, can you help please. Share this post Link to post Share on other sites
jw custom 56 Posted October 20, 2013 You could also do: Activation: OPFOR / Once / Present On Act: null = [thisTrigger] spawn { _list = _this select 0; while {true} do { hintSilent format ["Number of enemies: %1", east countSide list _list]; if (east countSide list _list < 1) exitWith {}; sleep 1; }; hint "All enemies are dead!"; }; Share this post Link to post Share on other sites
KevsNoTrev 44 Posted October 20, 2013 KevsnoTrev, I have been playing around with this, but can't get it to show the hint count no matter what I do, can you help please. just use hint format["Enemies Left: %1", _aliveInZone]; just make sure you have the marker name changed, or use the name of the trigger instead. eg. {[trig1,_x] call bis_fnc_inTrigger && side _x == opfor && alive _x} count AllUnits; where trig1 is the name of your trigger. Share this post Link to post Share on other sites
gazac 11 Posted October 21, 2013 Thanks for all your help with my mission, I have learnt a lot with your help. All your scripts work great, but did not do what I realty wanted, many thanks to KevsnoTrev for help this is what I ended up with, it maybe done better but it works just like I wanted. In my mission I have 6 towns that spawns OPFOR by EOS, and runs this scripts on each town as BLUFOR units enter the town. this covered the OPFOR area trigger called: trg1 axis 100x100 Activation: OPFOR once Condition: this On Act: another trigger to run the sctipt trigger called: axis 120x120 Activation: BLUFOR Repeatedly Condition: this On Act: nul = [] execVM "scripts\Enemies_left_1.sqf"; On Dea: hint "";EnemiesLeft=false; 'Enemies_left_1.sqf' EnemiesLeft=true; while {EnemiesLeft} do { _aliveInZone = {[trg1,_x] call bis_fnc_inTrigger && side _x == opfor && alive _x} count AllUnits; hint format["Enemies Left: %1", _aliveInZone]; if(_aliveInZone==0)exitWith {}; sleep 1; }; sleep 3; hint ""; I tried having all the code in one sqf but could not work it out, so did the scripts like Enemies_left_1.sqf,Enemies_left_2.sqf,Enemies_left_3.sqf ect, it works Again Many Thanks to all Share this post Link to post Share on other sites