Detecting whether it is illegal to sleep here

Post » Wed Jun 29, 2016 9:09 pm

Hello again,


I would like to ask if there is a way to detect whether it is possible to sleep in current area? I checked MW scripting for dummies and found no such function. But perhaps by forcing player to try to rest and checking menumode or something like that?



Thanks again for any help :)

User avatar
Tinkerbells
 
Posts: 3432
Joined: Sat Jun 24, 2006 10:22 pm

Post » Thu Jun 30, 2016 1:38 am

I really can't think of any way. You could force bringing up the rest menu via ShowRestMenu, and then detect if the player sleeps, but I don't see how you could use this to detect whether resting is blocked in the cell (it will probably work even in non-resting cells?), or differentiate from the PC using normal beds found in the cell.



Is tightly controlling the PC's access routes into the area and then just keeping tabs on whether or not they've entered / exited the area an option?



Edit: alternatively, maybe having the area not flagged as 'no sleeping' and then lacing it with activators with scripts to detect if PC sleeps and then instantly wakes them with a message like "sleeping is not allowed here" or something? Downside is that the PC can't wait either...



Sorry, not very helpful!

User avatar
Stu Clarke
 
Posts: 3326
Joined: Fri Jun 22, 2007 1:45 pm

Post » Wed Jun 29, 2016 2:28 pm

Thanks, unfortunatelly what you suggested would not work. I was creating portable bedroll mod, since other ones I saw on Nexus were written very poorly. But I want the portable bedroll to be unusable in areas which are illegal to sleep.

User avatar
Dean Ashcroft
 
Posts: 3566
Joined: Wed Jul 25, 2007 1:20 am

Post » Wed Jun 29, 2016 11:41 pm

How about a work around for the problem by detecting what wheather doesn't allow the player to sleep under the sky outside of a tent or a yurt?



I dunno but I think an interior cell in a tent or a yurt is the best option to detect bad wheather, so if it's possible then the player will be protected from bad wheather e.g ash storm, snow storm, thunder storm, heavy rain.



Perhaps a global script is required or make use of a vanilla global script.

User avatar
Skivs
 
Posts: 3550
Joined: Sat Dec 01, 2007 10:06 pm

Post » Wed Jun 29, 2016 5:42 pm


I'm not sure if I understand you correctly about what you are suggesting.



Anyway, I'm not using tent or anything, just pickable bedroll activator. Also making it work based on weather is not a problem, that is extremely simple actually. But I want to prevent player from being able to sleep in the middle of shop etc., so I want to detect whether current cell has "Illegal to sleep" flag set to true or false.

User avatar
Natalie J Webster
 
Posts: 3488
Joined: Tue Jul 25, 2006 1:35 pm

Post » Wed Jun 29, 2016 6:22 pm

I bet you have played NoM before, but if you haven't then play it at least one round, because NoM can detect what wheather is suitable when sleeping outside on a bedroll without a shelter.

User avatar
Ricky Meehan
 
Posts: 3364
Joined: Wed Jun 27, 2007 5:42 pm

Post » Wed Jun 29, 2016 2:52 pm

Once again, as I said in my previous post - I KNOW how to detect weather, that is very simple. What I WANT to do is to detect whether current cell is MARKED AS "ILLEGAL TO SLEEP"

User avatar
The Time Car
 
Posts: 3435
Joined: Sat Oct 27, 2007 7:13 pm

Post » Thu Jun 30, 2016 1:26 am

AFAIK you can't detect "illegal to sleep" flag.


GetInterior could detect interiors (assuming you can't use bedroll also in the few interior-as-exterior cells), but it will also exclude the few tent-like cells.


For generic exteriors there is no easy solution, for now you could define a global short NOM_illegal_cell_v and use a NOM_illegal_cell_v == 20 test, at least it will work when NOM is loaded/in NOM covered areas

User avatar
Neil
 
Posts: 3357
Joined: Sat Jul 14, 2007 5:08 am

Post » Wed Jun 29, 2016 5:44 pm

Thanks! I was afraid it is not possible. Perhaps with MWSE? Although I do not think it would have function for this.

User avatar
Nick Swan
 
Posts: 3511
Joined: Sat Dec 01, 2007 1:34 pm

Post » Wed Jun 29, 2016 1:34 pm

I am not sure, but no, I think not even MWSE has a dedicated function to get the cell flag.


I think you could use a tes3cmd script to extract all flagged cells to something like Data Files\MWSE\illegal_cells.txt and then read/compare the cell names from a mwse script, but i don't know how much this is worth the effort and you would have to re-run the generator on mod list update

User avatar
Ellie English
 
Posts: 3457
Joined: Tue Jul 11, 2006 4:47 pm

Post » Wed Jun 29, 2016 3:44 pm


Yeah, that would not be worth the effort.

User avatar
ImmaTakeYour
 
Posts: 3383
Joined: Mon Sep 03, 2007 12:45 pm


Return to III - Morrowind