FORMERLY TITLED "Prevent NPCs from automatically exiting vehicle" (skip to post #4) Currently I am able to make NPCs lounge in a vehicle at a specific anchor point using world.sendEntityMessage. However, the moment they lounge, they immediately hop out of the vehicle and I suspect standard NPC behavior causes this. I was wondering if there is some possible way to stall NPC behavior or something that will prevent them from hopping out of the vehicle until I specifically handle that. Right now my investigations have been leading me to apply a status effect on the lounging entity (a modified version of timefreeze), but that still doesn't seem to stop them from hopping out of the vehicle. Thoughts?
I am familiar with state machines, but I'm not sure how I could use this. Are you suggesting that I make one for NPCs or that there is one NPCs use that I can access?
I found a couple ways of turning off NPC behavior temporarily; the method I'm using now is simply to replace the npc's update function with an empty one so long as a certain condition is true, then returns the normal one otherwise. My new issue is that using vehicle.setLoungeDance does not seem to cause NPCs to dance while they are in the appropriate loungePosition, which confuses me because that's exactly how vanilla vehicles make passengers dance (such as with the 'panic' dance when the vehicle is on fire). It works on the player just fine, but for some reason, the NPC just stands there. Conversely, using vehicle.setLoungeEmote DOES work on both NPCs and the player alike. I also tried using npc.dance in its place and that DOES make the NPC dance, but the way dances function in that form is different (slower, doesn't loop) and not usable for my circumstance. What am I missing?
After trying a few things, I have to ask - Is it even possible to make NPCs dance in vehicles by setting dances for lounge positions? I am beginning to notice that NPCs don't actually enter vehicles (that I know of), so would anyone know of NPCs that use vehicles, and whether or not it is even possible to make NPCs dance this way? I've been banging my head against this wall for days now.