Jump to content

Prevent Load Door while spell active / Detect Load Door use


Recommended Posts

Hi,

Part of the mod I'm working on involves a spell which, once it resolves (after 10 seconds, on keypress, or when out of AP) will translate the PC to a position determined at the time it was initially cast.

Everything works great, except when going through a load door while the spell is active.

 

Now I could just make it clear in the description to never do this, but it's better to just find a solution upfront.

 

Is there any way to either prevent players from activating any load doors while a spell is active (a sort of blanket BlockActivation) or detect if the player activates any load door? I've tried storing "GetCurrentLocation" in a variable and comparing IsSameLocation at the end to turn the translate off if they aren't the same, but then the spell no longer works if the player simply crosses an exterior cell border, which is no good.

 

EDIT: My fast and dirty solution was to calculate how far a player could actually travel in 10 seconds (about 5000 units, double that to be safe), and say only translate "If (PlayerRef.GetDistance(WarpTarget)) < 10000.0" because most cell changes are zillions of units apart.

 

Couple that with the description disclaimer and I think 99.99% of all accidental cell changes while active are covered, but I'd still love to learn a more appropriate way of doing this.

Edited by mmdestiny
Link to comment
Share on other sites

If you can identify the Forms or Keywords that most Load Doors use, you could load a formlist with the furniture or keywords and run:

 

FindAllReferencesOfType() or FindAllReferencesWithkeyword() and run BlockActivation() on the result array before and after.

 

Max default detection range is 5 uGridsToLoad or 10,240 game units which a player can sprint @500 units/second in 20 seconds so you should only have to run it once.

Edited by SKK50
Link to comment
Share on other sites

If you can identify the Forms or Keywords that most Load Doors use, you could load a formlist with the furniture or keywords and run:

 

FindAllReferencesOfType() or FindAllReferencesWithkeyword() and run BlockActivation() on the result array before and after.

 

Max default detection range is 5 uGridsToLoad or 10,240 game units which a player can sprint @500 units/second in 20 seconds so you should only have to run it once.

While this is a great idea (and one that I thought of myself and used in my "Close That Door" mod), the problem becomes when / if you are running mods that have custom doors. 99% of the time it won't matter, of course, but that 1% could be annoying. And load doors don't have any Keywords attached to them (at least that I could find in the CK).

Edited by Reneer
Link to comment
Share on other sites

A global "I am a load door" keyword update project ?

ÃÃÃÂ

As that would have to amend base game resources, I can't offer to do it :(

That wouldn't be any different (plus harder) than simply adding all vanilla doors to a Formlist and finding them using FindAllReferencesOfType(), then running through the list and checking to see if they were load doors via GetTeleportCell().

 

I'm not 100% sure of this, but I do think all vanilla load doors have "load" in their Editor IDs, so that would negate the step of checking using GetTeleportCell().

Edited by Reneer
Link to comment
Share on other sites

You could try using a perk which replaces the activate option of doors. However, that would require you to create a condition to find out if a door is a loaddoor or a "normal" one. No idea if that's possible.

 

But, what exactly is the problem with your spell? Why does using a loaddoor or crossing a cell border break it? That seems to be the odd thing here to me.

Link to comment
Share on other sites

The issue, if I understand correctly, is that once the spell ends it calls TranslateTo with the original location coordinates obtained when the spell started. Which is fine if you're still in the same cell but poses problems if you're in a different cell (like falling through the ground or floor). Edited by Reneer
Link to comment
Share on other sites

The issue, if I understand correctly, is that once the spell ends it calls TranslateTo with the original location coordinates obtained when the spell started. Which is fine if you're still in the same cell but poses problems if you're in a different cell (like falling through the ground or floor).

Yeah, that's a bad idea.

Instead, OP should put a marker at the original location, then moveTo the player to it.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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