Jump to content

Force rest and detect nearby enemies


XJDHDR

Recommended Posts

I recently had an idea for a mod I want to create for Morrowind. I just want to know if there is a way of doing any of the following:

  • Force the player to rest/wait for a length of time.
  • Detect if there are any enemies nearby
  • Detect if the player is currently in a location where resting is not allowed.

 

I would ideally like to do this without MWSE so that my mod can be compatible with OpenMW but it's not a disaster this can't be done.

 

Link to comment
Share on other sites

Could you try this

To detect enemies you can use this:


if (GetDistance, Rat <200)


endif


you can replace Rat with any other enemy





To detect a place use this:


if (GetPCCell, "Koal Cave" == 1)

endif


you can replace koal cave with another location, 1 means that player is in the location, otherwise 0 means that it is not


Link to comment
Share on other sites

 

Could you try this
To detect enemies you can use this:
if (GetDistance, Rat <200)
endif
you can replace Rat with any other enemy
To detect a place use this:
if (GetPCCell, "Koal Cave" == 1)
endif
you can replace koal cave with another location, 1 means that player is in the location, otherwise 0 means that it is not

 

I'm sorry but there are numerous problems with your suggested scripts.

 

First, for your "detect enemies" script:

  • I am not trying to find out if a specific creature is nearby. I'm trying to find out if anything hostile is nearby.
  • The documentation for GetDistance says that it gets the distance from the first instance of that object. If I'm reading things right, it will only work for the first Rat that Bethesda placed in the game world, not for other instances of Rats or Rats that were added through game logic (e.g. scripts or levelled lists).
  • It is entirely possible to create creatures that are not hostile. For example, there are both hostile and friendly Guar in the game. If I figure out that there is a Guar nearby, how do I tell if it is hostile?
  • I would have to add such a check for every creature in the game that could be hostile to the script. This is very expensive and is incompatible with any mod added creatures.
  • I would also have to add a similar wall of scripting for hostile NPCs. And it would have the same problems as above.

 

As for the "detect a place" script:

  • I'm trying to figure out if the player is currently in any location where resting is illegal, not if they are simply in a particular location (i.e. does the player's current cell have the "sleep forbidden" flag ticked?)
  • I would have to add such a check for every cell in the game that could be flagged as 'sleep forbidden'. This is very expensive and is incompatible with any mod added cells.

 

On a side note, I found the "ShowRestMenu" command. While it's not exactly what I'm looking for, this could be a solution if I can't force the player to rest with scripts - I could keep opening the rest menu until the player rests a desired length of time.

Link to comment
Share on other sites

  • 4 weeks later...

what you want to do may range from very complicated to impossible with standard scripting, probably doable with mwse-lua

Sorry for the late reply but thanks. I did some more research and you seem to be correct. I could not find functions for even half of the things I would need to do using Morrowind Script, even with MWSE functions added in. I briefly looked through MWSE-Lua and it seems to have at least most of the functions and events I need. The problem is that I have no experience with Lua.

 

As for OpenMW, since it only supports Vanilla Morrowind scripting right now, it seems compatibility won't be possible. I heard they want to add Lua scripting to the engine though. I guess I will just have to shelve compatibility until then.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...