Jump to content
Sign in to follow this  
dr_eyeball

Identify static island building vs dynamic one

Recommended Posts

Quick question for a minor problem:

Q: When using an object search result (eg: nearObjects, nearestBuilding, etc) for type buildings let's say, is there a way to automatically tell whether the object is a static island object (part of the island/terrain) or whether it was placed dynamically (either inside mission file or created via script).

I need to be able to tell whether the object can be moved or not, or simulate destruction, or sometimes to tell whether it's relevant to the mission.

A temporary workaround I've used so far is to actually move the object, check if it's position changed, then move it back. But there must be a better way, especially when dealing with hundreds of objects in a MP environment.

Share this post


Link to post
Share on other sites

I don't know if there is a definitive solution, you might find your method is as good as any other. Perhaps one thing that might help you decide before doing a move test would be to check the objects scope. If it has a scope of 2 then it shows up in the editor, so it probably won't be a map object? At least that’s the theory.

Another alternative, but I'm not sure it would be any quicker or very practical, is to use object ID's. If you know the last ID to be used on a map, then any object with an ID greater, has been placed on the map during the mission. If your scripts are run from an addon you can probably obtain the maps last object ID automatically. Not sure the same can be said if you run it from a missions init though. However getting an objects ID requires you to extract the number from the object pointer when available. If it isn't available then it's probably an editor object.

Share this post


Link to post
Share on other sites

Do you have control over the scripts that create the dynamic

buildings?

You could register created objects in an array for later checking.

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  

×