dematti 10 Posted June 20, 2011 Hi, This is a hard one for me and can't seem to get it to work: I am using a respawn script for ai groups and let them move to markers placed inside towns using a waypoint script. I have several towns that need to be captured by the AI, opfor and blufor. I made the markers color red when opfor has seized a town, and blue when blufor seizes. Now, when the ai respawns after they all have been killed I want them to immedeately move to one of the towns that are not captured yet, random. So for blufor this must be something like: when markercolor blue, do not move to town. When markercolor red, possible town to move to. I want them to move to one of (random) the towns that are not captured yet. Who can help me out here a bit and maybe post a smal example wp script to get me started. thx Share this post Link to post Share on other sites
demonized 20 Posted June 20, 2011 asuming you are using a script for respawning AI, place this in where the ai is spawned: _null = _this_is_group_OF_respawned_AI execVM "engageTowns.sqf"; place function module on map. engageTowns.sqf // place all markers over towns in here _ALL_towns_markers = ["townMarker1","townMarker2","townMarker3","etc"]; _pos = []; // this will select a random town that is not yet captured. if ((side _this) == west) then { _notCapped = []; {if ((getMarkerColor _x) != "ColorBlue") then {_notCapped = _notCapped + [_x]}} foreach _ALL_towns_markers; _pos = _notCapped select (floor(random(count _notCapped))); } else { _notCapped = []; {if ((getMarkerColor _x) != "ColorRed") then {_notCapped = _notCapped + [_x]}} foreach _ALL_towns_markers; _pos = _notCapped select (floor(random(count _notCapped))); }; waitUntil { !isNil "BIS_fnc_init" }; // here we create a patrol for the group, its randomised 200 around center of marker, change to whatever you like, or create own waypoints. _null = [_this, _pos, 200] call BIS_fnc_taskPatrol; here is info on the automatic patrol script: http://community.bistudio.com/wiki/BIS_fnc_taskpatrol here is info on creating waypoints yourself instead: http://community.bistudio.com/wiki/addWaypoint Share this post Link to post Share on other sites
swed 10 Posted December 25, 2011 looks like a nice script i just cant get the script to work.any way for you to make this script a demo mission (like to use this script for mp.and the AI is placed in editor Share this post Link to post Share on other sites
demonized 20 Posted December 25, 2011 (edited) reworked script, using a very primitive respawn. Demo mission OA required Edit: Link updated with vehicle fix. Edited January 13, 2012 by Demonized Share this post Link to post Share on other sites
swed 10 Posted December 25, 2011 Thank you! For helping me out and for making this possible for me. Happy X-mas and a happy new year! Share this post Link to post Share on other sites
katipo66 94 Posted December 25, 2011 That is a very cool script Demonized! Share this post Link to post Share on other sites
katipo66 94 Posted January 13, 2012 (edited) Im using this script quite a bit... can i please request vehicle support for mechanized or motorized groups... or vehicles in general? Currently using Zonekiller's AI Vehicle Control System it works except i think its a bit hit and miss at times if AI spawn before vehicle and then move off on foot. Edited January 13, 2012 by Katipo66 Share this post Link to post Share on other sites
demonized 20 Posted January 13, 2012 (edited) Im using this script quite a bit... can i please request vehicle support for mechanized or motorized groups... or vehicles in general?Currently using Zonekiller's AI Vehicle Control System it works except i think its a bit hit and miss at times if AI spawn before vehicle and then move off on foot. There was an issue with vehicles, tusk, bradley maybe more when using BIS_fnc_taskPatrol. It appears that when beheaviour and speed was not set for each created waypoint these groups never moved, maybe due to me removing all waypoints prior to calling the function, so the creation from BIS_fnc_taskPatrol had no reference to work with. Anywho, included a modified version of BIS_fnc_taskPatrol as a function in the script, all working now. Demo mission OA required Edit: also includes vehicle respawn for groups. Edited January 13, 2012 by Demonized Share this post Link to post Share on other sites
katipo66 94 Posted January 13, 2012 Awesome!! thanks a lot man :D Share this post Link to post Share on other sites
demonized 20 Posted January 13, 2012 (edited) Forgot to include vehicle respawn, have added that now and updated download link. Edit: Also added a bonus in top of script :D Edited January 14, 2012 by Demonized Share this post Link to post Share on other sites
katipo66 94 Posted January 14, 2012 (edited) Yeah Bro!! :cc: Thanks for a very cool script!! Edit* just one more thing :o Units do not move into cargo on respawn, the crew does... units move off on foot with vehicle following? Edited January 14, 2012 by Katipo66 Share this post Link to post Share on other sites
demonized 20 Posted January 14, 2012 Units do not move into cargo on respawn, the crew does... units move off on foot with vehicle following? Fixed, also added some randomness in terms of how long units patrol cleared areas. downloadLink updated: Share this post Link to post Share on other sites
katipo66 94 Posted January 14, 2012 Confirmed, script now perfect :ok: Maybe worthy for your sig? thanks again! Share this post Link to post Share on other sites
katipo66 94 Posted February 23, 2012 (edited) May i request 3 more features for this script :) Option to limit respawns (this is the one i really want) And a delay on respawn a chance of no respawn Ive tried using your other scripts as examples but failed. Edited February 24, 2012 by Katipo66 Share this post Link to post Share on other sites
demonized 20 Posted February 24, 2012 May i request 3 more features for this script :) Option to limit respawns (this is the one i really want) And a delay on respawn a chance of no respawn done :D updated download Share this post Link to post Share on other sites
1para{god-father} 105 Posted February 25, 2012 (edited) Just started to use this and love it , as always keep up the great work. Will you be updating the Auto Trigger for MP at some point ? Also would it be possible to have it so when ALL zones are captured by Bluefor or OPFOR a message will popup or you can end mission ? Cheers ************edit************ Found a little issue but not sure why ?! If you place a few Objects in one of the trigger zones i.e bunkers walls etc.. it changes red for some reason even when no OPFOR are near the zone ? any idea why that would happen as i do not understand that ? cond count thisList != 0 AND ( ({side _x == west} count thisList) == 0 OR ({side _x == east} count thisList) == 0 ) init if ( ({side _x == west} count thisList) != 0 ) then {"townMarker1" setMarkerColor "colorBlue"} else {"townMarker1" setMarkerColor "colorRed"}; Edited February 25, 2012 by psvialli Issue Share this post Link to post Share on other sites
demonized 20 Posted February 25, 2012 Will you be updating the Auto Trigger for MP at some point ? Also would it be possible to have it so when ALL zones are captured by Bluefor or OPFOR a message will popup or you can end mission ? Cheers ************edit************ Found a little issue but not sure why ?! If you place a few Objects in one of the trigger zones i.e bunkers walls etc.. it changes red for some reason even when no OPFOR are near the zone ? any idea why that would happen as i do not understand that ? cond count thisList != 0 AND ( ({side _x == west} count thisList) == 0 OR ({side _x == east} count thisList) == 0 ) init if ( ({side _x == west} count thisList) != 0 ) then {"townMarker1" setMarkerColor "colorBlue"} else {"townMarker1" setMarkerColor "colorRed"}; * Objects in triggers issue fixed. * markercolors are updated for all clients via MP framework, so auto trigger function should work also in MP. Updated Download here is a little script you can use to track colors (captured markers) and end mission or give hint etc. /* * Save as anyScriptNameWillDo.sqf * Place the same markers here as in engageTowns.sqf. * Adjust win messages * Set the endMission types, check http://community.bistudio.com/wiki/endMission for info on endings. * place this in init.sqf or in any unit/object initline. _null = [] execVM "anyScriptNameWillDo.sqf"; */ _ALL_towns_markers = ["townMarker1","townMarker2"]; if (!isServer OR !isNil "endCheckThingy") exitWith {}; endCheckThingy = true; _cnt = count _ALL_towns_markers; waitUntil {sleep 1; ({getMarkerColor _x == "colorBlue"} count _ALL_towns_markers) == _cnt OR ({getMarkerColor _x == "colorRed"} count _ALL_towns_markers) == _cnt}; // now all markers is either red or blue. _endType = ""; if (getMarkerColor (_ALL_towns_markers select 0) == "colorBlue") then { // Bluefor win message or set a variable for your own end triggers etc. hint "Blue wins"; _endType = "END1"; } else { // Opfor win message or set a variable for your own end triggers etc. hint "Red wins"; _endType = "LOSER"; }; // below and the _endType lines can be deleted if you handle end of mission some other way. sleep 5; // wait 5 seconds after hint then endmission for all. [nil,nil,rendMission,_endType] call RE; Share this post Link to post Share on other sites
katipo66 94 Posted February 25, 2012 Mate, your a legend! :D I think it's complete now... Much appreciated, thanks again!! Share this post Link to post Share on other sites
1para{god-father} 105 Posted February 26, 2012 Works great now !!! I have been playing with the End Mission script , and really wanted a timer to show on screen with a countdown say 10min when all are captured , so if it reaches 0 and they still have all zones it will end game , if they recapture a zone it stops the countdown and wait until they are all captured again But it is over my head so would there be any change you could help on this as well ? My countdown timer i use / but for some reason it does not show on all clients well it does sometimes :) // Usage: nul = 10 execvm "timer.sqf" //psholdtimer = set to true / false as needed private ["_t","_min","_sec"]; _t = _this * 60; while {_t > 0 && psholdtimer} do { _min = floor (_t / 60); _sec = floor (_t mod 60); _min = (if (_min <= 9) then {"0"} else {""}) + str _min; _sec = (if (_sec <= 9) then {"0"} else {""}) + str _sec; hintsilent format["%1:%2",_min,_sec]; _t = _t - 1; sleep 1; }; hintsilent ""; Share this post Link to post Share on other sites
demonized 20 Posted February 26, 2012 (edited) I have been playing with the End Mission script , and really wanted a timer to show on screen with a countdown say 10min when all are captured , so if it reaches 0 and they still have all zones it will end game , if they recapture a zone it stops the countdown and wait until they are all captured again But it is over my head so would there be any change you could help on this as well ? EDIT: fixed hintSilent issue using rSPAWN hintSIlent "" This should do it, and for all players connected. /* * Save as timer.sqf * Place the same markers here as in engageTowns.sqf. * Adjust win messages * Set the endMission types, check http://community.bistudio.com/wiki/endMission for info on endings. * place this in init.sqf or in any unit/object initline, number is minute. _null = 10 execVM "timer.sqf"; Credits: Psivalli for the idea and actual timer part. */ _ALL_towns_markers = ["townMarker1","townMarker2"]; if (!isServer OR !isNil "endCheckThingy") exitWith {}; endCheckThingy = true; while {endCheckThingy} do { _cnt = count _ALL_towns_markers; waitUntil {sleep 1; ({getMarkerColor _x == "colorBlue"} count _ALL_towns_markers) == _cnt OR ({getMarkerColor _x == "colorRed"} count _ALL_towns_markers) == _cnt}; endCheckThingy = false; _t = _this * 60; while {_t > 0} do { _min = floor (_t / 60); _sec = floor (_t mod 60); _min = (if (_min <= 9) then {"0"} else {""}) + str _min; _sec = (if (_sec <= 9) then {"0"} else {""}) + str _sec; _t = _t - 1; [nil,nil,rSPAWN,hintSilent (format["%1:%2",_min,_sec])] call RE; sleep 1; _colorChk = []; { _col = getMarkerColor _x; if (!(_col in _colorChk)) then {_colorChk = _colorChk + [_col]}; } foreach _ALL_towns_markers; if (_t != 0 AND count _colorChk > 1) then {_t = 0; endCheckThingy = true}; }; [nil,nil,rSPAWN,hintSilent ""] call RE; if (!endCheckThingy) then { // now all markers is either red or blue. _endType = ""; if (getMarkerColor (_ALL_towns_markers select 0) == "colorBlue") then { // Bluefor win message or set a variable for your own end triggers etc. [nil,nil,rHINT,"Blue wins"] call RE; _endType = "END1"; } else { // Opfor win message or set a variable for your own end triggers etc. [nil,nil,rHINT,"Red wins"] call RE; _endType = "LOSER"; }; // below and the _endType lines can be deleted if you handle end of mission some other way. sleep 5; // wait 5 seconds after hint then endmission for all. [nil,nil,rendMission,_endType] call RE; }; }; Edited February 26, 2012 by Demonized fixed hintSilent issue with rSPAWN hintSilent Share this post Link to post Share on other sites
1para{god-father} 105 Posted February 27, 2012 Soooooooooooooooooo coooooooooooooollllllllll Many thanks works like a dream, makes setting up a quick mission very easy for sure now ! Share this post Link to post Share on other sites
demonized 20 Posted February 29, 2012 Modified the script, and posted a "public" version here, tnx to all feedback. Changelog: All sides can now use the script. Custom vehicles supported, as well as group seating in vehicles. Custom init line and parameters for groups available. Delete available. Fleeing adjustment. Contested marker. Customizable marker colors. Tweaks and code improvements. Stuff i forget. Share this post Link to post Share on other sites