Script function to find closest entity

Feedback on past, current, and future development.
Post Reply
User avatar
DementedSnake
Posts: 13
Joined: 26 Feb 2012, 21:15
Location: NC, USA
Contact:

Script function to find closest entity

Post by DementedSnake »

Would the OpenMW be able to implement a script function that returns the closest monster/NPC/player to a given object, point, or other entity?

Back when I played around with modding a lot. I spent a week trying to make a turret mod that automatically fired on anything that got too close to it. The best I could do was make it attack the player, nothing else. I couldn't figure out any way to have it detect NPCs and monsters without a 'pressure plate' of some kind. I could try making the turret out of a reskined monster with no melee attack, who couldn't move, had a single spell or crossbow, and either infinite magicka or bolts. Then I could make it aggressive to everything. I'm not sure if that would be a better option for my own personal mod idea. However, being able to find/list the closest entities seems like it would be very useful for future modding.
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Script function to find closest entity

Post by Zini »

What you describe is actually possible with default MW if you are willing to insert a piece of code into the script of every single NPC/creature. Of course for regular MW that is rather impractical.

Having a function for the nearest anything is a bit too specific IMO. I would rather have a function that lists everything within a specific range (maybe sorted by distance). Something like this is on my list, but not within the first one or two releases after 1.0 (needs a bit more groundwork first).
User avatar
DementedSnake
Posts: 13
Joined: 26 Feb 2012, 21:15
Location: NC, USA
Contact:

Re: Script function to find closest entity

Post by DementedSnake »

Listing anything within a given radius huh? That works perfectly well too, assuming the list could be sorted or culled in some way. I didn't know you already had something like that in mind. Neat.
Post Reply