Results 1 to 8 of 8

Thread: Defining custom object classes / nearestobject

Hybrid View

  1. #1
    Hi all,

    I don't understand how to define one's own object class. Anyone got an example?

    The reason I'm asking is: Does this mean one can use nearestObject (which now works again - joy&#33 to scan for one's own custom class?

    Oh, and while I'm here, could someone tell me which types work for nearestObject? I've tried things like "car" and "air" but they don't seem to work? I notice that leaving the type blank - just "" - scans for all objects.

    Prospero

  2. #2
    This is one thing i would really really like to know myself!

    I wonder if anyone out there knows?

  3. #3
    While I'm not entirely certain, I believe this is defined in the config.cpp of an object - hence I don't think it can be defined in OFP script. But, I could very well be wrong.
    Your mere mind cannot comprehend my evil in its entirety.

  4. #4

    Wink

    Unfortunately nearestobject only works with specific types, so you can't do nearestobject "tank", you have to nearestobject "m1a1". This is a very unfortunate limitation to the command.

    As far as custom types, you can't define them in a script. Addons are custom types. You can however, get a units type with the "typeof" command in 1.91.
    "Whenever you want information on the 'net, don't ask a question; just post a wrong answer." -- Cancer Omega.

  5. #5
    Guest
    The method that I use is a typeOf(nearestObeject pos) which returns the class name of the unit.

    </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">I don&#39;t understand how to define one&#39;s own object class. Anyone got an example?[/QUOTE]<span id='postcolor'>

    Config.cpp example:
    </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">
    class CfgVehicles
    {
    class All{};
    class AllVehicles&#58;All{};
    class Ship&#58; AllVehicles{};
    class SmallShip&#58; Ship{};
    class BoatW&#58; SmallShip{};
    *** *** *** *** *** *** class CoC_Mk48&#58; BoatW
    *** *** *** *** *** *** {
    *** *** *** *** *** *** *** *** ***vehicleClass=&#34;Chain of Command&#34;;
    *** *** *** *** *** *** *** *** ***displayName=&#34;Mark 48&#34;;
    ***....
    ***....
    ***....
    *** *** *** *** *** *** ***};
    };
    [/QUOTE]<span id='postcolor'>

    The "vehicleClass" parameter defines the custom vehicle class. TypeOf won&#39;t however return the vehicle class but the name of the unit class. i.e it won&#39;t return "Chain of Command" but "CoC_Mk48".

  6. #6
    "Land" countType list triggerOne works, less easily than typeOf but works

  7. #7
    also im under the impression that the command for nearest object only works for only distances of about 50 meters

    is this true?

  8. #8
    yes. 50 meters or less. I think its actually about 25 meters

Posting Permissions

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