Silver Surfer 0 Posted February 25, 2007 Hi there, I found a old OFP script it was a very usefull script that took care about AI (Inf and vehicle) movments you can also let the AI patrol in a certain area by random waypoints. I dont understand enough from scripting to tanslate it to Arma by myself so could one of you might have a look on it? Yes I know this looks very lazy but unfortunaly scripts are just a buch of numbers and signs for me so no idear what to change and whoever wrote this script did a excellent job. Init: (the numbers are object IDs, SF1 is the unit that moves) <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[SF1,5143,5137,3962,3927] exec "Host\move_wp.sqs" Script: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">? !(local server):exit _MAN= _this select 0 _MAN SetBehaviour "safe" _Z=1 #Runde ~Random 5 ? _Z == 1 : _w=_this select 1 ? _Z == 2 : _w=_this select 2 ? _Z == 3 : _w=_this select 3 ? _Z == 4 : _w=_this select 4 _MAN setspeedmode "limited" _MAN move getpos(object _w) @ (UnitReady _MAN) or (not alive _MAN) or Behaviour _MAN == "Combat" ? (not alive _MAN) : exit ? Behaviour _MAN == "Combat" : goto "Weiter" _Z=_Z+1 ? _Z == 5 : _Z=1 goto "Runde" #Weiter _ziel = _MAN ?_MAN KnowsAbout S1 > 0 : _ziel = S1 ?_MAN KnowsAbout S2 > 0 : _ziel = S2 ?_MAN KnowsAbout S3 > 0 : _ziel = S3 ?_MAN KnowsAbout S4 > 0 : _ziel = S4 ?_MAN KnowsAbout S5 > 0 : _ziel = S5 ?_MAN KnowsAbout S6 > 0 : _ziel = S6 ?_MAN KnowsAbout S7 > 0 : _ziel = S7 ?_MAN KnowsAbout S8 > 0 : _ziel = S8 ?_MAN KnowsAbout S9 > 0 : _ziel = S9 ?_MAN KnowsAbout S10 > 0 : _ziel = S10 ?_MAN KnowsAbout S11 > 0 : _ziel = S11 _MAN move getpos _ziel @ !( Behaviour _MAN == "Combat") or (not alive _MAN) goto "Runde" Init: (i02 is the unit, 60 is the radius and safe the combat mode) <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[i02,60,"safe"] exec "Host\move_area.sqs" Script: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">? !(local server):exit _Grupp = group (_this select 0) _ER= _this select 1 _Wi= _this select 2 _ER1= _ER+_ER _Xpos = (getpos (Leader _Grupp) select 0) _Ypos = (getpos (Leader _Grupp) select 1) (Leader _Grupp) SetBehaviour _Wi #Runde _XZ= (Random _ER1) -_ER _YZ= (Random _ER1) -_ER _X=(_XZ + _Xpos) _Y=(_YZ + _Ypos) ~1 (Leader _Grupp) move [_X,_Y] (Leader _Grupp) setspeedmode "limited" @ (UnitReady (Leader _Grupp)) or (not alive (Leader _Grupp)) or Behaviour (Leader _Grupp) == "Combat" ~5 ? (not alive (Leader _Grupp)) : exit ? Behaviour (Leader _Grupp) == "Combat" : goto "Weiter" ~Random 10 goto "Runde" #Weiter ?(Leader _Grupp) KnowsAbout S1 > 0 : (Leader _Grupp) move getpos S1; goto "Weiter1" ?(Leader _Grupp) KnowsAbout S2 > 0 : (Leader _Grupp) move getpos S2; goto "Weiter1" ?(Leader _Grupp) KnowsAbout S3 > 0 : (Leader _Grupp) move getpos S3; goto "Weiter1" ?(Leader _Grupp) KnowsAbout S4 > 0 : (Leader _Grupp) move getpos S4; goto "Weiter1" ?(Leader _Grupp) KnowsAbout S5 > 0 : (Leader _Grupp) move getpos S5; goto "Weiter1" ?(Leader _Grupp) KnowsAbout S6 > 0 : (Leader _Grupp) move getpos S6; goto "Weiter1" ?(Leader _Grupp) KnowsAbout S7 > 0 : (Leader _Grupp) move getpos S7; goto "Weiter1" ?(Leader _Grupp) KnowsAbout S8 > 0 : (Leader _Grupp) move getpos S8 #Weiter1 @ !( Behaviour (Leader _Grupp) == "Combat") goto "Runde" Waypoint part for vehicles Init: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> [t01,12760,12702,12760,12940] exec "Host\tank_wp.sqs" Script: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ? !(local server):exit _Tank= _this select 0 _Tank SetBehaviour "safe" _Z=1 #Runde ~Random 8 ? _Z == 1 : _w=_this select 1 ? _Z == 2 : _w=_this select 2 ? _Z == 3 : _w=_this select 3 ? _Z == 4 : _w=_this select 4 _Tank setspeedmode "normal" _Tank move getpos(object _w) @ (UnitReady _Tank) or (not alive _Tank) or Behaviour _Tank == "Combat" ? (not alive _Tank) : exit ? Behaviour _Tank == "Combat" : goto "Weiter" _Z=_Z+1 ? _Z == 5 : _Z=1 goto "Runde" #Weiter _ziel = _Tank ?_Tank KnowsAbout S1 > 0 : _ziel = S1 ?_Tank KnowsAbout S2 > 0 : _ziel = S2 ?_Tank KnowsAbout S3 > 0 : _ziel = S3 ?_Tank KnowsAbout S4 > 0 : _ziel = S4 ?_Tank KnowsAbout S5 > 0 : _ziel = S5 ?_Tank KnowsAbout S6 > 0 : _ziel = S6 ?_Tank KnowsAbout S7 > 0 : _ziel = S7 ?_Tank KnowsAbout S8 > 0 : _ziel = S8 _Tank move getpos _ziel @ !( Behaviour _Tank == "Combat") or (not alive _Tank) goto "Runde" Random part for vehicles Init:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[i02,60,"safe"] exec "Host\move_area.sqs" Script:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">? !(local server):exit _tank= _this select 0 _ER= _this select 1 _Wi= _this select 2 _ER1= _ER+_ER _Xpos = (getpos _tank select 0) _Ypos = (getpos _tank select 1) _tank SetBehaviour _Wi #Runde _XZ= (Random _ER1) -_ER _YZ= (Random _ER1) -_ER _X=(_XZ + _Xpos) _Y=(_YZ + _Ypos) ~2 _tank move [_X,_Y] _tank setspeedmode "limited" @ (UnitReady _tank) or (not alive _tank) or Behaviour _tank == "Combat" ? (not alive _tank) : exit ? Behaviour _tank == "Combat" : goto "Weiter" ~Random 20 goto "Runde" #Weiter ?_Tank KnowsAbout S1 > 0 : _Tank move getpos S1; goto "Weiter1" ?_Tank KnowsAbout S2 > 0 : _Tank move getpos S2; goto "Weiter1" ?_Tank KnowsAbout S3 > 0 : _Tank move getpos S3; goto "Weiter1" ?_Tank KnowsAbout S4 > 0 : _Tank move getpos S4; goto "Weiter1" ?_Tank KnowsAbout IG > 0 : _Tank move getpos IG; goto "Weiter1" ?_Tank KnowsAbout IE > 0 : _Tank move getpos IE; goto "Weiter1" ?_Tank KnowsAbout S7 > 0 : _Tank move getpos S7; goto "Weiter1" ?_Tank KnowsAbout S8 > 0 : _Tank move getpos S8; goto "Weiter1" ?_Tank KnowsAbout S9 > 0 : _Tank move getpos S9; goto "Weiter1" ?_Tank KnowsAbout S10 > 0 : _Tank move getpos S10; goto "Weiter1" ?_Tank KnowsAbout S11 > 0 : _Tank move getpos S11; goto "Weiter1" ?_Tank KnowsAbout S12 > 0 : _Tank move getpos S12 #Weiter1 @ !( Behaviour _Tank == "Combat") goto "Runde" Share this post Link to post Share on other sites
quiet_man 8 Posted February 25, 2007 try this: http://www.kronzky.info/ups/ QuietMan Share this post Link to post Share on other sites