Jump to content
Sign in to follow this  
Prospero

Defining custom object classes / nearestobject

Recommended Posts

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!wink.gif 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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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't understand how to define one's own object class. Anyone got an example?<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:All{};

class Ship: AllVehicles{};

class SmallShip: Ship{};

class BoatW: SmallShip{};

            class CoC_Mk48: BoatW

            {

                 vehicleClass="Chain of Command";

                 displayName="Mark 48";

 ....

 ....

 ....

             };

};

<span id='postcolor'>

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×