Nicolas Eymerich 0 Posted May 2, 2007 Hi, As from the topic title, I've learned that Arma doesn't support anymore the fubnctio Object (Id). Instead you have to use nearestobject. Now, I've to put a lot of static mg gun on the map. The first idea is to put an equal number of gamelogic... The other way is to use the nearestobject function but I don't understand how.. Thanks in advance Share this post Link to post Share on other sites
maddogx 13 Posted May 2, 2007 I don't understand the connection between putting lots of static MGs on the map and using the nearestObject function for building IDs. Could you please explain that in more detail? Share this post Link to post Share on other sites
fasad 1 Posted May 2, 2007 hehe, fubnctio. Now, back on topic nearestObject works best when the position is near the objects position. Using a position that is far away from the object will freeze the game while it loads and searches through world data (or whatever it is doing). As MadDogX said, the link between static MGs, gamelogics and nearestObject id is not very clear. Can you explain what you are trying to achieve a bit more clearly? Share this post Link to post Share on other sites
baddo 0 Posted May 2, 2007 If you insert objects like static machine guns using the in-game editor's menus, there is no need to use nearestObject or game logics to get a reference to your objects. Just give your objects a name, preferably with a unique tag prefix (see www.ofpec.com for more info), and use those names then to access your objects. You could even create a list of all your static machine guns during mission start; like put them all into a global array variable. From there on it would be easy to check each mg's status and adjust if needed. I bet you can even do what you are trying to do without object names; Into init.sqs file (in your specific mission folder): <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">BDO_staticMgs = [] Into the initialization field of the static mg object (in mission editor): <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">BDO_staticMgs = BDO_staticMgs + [this] (BDO_ is my unique, reserved tag prefix which I use for all global symbols. Go to www.ofpec.com and reserve a tag for yourself, you need it trust me.) If you do that for all of your static mg's, you should then have them accessible through the variable BDO_staticMgs. This example is untested but I have a strong feeling it should work. Share this post Link to post Share on other sites
Nicolas Eymerich 0 Posted May 2, 2007 Thanks for your answer.. Well... I've been working on a dynamic mission since october 2005 and now I've bring it in Arma. Due to the fact it is a very large mission and it use a LOT of global variables, i was trying to use only global variable I need. That's the reason I've asked on the forum. As I've said, I could use one gamelogic for one mg. (or 1 gamelogic for 4\8 Mg). But there're 2 drawback: 1) The number of globalvariable increase 2) There isn't too precision in placing the mg while using a single gamelogic (_Mg1 = .... createvehicle [getpos Logic select 1 + 30 and so on]; _Mg2 = .... createvehicle [getpos Logic select 1 -30 and so on]) The idea suggested by Baddo is a good idea but unfortunatly it doesn't fit my purpose well. In fact: By placing any single mg on the map... I can't create them randomly (Mg, dshk, or mortars). In OpF object id worked like a charm: open the editor, take the id and voilà... You have the right place for the riht static mg. But Wiki tell that you can't use object ('cause of data streaming) and send you to the function nearestobject. Share this post Link to post Share on other sites
baddo 0 Posted May 2, 2007 Aha, so the static machine guns are to be dynamically created. That changes the situation. You also seem to want to control the locations where the static mg's are created by putting game logics into the desired positions. An alternative to this would be, if the static mg positions itself can be fixed, to store the [x,z,y] positions into a script/function file. This would be mission-specific of course. You wouldn't need to use a global variable for the position list, you could have them in a local variable of some function and get that list only when you need it. You could store the heading of the object in the same list too, and other info if needed. Updating such position list could get wearisome though, if you want to change static mg positions often when editing your mission. This could very well be a big-enough drawback to not use such fixed-positions list at all (for me probably would). Share this post Link to post Share on other sites
Nicolas Eymerich 0 Posted May 3, 2007 Thank again for your help. You've gave me a good idea I have a litle modified to fill my purpose. I've put on the editor a lot of object. In any object there's this init line [getpos this, this] exec "setpos.sqs" and the setpos script looks like this _Pos = _this select 0 _object = _this select 1 ;avoid multilpe launch ~(random 1 + random .5 + random .5) P_G_Pos = P_G_Pos + [ _Pos] ;deletevehicle deletevehicle _object Exit This script works really good for me! Thank you all again... Share this post Link to post Share on other sites