OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: fahterbob on 16 Jun 2003, 21:08:58
-
1st ?
The idear is to make a group move from one marker point to the next. Thus creating a partol rute. The problem is, that the script doesnt wait until the group is ready - it just "ignores" the @unitready...????
#Loop
"MarkerOne" SetMarkerPos GetPos (object xxxxx)
[UnitOne,1] SetWPPos GetMarkerPos "MarkerOne"
@UnitReady [UnitOne,1]
"MarkerOne" SetMarkerPos GetPos (object yyyyy)
[UnitOne,1] SetWPPos GetMarkerPos "MarkerOne"
@UnitReady [UnitOne,1]
goto "loop"
2'nd ?
If I would like to have 4 object ID's and make the script randomly choose between theese objects - how would I do that ?
Regards
:afro: - [RT] ThåMadz
-
#Loop
"MarkerOne" SetMarkerPos GetPos (object xxxxx)
[UnitOne,1] SetWPPos GetMarkerPos "MarkerOne"
@UnitReady [UnitOne,1]
"MarkerOne" SetMarkerPos GetPos (object yyyyy)
[UnitOne,1] SetWPPos GetMarkerPos "MarkerOne"
@UnitReady [UnitOne,1]
goto "loop"
Okaay I admit it - stupid like a barfin' allycat.
@ Unitready - and not @UnitReady .....DOUGH !
Anyway - 2 ? I still haven't figgerd out.
Help would be gratefuly apriciated.
Regards
:afro: [RT] ThåMadz
-
@UnitReady [UnitOne,1]
That is incorrect syntax. Use:
@unitready (leader unitone)
And replace this:
"MarkerOne" SetMarkerPos GetPos (object xxxxx)
[UnitOne,1] SetWPPos GetMarkerPos "MarkerOne"
with this:
unitone move getpos (object xxxxx)
You don't need the markers if you are already using an object as the destination.
Also, @unitready is to be used in conjunction with a move or domove command, not with the setwppos command. Basically, in your script, the unit is always ready because it hasn't been ordered anywhere.
-
Markers are only used for debuggin.
I use setwppos so I can control groups behaviour and formation etc. in a singel waypoint.
Keeps me from specifying it in scrpit.....sorry, but it's the easy way.
Anyway script works like a charm now with setwppos and @ unitready.
Now all I need is a rutine to make the unit choose randomly between 4 specified objects - and I have a random patrol rute with dynamic waypoints.
*Help* anyone ?
Regards
:afro: [RT] ThåMadz
-
check ed depot for icarus_uk random patrol script.
-
check ed depot for icarus_uk random patrol script.
Sorry , no luck.
*Help* Any one ?
Regards
:afro: [RT] ThåMadz
-
To :
make the script randomly choose between theese objects
you could :
create an array with your four objects :
_myarray=[_obj1,_obj2,_obj3,_obj4]
and then type something like :
_chosenobj=_myarray select (random 3)
This should do what you are looking for, even though I haven't tested it myself.
Another suggestion is to use toadlife's shuffle function (http://www.ofpec.com/editors/funcref.php?letter=S#Shuffle).
Hope this helps.
*edit :*
first suggestion doesn't seem to be satisfactory, check this thread (http://www.ofpec.com/yabbse/index.php?board=8;action=display;threadid=10474).
-
I've made a random patrol script that doesn't need any WP at all.
-> http://www.ofpec.com/editors/resource_view.php?id=526
-
Tnx Igor, that did the trick.
So heres the script for making a patrol move randomly between 4 objects, like 4 buildings, lampposts etc.
#Start
_obj1 = getpos (object 22222)
_obj2 = getpos (object 33333)
_obj3 = getpos (object 44444)
_obj4 = getpos (object 11111)
_myarray = [_obj1,_obj2,_obj3,_obj4]
_choose = _myarray select (random 3)
"MarkerOne" SetMarkerPos _choose
[UnitOne,1] SetWPPos GetMarkerPos "ptr"
@ UnitReady [UnitOne,1]
Goto "start"
It should make AI patrols less predictebel, yet controlebel.
Now just add grouplink II and U'r set for a hours, off sneeking through the bushes.
*Tnx* all
Regards
:afro: [RT] ThåMadz