I’m trying to learn advanced NWNscript from Celowin’s tutorials. Basically they were written for NWN1 although in most cases absolutely actual for NWN2.
But it looks like User Defined Events works differently in NWN1 & NWN2, nw_c2_default9 scripts is totally different, and there isn’t SetSpawnInCondition function.
Can you guys help me to understand how to make these scripts work in NWN2?
i believe they do work the same, but there’s likely to be a few “gotchas” along the way,
//:: X0_I0_SPAWNCOND
/*
This library separates out the spawn-in conditions from
nw_i0_generic for improved clarity. This cannot be
dual-#included with nw_i0_generic.
*/
// Sets the specified spawn-in condition on the caller as directed.
void SetSpawnInCondition(int nCondition, int bValid = TRUE);
ie,
set the spawn-in condition in the creature’s OnSpawn script
make sure the creature’s respective ai-script signals that event
Thx for quick respond! Script works but as I understand from Celowin’s tutorial, the point of User Defined Events is to simplify scripting and intended not affect event slots so we can keep creature default OnHeathbeat script…
the code in my example hb.nss is already in the stock OnHeartbeat script ( nw_c2_default1 ), at the very bottom
I pasted it above simply to show the idea …
as to whether a user-defined script actually lessens scripting or makes things easier is seldom the case in my experience,
usually if I want a custom behavior, i’ll copy an ai-script, rename it, assign it to a creature’s script-slot, modify it … this way only 1 script needs to change instead of two.
but it strongly depends on the “module environment” and how you’d like to do stuff there,