Results 1 to 7 of 7

Thread: Detecting "man" class distance

  1. #1
    Master Gunnery Sergeant
    Join Date
    Jan 7 2002
    Location
    New Zealand
    Posts
    1,088
    Scenario:
    Rescue boat toodles off to find a downed pilot marooned on an island. Simple enuff?

    Problem:
    Script to detect, from script in rescue boat addon, if the nearestvehicle/object/unit is derived from the man class. By using the following script <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">
    _boat = _this select 0

    _timer = 200

    #loop
    ~0.001

    _person = nearestObject getpos _boat

    ? &#40;&#34;man&#34; counttype &#91;_person&#93; == 1 && _person distance _boat &#60; 20&#41; &#58; goto &#34;pickup&#34;
    _timer = _timer-1
    ?&#40;_timer&#62;0&#41;&#58;goto &#34;loop&#34;
    exit


    #Pickup
    _person assignAsCargo ***_Boat
    _person moveincargo _Boat
    _boat Sidechat &#34;Passenger on board&#34;
    exit[/QUOTE]
    it only works when the boat has gone on shore and is on top of the rescuee. *** ***Not favourable enuff unfortunately. So any suggestions to detect the guy at a minimum radius from the rescue boat?

    Oh and I have tried to figure this cos/sin mathematics thingee based upon the direction of the boat and its x,y positions, but it doesn&#39;t seem to gel in my old rain very well.


    P.s. this is for the Police launch with the next fishing boat release.



    We are now fully operational - that is, we are in a constant flap instead of having isolated confused situations.

    D.I.L.L.I.G.A.F.: Rebel Without a Pause

  2. #2
    Holds type "man" valid in water ?
    What&#39;s your navigational issue (bearing from _boat to _person ?)

  3. #3
    Nearest object only works out to 50 metres, but I can&#39;t
    remember if it&#39;s a box or a sphere.

    Does the marooned man &#39;request&#39; pickup? If so, you can
    include him in the script, and just do a &#39;distance&#39; between the
    boat and man, and wait for that to drop below 50 or so.

  4. #4
    With the right man type, for instance "civilian" etc. it works.
    nearestObject[boat , "civilian"]
    (man within 50m constraint of course)

  5. #5
    Master Gunnery Sergeant
    Join Date
    Jan 7 2002
    Location
    New Zealand
    Posts
    1,088
    Author of the Thread
    Quote Originally Posted by [b
    Quote[/b] ]With the right man type, for instance "civilian" etc. it works.
    nearestObject[boat , "civilian"]
    (man within 50m constraint of course)
    This part works no problem. However I dont want to write this code for every "man" type class. What I&#39;m aiming to do is get the rescue boat to pick up any human unit based on the parent class .e.g. "man".

    Quote Originally Posted by [b
    Quote[/b] ]Does the marooned man &#39;request&#39; pickup? If so, you can
    include him in the script, and just do a &#39;distance&#39; between the
    boat and man, and wait for that to drop below 50 or so.
    No. He doesn&#39;t request pickup. That is entirely a different script.

  6. #6
    Well i guess if you use nearestobject right at the same spot as the boat, it will always return the boat as being the closest, no? ***Try checking in random positions AROUND the boat for any people.. like this
    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_boat = _this select 0

    _timer = 200

    #loop
    ~0.001
    _pos = &#91;&#40;getpos _boat select 0&#41;+ 10 - random 20,&#40;getpos _boat select 1&#41;+10 - random 20,0&#93;
    _person = nearestObject _pos
    ? &#40;&#34;man&#34; counttype &#91;_person&#93; == 1 && _person distance _boat &#60; 20&#41; &#58; goto &#34;pickup&#34;
    _timer = _timer-1
    ?&#40;_timer&#62;0&#41;&#58;goto &#34;loop&#34;
    exit


    #Pickup
    _person assignAsCargo ***_Boat
    _person moveincargo _Boat
    _boat Sidechat &#34;Passenger on board&#34;
    exit[/QUOTE]

    Or if you want a Sin/Cos formula for finding people infront of the boat, or beside it, I can help you with that too.




  7. #7
    Master Gunnery Sergeant
    Join Date
    Jan 7 2002
    Location
    New Zealand
    Posts
    1,088
    Author of the Thread
    Quote Originally Posted by (Korax @ June 24 2004,07:30)
    Well i guess if you use nearestobject right at the same spot as the boat, it will always return the boat as being the closest, no? ***Try checking in random positions AROUND the boat for any people.. like this
    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_boat = _this select 0

    _timer = 200

    #loop
    ~0.001
    _pos = &#91;&#40;getpos _boat select 0&#41;+ 10 - random 20,&#40;getpos _boat select 1&#41;+10 - random 20,0&#93;
    _person = nearestObject _pos
    ? &#40;&#34;man&#34; counttype &#91;_person&#93; == 1 && _person distance _boat &#60; 20&#41; &#58; goto &#34;pickup&#34;
    _timer = _timer-1
    ?&#40;_timer&#62;0&#41;&#58;goto &#34;loop&#34;
    exit


    #Pickup
    _person assignAsCargo ***_Boat
    _person moveincargo _Boat
    _boat Sidechat &#34;Passenger on board&#34;
    exit
    Or if you want a Sin/Cos formula for finding people infront of the boat, or beside it, I can help you with that too.[/QUOTE]
    I&#39;ll try that thanks. y the way I would be interested in the sin cos functions to place objects on addons that have to move or change direction with the addon..


    edit: It works&#33;
    That got the guys a&#036;&#036; off the island. Thanks once again, Korax. The police boat is another step closer to release




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •