Jump to content
Sign in to follow this  
[evo] dan

Putting Sea Mines into an array

Recommended Posts

I have been trying to write a script that would detect any naval mines placed within a certain area and then put the names and position of each mine into an array, so I can store it for later use (persistency purposes). However, I tried to use the "nearObjects" command and it came up with an empty array. I thought it was something wrong with the code, so I tried a speedboat, and it picked it up fine (I was using the classname given in the editor on the popup to drop the unit down). However, when I tried my mine again, it still gave me an empty array. Am I missing something or is this a bug?

So, to test here is what I am trying to do:

-Place a Naval Mine (Moored) in the editor. (classname used - UnderwaterMine)

-Place yourself near it in the water (less than 50m).

-Then get the name and pos of the mine and put it into an array.

It will do this for multiple mines within the area, but I haven't gotten it to work for even 1 yet. Can anybody help me out with this?

Edited by [EVO] Dan

Share this post


Link to post
Share on other sites

_mines = (getpos player) nearobjects ["UnderwaterMine_Range_Ammo",50]

_mines will be an array of all found.

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  

×