Icewind Dale module script help

Need help with changing death system, tried it some time ago but ive failed. Now i try again. I asked one of authors of IWD but he doesnt remember details, too much time have passed.

ChatGPT generated a script for me that knocks out characters instead of dying (and it works) but they will stay knocked after battle ends. How to make them stand up like in OC? Of course i have no idea what im doing, all the hard work did ChatGpt and i just keep pestering him.

// k_mod_player_death
/*
   Module OnDeath handler to queue KnockOut script for owned PCs
   Simulates character knockout similar to Original Campaign
*/
// BMA-OEI 12/19/05
// BMA-OEI 2/28/06 -- DeathScript support
// BMA-OEI 8/10/10 -- Exit if not owned by player (e.g. possessed companions)

#include "ginc_death"
#include "ginc_debug"

void main()
{
    object oDead = GetLastPlayerDied();
    PrintString("k_mod_player_death: " + GetName(oDead) + " executing OnPlayerDeath event");

    // Abort if dying character is not an owned PC
    if (!GetIsOwnedByPlayer(oDead))
    {
        PrintString("** k_mod_player_death: " + GetName(oDead) + " not owned by a player. ABORT!");
        return;
    }

    // Check for additional death script
    string sDeathScript = GetLocalString(oDead, "DeathScript");
    if (sDeathScript != "")
        ExecuteScript(sDeathScript, oDead);

    // Create a knock out effect to simulate unconsciousness
    effect eKnockOut = EffectKnockdown();
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eKnockOut, oDead);

    // Set a local boolean variable to track knockout status
    SetLocalInt(oDead, "IsKnockedOut", TRUE);
}

I’m probably the wrong person to try to answer this and I need to go sleep now but…

I know I have a variation of the death script that suits my needs well. However, after reading your post I’m not sure what you want to accomplish. What is it in the IWD death system that you want changed? What is it that it does now that you don’t like? Do you just want the vanilla death system or something?

Extract this to your override. I haven’t tested to be sure but I’m thinking it should be good to change the IWD death system to the OC knockout death system:

I try to make it like in OC, knockout instead of death.

Thank you for sharing, unfortunately it does not work.

This is the death script I use. Maybe this is the same as travus’ script, I don’t know, but I thought I could at least share it if there’s some difference:

// k_mod_player_death
/*
   Module OnDeath handler to queue KnockOut script for owned PCs
*/
// BMA-OEI 12/19/05
// BMA-OEI 2/28/06 -- DeathScript support
// BMA-OEI 8/10/10 -- Exit if not owned by player (e.g. possessed companions)
// MDiekmann 7/10/07 - Modified to cause game ending condition if caused by spirit eater death
// TDE 6/20/08 - Adapted script for NX2

#include "ginc_death" 
#include "ginc_debug"

void main()
{

		object oDead = GetLastPlayerDied();
	
		PrintString( "k_mod_player_death: " + GetName(oDead) + " executing OnPlayerDeath event" );

		// Abort if dying character is not an owned PC
		if ( GetIsOwnedByPlayer( oDead ) == FALSE )
		{
			PrintString( "** k_mod_player_death: " + GetName(oDead) + " not owned by a player. ABORT!" );
			return;	
		}
		// Making sure, here.
		//ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDeath(), oDead);
		AssignCommand( oDead, KnockOutCreature( oDead ) );
	
		// Check for additional death script
		string sDeathScript = GetLocalString( oDead, "DeathScript" );
		if ( sDeathScript != "" ) ExecuteScript( sDeathScript, oDead );	
	
		// Check if there are any members left for PC to possess
		if ( GetIsOwnedByPlayer(oDead) == TRUE || GetIsRosterMember(oDead) == TRUE )
		{
			if ( GetIsDeathPopUpDisplayed(oDead) == FALSE )
			{
				if ( GetIsPartyPossessible(oDead) == FALSE )
				{
					PrettyDebug( "*** NO ONE LEFT! ***", 30.0 );	
					ShowProperDeathScreen( oDead );
				}
			}
		}
	
		ExecuteScript("k_death_remove_gui", oDead);

}

Thanks for sharing but unfortunately characters still die

This may work…extract to your override:

1 Like

That works well! Characters still die but after battle ends they are revived. Thank you

1 Like