Difference between revisions of "Talk:Door"
Jump to navigation
Jump to search
DavidJCobb (talk | contribs) (→Random teleports: new section) |
DavidJCobb (talk | contribs) |
||
Line 30: | Line 30: | ||
== Random teleports == | == Random teleports == | ||
The reason the assertion failure and subsequent crash occur when saving these is because the code to save them, within | The reason the assertion failure and subsequent crash occur when saving these is because the code to save them, within <code>TESObjectDOOR::SaveForm</code>, looks like this: | ||
<pre lang="C++"> | <pre lang="C++"> | ||
Line 41: | Line 41: | ||
} | } | ||
_WriteSubrecord('TNAM', &to_write, sizeof(to_write)); | _WriteSubrecord('TNAM', &to_write, sizeof(to_write)); | ||
} while (++i, this->random_destinations.size() | } while (++i, this->random_destinations.size() != 0); // should've been: ++i < this->random_destinations.size() | ||
} | } | ||
</pre> | </pre> | ||
Verified by reverse-engineering the LE CK. [[User:DavidJCobb|DavidJCobb]] ([[User talk:DavidJCobb|talk]]) 21:22, 30 June 2024 (EDT) | Verified by reverse-engineering the LE CK. [[User:DavidJCobb|DavidJCobb]] ([[User talk:DavidJCobb|talk]]) 21:22, 30 June 2024 (EDT) |
Revision as of 20:22, 30 June 2024
Controlling NPC usage
[Moved from Talk:Papyrus]
Would anyone happen to know how to stop certain actors from opening a certain door? GetTheJojDone 16:10, 15 April 2012 (EDT)
- The ways I can think of:
- don't given that NPC any packages that could cause it to travel through the door: give it fixed patrols to follow, make it sandbox out of range of the door, etc. This is the most obvious, simplest way, but fails in extreme situations (if you attack them, they might flee through the door still, etc).
- make the NPC "bound", as a more restrictive version of the above (problem; they are then unable to walk around).
- make the door "min use" (problem: affects all NPCs).
- lock the door, and don't give the NPC the key (problem: has no effect once door opens; affects other NPCs).
- have a separate navmesh either side of the door, with no connection between the two sides of the door (affects all NPCs; unreliable).
- (maybe?) set ownership of the door to everyone but that person? Not sure door ownership matters if unlocked, though.
- have a collision primitive around the door and make it so that this NPC is the only thing that collides with it. Not sure if that's even possible.
- have a collision primitive around the door with an OnTriggerEnter script that detects that NPC approaching, and changes their chosen package to be "walk away from this door". This way, everyone else can use the door freely, but the door is impassible to that one NPC even if you have made them a follower and are leading them through it (however, they may magically teleport to join you the next time you enter a new cell, if they are a follower).
- If it's a teleport door, ensure that the collision primitive encloses the red navmesh triangle for the door, as well as/instead of the door itself.
- Beware that this might result in them walking up to the door and back away again repeatedly, if their default package can only be fulfilled by passing through the door.
- Beware also that if the player leaves and returns after a few days, that NPC may be randomly placed anywhere in that cell, ignoring primitives and navmesh constraints and sometimes even locked doors! One workaround might be to have another collision primitive to detect the player approaching/leaving, then either move the NPC to a known-valid position on the correct side of the door when the player approaches; or binds the NPC in position, while the player is away.
- Hope some of those ideas were useful. --Catwheezle 23:44, 16 April 2012 (EDT)
- There are also a few supplied scripts that are meant to control door access; eg. DefaultNoEnemiesFollowDoorScript.psc & DefaultNoFollowDoorScript.psc
- Look at those and see if you can configure them to your liking using the properties, or roll your own script using those as an example. -- Tunaisafish 05:47, 17 April 2012 (EDT)
How do I set a patrol route, I'm new to modding, and sorry for the wait, I wasn't expecting a reply. GetTheJojDone 09:25, 19 May 2012 (EDT)
Random teleports
The reason the assertion failure and subsequent crash occur when saving these is because the code to save them, within TESObjectDOOR::SaveForm
, looks like this:
if (this->random_destinations.size() > 0) {
uint32_t i = 0;
do {
uint32_t to_write = this->random_destinations[i]->formID;
if (bSwapEndianness) { // global bool
to_write = _byteswap_ulong(to_write);
}
_WriteSubrecord('TNAM', &to_write, sizeof(to_write));
} while (++i, this->random_destinations.size() != 0); // should've been: ++i < this->random_destinations.size()
}
Verified by reverse-engineering the LE CK. DavidJCobb (talk) 21:22, 30 June 2024 (EDT)