mr_shadow 4 Posted November 12, 2014 Hello, I would like to know if this is possible to add an action for every ATM, so far I know that I can check for distance of object to player and then add it, however I would like to be sure that it will be placed on each object including the custom placed. Share this post Link to post Share on other sites
Tajin 349 Posted November 12, 2014 In such cases I usually go the other way and instead add an action to the player that simply checks if cursorTarget is of a certain class. In your case, the addAction code could look like this: //ATM action act_useATM = player addAction[ "Use ATM", ' private["_trg"]; _trg = cursorTarget; player Sidechat format["This is one fine looking ATM! (%1)",_trg]; ', "", 10, true, true, "", ' _show = false; _trg = cursorTarget; if ( (typeOf _trg) in ["Land_Atm_01_F","Land_Atm_02_F"] ) then { _show = true; }; _show ' ]; Share this post Link to post Share on other sites
mr_shadow 4 Posted November 12, 2014 Thanks for help, gonna check it out today. Share this post Link to post Share on other sites
Viba 1 Posted November 12, 2014 And if the ATM:s don't have a classname you need to use nearestobjects with no classname and separate the atm machine by it's p3d filename. Share this post Link to post Share on other sites
iceman77 18 Posted November 12, 2014 Or you can just check against the type of cursortarget like Tajin's done :) Share this post Link to post Share on other sites
Viba 1 Posted November 12, 2014 Objects with no classnames, like ATM:s on the map, are not showing up with the cursorTarget command. Hence why I made the nearestObjects comment :) The cursorTarget command only works if you have manually created ATM:s on the map. Share this post Link to post Share on other sites
iceman77 18 Posted November 12, 2014 Ahh. What does typeOf cursorTarget return if you look at one of the pre-existing ATMs? Share this post Link to post Share on other sites
Viba 1 Posted November 12, 2014 Nothing, since the cursortarget doesn't return anything. Share this post Link to post Share on other sites
iceman77 18 Posted November 12, 2014 typeOf cursorTarget doesn't return a string? Or you're saying that cursortarget doesn't work with ATM's (just like it doesn't with objects like razor wire) Share this post Link to post Share on other sites
Tajin 349 Posted November 12, 2014 Apparently so. A script that removes/replaces all ATMs on the map might do the trick. Share this post Link to post Share on other sites
Viba 1 Posted November 13, 2014 Apparently so.A script that removes/replaces all ATMs on the map might do the trick. Far easier to just check what .p3d filename ATM:s have and do some string searching from the nearestObjects results with no classnames. Share this post Link to post Share on other sites
mr_shadow 4 Posted November 13, 2014 Far easier to just check what .p3d filename ATM:s have and do some string searching from the nearestObjects results with no classnames. Do you have an example? Share this post Link to post Share on other sites