×
Меню
Индекс

MSFD Making Actors lie down

 
It's not uncommon for modders to want actors to lie down, e.g. as a scheduled rest at night or a "corpse" that comes to life to attack the player.
Making this happen is not as simple as it sounds, so I thought I'd present a few ideas here. This is not a complete list of all information: it's just a place to start.
 
Custom animations:
These can be added to NPCs in the Construction Set (open the NPC's info box, "Add animation file" button, and select file); to play the animation use AIWander with 100 chance for the relevant idle and 0 chance for all other idles (assuming the animation is set to replace an idle, but most are).
 
Note that custom animations replace at least one standard animation, so you will also need to ensure that animation isn't played at random when you don't want the actor lying down. You will also need to prevent the player activating the NPC while the animation is playing (since the NPC is alive and conscious, activation will give normal dialogue), and prevent the NPC saying voice entries: this can be achieved by adding an empty entry for each relevant voice dialogue type and filtering it carefully. You can also add an empty greeting (carefully filtered) to prevent the player talking to NPCs, or creatures with dialogue.
 
PlayGroup:
In theory at least, you can use knockdown or death animations to make an actor lie down (for basic usage, see the function description). Note that some character animation groups may not work as expected with Bloodmoon, and some are different for different races. Note also that the NPC's upper body may not play the correct animation; this may be version-dependent (not tested) so even if it seems to work - be careful! In my experience, under version 1.6.1820, PlayGroup is too unreliable to be of much use with NPCs.
 
If you do use PlayGroup, you will also need to stop NPCs using normal voices and prevent the player activating them for dialogue, as above.
 
0 Fatigue:
This is usually the easiest method to use, and you won't need to do anything special to prevent the actor talking to the player while unconscious/dead/asleep. Note however that it will not work reliably by itself: usually the actor will not fall unless it takes a hit in combat or tries to move from where it is standing. Also note that if you use ModCurrentFatigue, the actor's Fatigue may end up set to a negative value: if you want to revive the actor at a particular time, be sure to mod Fatigue back up completely.
 
From my own tests, AIActivate is the best and most reliable method of getting the actor to move (and therefore fall) when at 0 Fatigue. Place the object to be activated far enough away from the actor so that the actor will try to move, and give a different AI command when reviving the actor. AIWander with distance (e.g. "AIWander 512 0 0") may also be useful, but be aware that the actor may stand in place for a while before falling (depends on the random idle/wander).
 
Other AI commands (including AIFollow) are not suitable: for example, AIFollow will have the actor standing up to follow when necessary, then falling down when the follow target stops moving. AIEscort may work if you can be sure the escort target will never be too far away: once the target is far enough away that the actor would normally stop and wait, the actor will "warp" to a standing position and stay there until the escort target comes back within range.
 
If you want the NPC to stop breathing, you can wait briefly after the AIActivate to give your NPC time to collapse, then add a paralysis ability.