Prospero 1 Posted October 26, 2002 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! 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
Bullz_eye_on_my_back 0 Posted March 17, 2003 This is one thing i would really really like to know myself! I wonder if anyone out there knows? Share this post Link to post Share on other sites
Tychon 0 Posted March 17, 2003 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
toadlife 3 Posted March 17, 2003 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 Posted March 17, 2003 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
uiox 0 Posted March 17, 2003 "Land" countType list triggerOne works, less easily than typeOf but works Share this post Link to post Share on other sites
Bullz_eye_on_my_back 0 Posted March 17, 2003 also im under the impression that the command for nearest object only works for only distances of about 50 meters is this true? Share this post Link to post Share on other sites
toadlife 3 Posted March 17, 2003 yes. 50 meters or less. I think its actually about 25 meters Share this post Link to post Share on other sites