I want to place an animate Stone Golem; which also means I don’t want it to turn and face the PC when the PC clicks on it, and I don’t want it to do any “standing” animation. What’s the best way to go about it?
I thought about using the paralyze spell the creature (not exactly 100% sure how to do that and to last forever)-- but is there a better way?
Here’s a simple statue script, which you can call from the OnSpawn event script:
// Petrify creature as a "statue" which hostiles will not attack
void main()
{
SetPlotFlag(OBJECT_SELF, FALSE);
SetStandardFactionReputation(STANDARD_FACTION_HOSTILE, 50);
SetCommandable(FALSE, OBJECT_SELF);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectPetrify(), OBJECT_SELF);
SetPlotFlag(OBJECT_SELF, TRUE);
}
That automatically suppresses conversation turning and other movements.
There is also a Frozen Animations mod which allows you to freeze the creature in position at some point during an animation - you might want to borrow / tweak some of that code.
Coming back to the simple case, petrification doesn’t persist when a saved game is loaded, unless the module load script has a tweak like this:
// Fix a bug where statues load unpetrified
int i = 0;
object oStatue = GetObjectByTag("Statue", i);
while (GetIsObjectValid(oStatue))
{
if (!GetHasEffect(EFFECT_TYPE_PETRIFY, oStatue)) ExecuteScript("bh_statue", oStatue);
oStatue = GetObjectByTag("Statue", ++i);
}
}
Frozen statues are a little bit buggy visually - occasionally the player will see the true form for an instant on first encounter, and on death - but that’s about as good as it gets.
On serious note - in my opinion petrify/paralyze effects suck, I find it much easier to create a custom animation which only has one frame (the pose I require) and then use PlayCustomAnimation on heartbeat.
Thanks Proleric, the script worked just as you described it!
Actually since it’s a stone golem the stoneskin effect isn’t necessary (it just gives it grey texture instead of its black texture), but I know that it comes built-in with the Petrify effect. I won’t bother playing with “Petrify” definitions.
Just one side question, as a general rule of thumb I want to use OnUserDefined for any custom script I add, but it seems the OnUserDefined doesn’t have a defined number such as a heartbeat event ( Fire User Defined Event 1002)
My best guess is that because OnSpawn events are the initializing events, whenever I want to add anything to them/change them I just rewrite them or “save as” since OnUserDefined doesn’t apply to them.
For some reason, Bioware designed event handling so that you have to customise the OnSpawn script to enable OnUserDefined trapping of other standard events.
So, if Beamdog update the OnSpawn script, you won’t benefit from it immediately, because your OnSpawn script is already customised. I imagine that’s why there’s no event code for it.
If you like to keep your own code as separate as possible, you could change the OnSpawn script to SignalEvent with a custom event code, or simply ExecuteScript. Either way, you have to customise OnSpawn.
If you choose a custom code, I’d avoid 1007, as I’ve seen suggestions that it was reserved for OnSpawn but not fully implemented.
Gotcha,
I think I’ll just have modified OnSpawn scripts for such scenarios, not need to strain myself…Thanks.
I doubt Beamdogs would make any drastic coding changes like that…as a side note I would’ve been happier if I they just added more placeables/tilesets/creatures like some sort of integrated CEP only better, instead of messing with the scripting engine too much; I think for an old time-tested relic like NWN messing with the scripting engine is a mire they don’t want to get into (let alone the fact it would break tons of modules and PW’s).