Immobile Animations

I’m not very experienced at using variables on creatures, and am having a heck of a time making this work. Should be simple, but…

First, it is NWN:EE, if that matters.

I’ve got the proper lines commented out of the nw_c2_default9 script to allow mobile and immobile animations. The problem I am running in to is that any NPC that has the default spawn script now use mobile animations no matter what variables they have set on them.

I’ve tried “CREATURE_VAR_USE_SPAWN_AMBIENT_IMMOBILE” as an int equal to 1, as a string equal to TRUE, and also adding “CREATURE_VAR_USE_SPAWN_AMBIENT” as both 0 and FALSE. The NPCs keep wandering around no matter what.

I can make it work if I make different versions of the default9 script and only uncomment the one I want used, but that seems messy for something that should be simple.

I’ve also tried google, and had no luck. TIA for any help!

Ensure that the unconditional animation lines are commented out, exactly as they are in the vanilla script. That will stop all creatures animating by default.

Confusingly, CREATURE_VAR_USE_SPAWN_AMBIENT_IMMOBILE is not the variable you need to set on the creature. Rather, it is a constant containing that name. If you consult x2_inc_switches, you’ll see it’s defined as X2_L_SPAWN_USE_AMBIENT_IMMOBILE. That’s the variable name you need to set.

It’s best practice to use meaningful constants rather than cryptic values when coding, for legibility, but Bioware scripts do so even when the value is meaningful, making the code harder to understand IMO.

1 Like

Thank you!

I actually found the correct variable in the include after I posted, but it still wasn’t working. What you helped me figure out, though, was that I had uncommented the unconditional animations, as well, so it was overriding the switches conditional.

Feels like such a silly, obvious mistake now, but I think those are actually sometimes the hardest to figure out when you get mired in something.

Anyway, it’s all tip top now, and behaving just as it should. So, thank you again!