Need help compiling script for NWN:EE

Hello, I made a script. It works with 1.69 - by using “default.ncs” to call a main script on PC Heartbeat. This is bad practice I understand, but I don’t see another way of calling the main script periodically otherwise without having to open every module which defeats the purpose of an override.

Except in NWN:EE with the function SetEvent(

Will this do what I think it will? The documentation is not very clear.


Will this

  1. Set a persistant event on the oPC, that calls my_script with oPC as “OBJECT_SELF” in main_script every oPC heartbeat?
  2. Overwrite other events?
  3. Be impossible to remove again?
  4. Even work at all?

Here is the big thing: I don’t own NWN:EE, so I can’t actually compile the file and test it. The project is currently located here: for the next 7 days, or until the file gets compiled. It’s the file “dpa_pxpp_EE.nss”. When finished, I will upload the project to The Vault. Would anybody be so kind and compile that file for me? Provided the script even works at all.

The main script (“dpa_pxpp.ncs”) adjusts the module XP Scale to accurately offset the party size penalty on xp from killing. It’s for single player modules where the xp loss is a bummer and using a completely custom xp system might be detrimental to the authors vision or simply be too much of a hassle to implement. It’s fully configurable with it’s own .2da file and meant for players mainly, not really module creators and definitely not PW’s.

Does anyone have a better way of how to call it periodically in 1.69 other than with “default.ncs”? I tried using my own “nw_c2_default7.ncs” in the override folder and it was already there- probably from CEP or other hak/override. Even then, the module I played (Lord of Terror) never called the script, which makes me think the “On(NPC)Death” file is even more often overwritten that “default.ncs”. Any ideas on what to do here? Opening each module and adding the event is the very last resort, and I wont do that since “default.ncs” works fine - until it doesn’t, of course.

This is also my first post on the forums, so hi! Hope you guys can help a noob.

Hi. :slight_smile:

It’s not exactly what you’re asking for, but - if it’s just supposed to be a singleplayer thing, I think you could sidestep using the events entirely by setting it up as a recursive pseudoheartbeat and triggering the whole thing via dm_runscript.

void PseudoHB()
    // If the loop ticks while the ACTIVE flag is gone, the loop aborts and removes the TICKING flag.
        SendMessageToPC(OBJECT_SELF, "Pseudohb loop aborted.");
        DeleteLocalInt(OBJECT_SELF, "PSEUDOHB_TICKING");

    // Do repeating stuff here.
    SendMessageToPC(OBJECT_SELF, "Pseudohb tick.");

    DelayCommand(5.0, PseudoHB());

void main()
    // If the script is called while the TICKING flag is present,
    // the ACTIVE flag gets removed, which will abort the loop on it's next tick.
        SendMessageToPC(OBJECT_SELF, "Flagging pseudohb loop for deactivation.");
        DeleteLocalInt(OBJECT_SELF, "PSEUDOHB_ACTIVE");
        // If the script is called while the TICKING flag is NOT present,
        // both flags get set and the loop starts.
        SendMessageToPC(OBJECT_SELF, "Activating pseudohb loop.");

I’ve made a couple of similar convenience scripts for singleplayer which use the above method, and it’s been working just fine in 1.69 and EE both. Place the .NCS version of the script into the override folder (extract from modules/temp0 while the toolset is open (… you probably knew this already :thinking:)), and then use dm_runscript to call it ingame, like so:

## DebugMode 1
## dm_runscript myloopyscript

This way around, you’re not altering default.ncs or affecting event scripts in the module at all - just setting up a looping script to kick off in any module you want, any time you want, until you tell it to stop.

Hey, thank you so much! I’m gonna try it out.

1 Like

@TheBarbarian Just want to say I uploaded the project using your modified script at .

I credited you both in the project description and in the source files where appropriate.