TYsiEK 0 Posted May 8, 2006 Hello mission makers ! I have two GPS scripts for you This is marker based GPS scripts that may be helpful while mission making and playing missions. The scripts (in .PBO) can be downloaded here. ============================================ First script is GPS of single unit. If unit gonna die, marker will change color to black and script will stop. You can execute it by after-mentioned command (write in unit init) #1 [gps_single_unit,"marker_name"] exec "\gps\gps.sqs" == remember to place markers name in exec with "" like "marker_name" == #2 Just place marker named "marker_name" (without "") on the map and it will work like hell ! ============================================ The second GPS script is for group of units. If individual unit will die, it's marker will change color to black and "mark" setMarkerPos getPos _Target command will stop so it will not overcharge CPU. Why dead unit should have gps ? HEHE If all units of example group will die, script will stop forever (in single mission of course ) Execute by after-mentioned command: #1 [gps_group_name,"first_marker_name"] exec "\gps\gpsgroup.sqs" == remember to place markers name in exec with "" like "marker_name" == #2 Place first marker on the map named for example "mark". Copy this marker and (if you have 12 units in group) past it 11 times so next markers will have names like "mark_1","mark_2","mark_3" etc. Remember not to change next markers names ! So that's all about using my script. Here you have code if you are interested how this is exactly looking <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ==Single unit GPS script== _Target = _this select 0 _Marker = _this select 1 #check ?!(alive _Target): goto "end" ?(alive _Target): goto "update" #update _Marker setMarkerPos getPos _Target ~1 goto "check" #end _Marker setMarkerColor "ColorBlack" ;end end ;exit exit <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ==Single group GPS script== _Group = _this select 0 _Marker = _this select 1 _g1 = (units _Group) #return ~2 ?!(alive (_g1 select 0)): _Marker setMarkerColor "ColorBlack" ?!(alive (_g1 select 1)): _Marker + "_1" setMarkerColor "ColorBlack" ?!(alive (_g1 select 2)): _Marker + "_2" setMarkerColor "ColorBlack" ?!(alive (_g1 select 3)): _Marker + "_3" setMarkerColor "ColorBlack" ?!(alive (_g1 select 4)): _Marker + "_4" setMarkerColor "ColorBlack" ?!(alive (_g1 select 5)): _Marker + "_5" setMarkerColor "ColorBlack" ?!(alive (_g1 select 6)): _Marker + "_6" setMarkerColor "ColorBlack" ?!(alive (_g1 select 7)): _Marker + "_7" setMarkerColor "ColorBlack" ?!(alive (_g1 select 8)): _Marker + "_8" setMarkerColor "ColorBlack" ?!(alive (_g1 select 9)): _Marker + "_9" setMarkerColor "ColorBlack" ?!(alive (_g1 select 10)): _Marker + "_10" setMarkerColor "ColorBlack" ?!(alive (_g1 select 11)): _Marker + "_11" setMarkerColor "ColorBlack" ?!(alive leader _Group): goto "end" goto "1" #1 ?!(alive (_g1 select 0)): goto "2" _Marker setMarkerPos getPos (_g1 select 0) ?(count _g1) > 1 : goto "2" ?(count _g1) == 1 : goto "return" #2 ?!(alive (_g1 select 1)): goto "3" _Marker + "_1" setMarkerPos getPos (_g1 select 1) ?(count _g1) > 2 : goto "3" ?(count _g1) == 2 : goto "return" #3 ?!(alive (_g1 select 2)): goto "4" _Marker + "_2" setMarkerPos getPos (_g1 select 2) ?(count _g1) > 3 : goto "4" ?(count _g1) == 3 : goto "return" #4 ?!(alive (_g1 select 3)): goto "5" _Marker + "_3" setMarkerPos getPos (_g1 select 3) ?(count _g1) > 4 : goto "5" ?(count _g1) == 4 : goto "return" #5 ?!(alive (_g1 select 4)): goto "6" _Marker + "_4" setMarkerPos getPos (_g1 select 4) ?(count _g1) > 5 : goto "6" ?(count _g1) == 5 : goto "return" #6 ?!(alive (_g1 select 5)): goto "7" _Marker + "_5" setMarkerPos getPos (_g1 select 5) ?(count _g1) > 6 : goto "7" ?(count _g1) == 6 : goto "return" #7 ?!(alive (_g1 select 6)): goto "8" _Marker + "_6" setMarkerPos getPos (_g1 select 6) ?(count _g1) > 7 : goto "8" ?(count _g1) == 7 : goto "return" #8 ?!(alive (_g1 select 7)): goto "9" _Marker + "_7" setMarkerPos getPos (_g1 select 7) ?(count _g1) > 8 : goto "9" ?(count _g1) == 8 : goto "return" #9 ?!(alive (_g1 select 8)): goto "10" _Marker + "_8" setMarkerPos getPos (_g1 select 8) ?(count _g1) > 9 : goto "10" ?(count _g1) == 9 : goto "return" #10 ?!(alive (_g1 select 9)): goto "11" _Marker + "_9" setMarkerPos getPos (_g1 select 9) ?(count _g1) > 10 : goto "11" ?(count _g1) == 10 : goto "return" #11 ?!(alive (_g1 select 10)): goto "12" _Marker + "_10" setMarkerPos getPos (_g1 select 10) ?(count _g1) > 11 : goto "12" ?(count _g1) == 11 : goto "return" #12 ?!(alive (_g1 select 11)): goto "return" _Marker + "_11" setMarkerPos getPos (_g1 select 11) ?(count _g1) == 12 : goto "return" #end player sideChat "Checking if leader of the group is still alive" ~10 ?!(alive leader _Group): goto "end2" ?(alive leader _Group): goto "hint" #hint player sideChat "Leader of the group is still alive... returning script" goto "return" #end2 player sideChat "All units of group is not alive... exiting script" ;end end Feel free to remake those scripts ! Oh yeah I'm so strange Share this post Link to post Share on other sites
ColonelSandersLite 0 Posted May 9, 2006 Awesome. I'll have to look at these. Share this post Link to post Share on other sites
TYsiEK 0 Posted May 9, 2006 Okay I have first errors I'll update it for some 30 mins Share this post Link to post Share on other sites
TYsiEK 0 Posted May 9, 2006 New version is availble now. Executing ---> [group_name,"first_marker_name",refresh time] exec "\gps\gpsgroup.sqs" So it looks like [gr1,"m",5] exec "\gps... All units in gr1 will have it's own marker with refresh rate 5 seconds. Download new version MIRROR 1 MIRROR 2 New code: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _Gr = _this select 0 _Mar = _this select 1 _Ti = _this select 2 ~2 _g = units _Gr _CG = "alive _x" count _g player sideChat format ["There are %1 allive people in %2 ... starting script","alive _x" count _g,_Gr] goto "update" ;================================================ #update ~_Ti _CG2 = "alive _x" count _g ?_CG2 == 0: goto "end" ;================================================ #1 ?MarkerColor _Mar == "ColorBlack": goto "2" ?(alive (_g select 0)): goto "1e" #1e _Mar setMarkerPos getPos (_g select 0) ?!(alive (_g select 0)): _Mar setMarkerColor "ColorBlack"; player sideChat format ["%1 is dead",_g select 0] ;================================================ #2 ?_CG == 1: goto "update" ?MarkerColor (_Mar + "_1") == "ColorBlack": goto "3" ?(alive (_g select 1)): goto "2e" #2e _Mar + "_1" setMarkerPos getPos (_g select 1) ?!(alive (_g select 1)): _Mar + "_1" setMarkerColor "ColorBlack"; player sideChat format ["%1 is dead",_g select 1] ;================================================ #3 ?_CG == 2: goto "update" ?MarkerColor (_Mar + "_2") == "ColorBlack": goto "4" ?(alive (_g select 2)): goto "3e" #3e _Mar + "_2" setMarkerPos getPos (_g select 2) ?!(alive (_g select 2)): _Mar + "_2" setMarkerColor "ColorBlack"; player sideChat format ["%1 is dead",_g select 2] ;================================================ #4 ?_CG == 3: goto "update" ?MarkerColor (_Mar + "_3") == "ColorBlack": goto "5" ?(alive (_g select 3)): goto "4e" #4e _Mar + "_3" setMarkerPos getPos (_g select 3) ?!(alive (_g select 3)): _Mar + "_3" setMarkerColor "ColorBlack"; player sideChat format ["%1 is dead",_g select 3] ;================================================ #5 ?_CG == 4: goto "update" ?MarkerColor (_Mar + "_4") == "ColorBlack": goto "6" ?(alive (_g select 4)): goto "5e" #5e _Mar + "_4" setMarkerPos getPos (_g select 4) ?!(alive (_g select 4)): _Mar + "_4" setMarkerColor "ColorBlack"; player sideChat format ["%1 is dead",_g select 4] ;================================================ #6 ?_CG == 5: goto "update" ?MarkerColor (_Mar + "_5") == "ColorBlack": goto "7" ?(alive (_g select 5)): goto "6e" #6e _Mar + "_5" setMarkerPos getPos (_g select 5) ?!(alive (_g select 5)): _Mar + "_5" setMarkerColor "ColorBlack"; player sideChat format ["%1 is dead",_g select 5] ;================================================ #7 ?_CG == 6: goto "update" ?MarkerColor (_Mar + "_6") == "ColorBlack": goto "8" ?(alive (_g select 6)): goto "7e" #7e _Mar + "_6" setMarkerPos getPos (_g select 6) ?!(alive (_g select 6)): _Mar + "_6" setMarkerColor "ColorBlack"; player sideChat format ["%1 is dead",_g select 6] ;================================================ #8 ?_CG == 7: goto "update" ?MarkerColor (_Mar + "_7") == "ColorBlack": goto "9" ?(alive (_g select 7)): goto "8e" #8e _Mar + "_7" setMarkerPos getPos (_g select 7) ?!(alive (_g select 7)): _Mar + "_7" setMarkerColor "ColorBlack"; player sideChat format ["%1 is dead",_g select 7] ;================================================ #9 ?_CG == 8: goto "update" ?MarkerColor (_Mar + "_8") == "ColorBlack": goto "10" ?(alive (_g select 8)): goto "9e" #9e _Mar + "_8" setMarkerPos getPos (_g select 8) ?!(alive (_g select 8)): _Mar + "_8" setMarkerColor "ColorBlack"; player sideChat format ["%1 is dead",_g select 8] ;================================================ #10 ?_CG == 9: goto "update" ?MarkerColor (_Mar + "_9") == "ColorBlack": goto "11" ?(alive (_g select 9)): goto "10e" #10e _Mar + "_9" setMarkerPos getPos (_g select 9) ?!(alive (_g select 9)): _Mar + "_9" setMarkerColor "ColorBlack"; player sideChat format ["%1 is dead",_g select 9] ;================================================ #11 ?_CG == 10: goto "update" ?MarkerColor (_Mar + "_10") == "ColorBlack": goto "12" ?(alive (_g select 10)): goto "11e" #11e _Mar + "_10" setMarkerPos getPos (_g select 10) ?!(alive (_g select 10)): _Mar + "_10" setMarkerColor "ColorBlack"; player sideChat format ["%1 is dead",_g select 10] ;================================================ #12 ?_CG == 11: goto "update" ?MarkerColor (_Mar + "_11") == "ColorBlack": goto "update" ?(alive (_g select 11)): goto "12e" #12e _Mar + "_11" setMarkerPos getPos (_g select 11) ?!(alive (_g select 11)): _Mar + "_11" setMarkerColor "ColorBlack"; player sideChat format ["%1 is dead",_g select 11] ;================================================ goto "update" #end player sideChat format ["All units in %1 group are dead... exiting script",_Gr] ~2 ?MarkerColor _Mar != "ColorBlack": _Mar setMarkerColor "ColorBlack" ?MarkerColor (_Mar + "_1") != "ColorBlack": _Mar + "_1" setMarkerColor "ColorBlack" ?MarkerColor (_Mar + "_2") != "ColorBlack": _Mar + "_2" setMarkerColor "ColorBlack" ?MarkerColor (_Mar + "_3") != "ColorBlack": _Mar + "_3" setMarkerColor "ColorBlack" ?MarkerColor (_Mar + "_4") != "ColorBlack": _Mar + "_4" setMarkerColor "ColorBlack" ?MarkerColor (_Mar + "_5") != "ColorBlack": _Mar + "_5" setMarkerColor "ColorBlack" ?MarkerColor (_Mar + "_6") != "ColorBlack": _Mar + "_6" setMarkerColor "ColorBlack" ?MarkerColor (_Mar + "_7") != "ColorBlack": _Mar + "_7" setMarkerColor "ColorBlack" ?MarkerColor (_Mar + "_8") != "ColorBlack": _Mar + "_8" setMarkerColor "ColorBlack" ?MarkerColor (_Mar + "_9") != "ColorBlack": _Mar + "_9" setMarkerColor "ColorBlack" ?MarkerColor (_Mar + "_10") != "ColorBlack": _Mar + "_10" setMarkerColor "ColorBlack" ?MarkerColor (_Mar + "_11") != "ColorBlack": _Mar + "_11" setMarkerColor "ColorBlack" ?MarkerColor (_Mar + "_12") != "ColorBlack": _Mar + "_12" setMarkerColor "ColorBlack" player sideChat format ["Script has been turned off. %1 will no longer be controlled by GPS",_Gr] exit Share this post Link to post Share on other sites
mandoble 1 Posted May 11, 2006 May be you should use getPos vehicle (_g1 select #) instead of getPos (_g1 select #) So you keep track of the units also when inside vehicles. Share this post Link to post Share on other sites
TYsiEK 0 Posted May 11, 2006 It keeps tracking units when they are in vehicle so tracking just vehicle isn't needed. Share this post Link to post Share on other sites
mandoble 1 Posted May 11, 2006 It keeps tracking units when they are in vehicle so tracking just vehicle isn't needed. You are correct, as penitence I compressed the script a bit <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _Gr = _this select 0 _Mar = _this select 1 _Ti = _this select 2 ~2 _g = units _Gr #loop ~_Ti _i = 1 "_c=""ColorGreen"";_m=format[""%1_%2"",_Mar,_i];if(damage _x > 0)then{_c=""ColorRed""};if(!alive _x)then{_c=""ColorBlue""};_m setMarkerColor _c;_m setMarkerPos getPos _x;_i=_i+1"forEach _g ?"alive _x" count _g==0:exit goto "loop" Share this post Link to post Share on other sites
TYsiEK 0 Posted May 11, 2006 Looking very nice Thanks man I was working on something kind of _i + 1 It's good but first marker must be named mark_0 and _i = 0 instead of _i = 1 Share this post Link to post Share on other sites
mandoble 1 Posted May 11, 2006 Why? Just create first marker as name_1. In any case, one point is pending to be solved there. Any group may change in members along a mission, for example, some reinforcements may join it. Share this post Link to post Share on other sites
TYsiEK 0 Posted May 12, 2006 It can be if(!alive _x)then{_m setMarkerColor};' Because now it sets maker pos on dead unit. But anyway sometimes getting position of dead body is useful But you did it very nice and short. Thank you once again Share this post Link to post Share on other sites