Changing the "Uninjured" text on an NPC

Can this be done, or is it hardcoded? I have a character that is to appear to be dead but isn’t. He is to play dead as it is. I have tried with EffectDeath, or what it was called, but after doing that I couldn’t “revive” the character.

uninjured

have a look at DamageLevels.2da, STRING_REF col

Can’t you just make the character SelectableWhenDead?

Oh, didn’t know about that. That does work? Have you tried it?

Well it “works”, but I don’t know if it does exactly what you’re looking to do. I suggest giving it a try, such as by script-killing the creature, and letting us know.

It didn’t work, but it may be the usual “remove effect” scripting that still eludes me. That may what’s going on here.

I did it like this. The first script works but the second doesn’t (or rather, the function RemoveDeath doesn’t work, otherwise this script is fine).

This is the script on the trigger where the character Timmy plays dead:

#include "ginc_object"
#include "nw_i0_generic"

void Death(string sTagString, int iInstance = 0)
{
	//PrettyDebug("Applying Death Effect To: " + sTagString + " Instance = " + IntToString(iInstance));		
    
        object oObject = GetObjectByTag(sTagString, iInstance);

        AssignCommand(oObject, SetIsDestroyable( FALSE,FALSE,TRUE ));
	    SetImmortal( oObject, FALSE );
	    SetPlotFlag( oObject, FALSE );
        effect eFX = EffectDeath();
		eFX = SetEffectSpellId(eFX, 9991);
		//PrettyDebug("Name of oObject = " + GetName(oObject));		
        ApplyEffectToObject( DURATION_TYPE_INSTANT,eFX,oObject );
    
}


void main()
{

	object oPC = GetEnteringObject();
	
	if(!GetIsPC(oPC)) return;
		
	if(GetLocalInt(OBJECT_SELF,"done")) return;
    
	object oPC1 = GetOwnedCharacter(GetFactionLeader(GetFirstPC()));
	
	int nInt=GetLocalInt(oPC1,"NW_JOURNAL_ENTRYq_missingson");

	if (nInt == 11)
	{

    object oTimmy = SpawnCreatureAtWP("timmy", "timwp");
   	object oDireBoar = SpawnCreatureAtWP("l_boardire2", "de_direb");
   
	SetLocalInt(OBJECT_SELF,"done",1);
	
	//AssignCommand(oTimmy, ClearAllActions(TRUE));
   		
	//effect eFX = EffectKnockdown();			

	DelayCommand(1.f, Death("timmy")); 
	}	
   
}

The on the OnDeath slot of the dire boar I run this script (It’s a mish mash of scripts done for me by others here on the vault):

void RemoveDeath()
{
    object oTimmy;

    
 
        oTimmy = GetObjectByTag("timmy");

        if (GetIsObjectValid(oTimmy))
        {
            effect eSearch = GetFirstEffect(oTimmy);
            while (GetIsEffectValid(eSearch))
            {
                if (GetEffectSpellId(eSearch) == 9991) //your custom spell id
                {
                    RemoveEffect(oTimmy, eSearch);
                    eSearch = GetFirstEffect(oTimmy); //safety (removing an iterator from the list)
                }
                else
                    eSearch = GetNextEffect(oTimmy);
            }
        }
 
}

int CheckIfCreaturesWithTagAreAllDead(string tagName)
{
    object oPC = GetFactionLeader(GetFirstPC());
    int i = 1;
    object oOrc = GetNearestObjectByTag(tagName, oPC, i);
    while(GetIsObjectValid(oOrc))
    {
        if(!GetIsDead(oOrc)) {
			return FALSE;
        }
        i++;
        oOrc = GetNearestObjectByTag(tagName, oPC, i);
    }
	return TRUE;
}

void main()
{
	//object oArea = GetObjectByTag("fbnight");
	//object oPC = GetFirstPC(FALSE);
	
	if (GetLocalInt(OBJECT_SELF, "Done")) return;
	
	object oTimmy = GetObjectByTag("timmy");
	
			if (CheckIfCreaturesWithTagAreAllDead("l_boardire2"))
			{				
			
			AssignCommand(oTimmy, ClearAllActions());
			
			RemoveDeath();
			//PlayCustomAnimation(oTimmy, "%", FALSE);
			
			//ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectKnockdown(), oTimmy);
			SetLocalInt(OBJECT_SELF,"Done",1);
			
			}
			
				

}		

I tried another thing with a function I got from Lance Botelle, but that doesn’t work either.

void LBRemoveAllEffects(object oPC)
{
	effect eLoop=GetFirstEffect(oPC);

	while (GetIsEffectValid(eLoop))
   	{
	RemoveEffect(oPC, eLoop);
   	eLoop=GetNextEffect(oPC);
   	}
}

void RemoveDeath()
{
    object oTimmy;

    
 
        oTimmy = GetObjectByTag("timmy");

        if (GetIsObjectValid(oTimmy))
        {
            effect eSearch = GetFirstEffect(oTimmy);
            while (GetIsEffectValid(eSearch))
            {
                if (GetEffectSpellId(eSearch) == 9991) //your custom spell id
                {
                    RemoveEffect(oTimmy, eSearch);
                    eSearch = GetFirstEffect(oTimmy); //safety (removing an iterator from the list)
                }
                else
                    eSearch = GetNextEffect(oTimmy);
            }
        }
 
}

int CheckIfCreaturesWithTagAreAllDead(string tagName)
{
    object oPC = GetFactionLeader(GetFirstPC());
    int i = 1;
    object oOrc = GetNearestObjectByTag(tagName, oPC, i);
    while(GetIsObjectValid(oOrc))
    {
        if(!GetIsDead(oOrc)) {
			return FALSE;
        }
        i++;
        oOrc = GetNearestObjectByTag(tagName, oPC, i);
    }
	return TRUE;
}

void main()
{
	//object oArea = GetObjectByTag("fbnight");
	//object oPC = GetFirstPC(FALSE);
	
	if (GetLocalInt(OBJECT_SELF, "Done")) return;
	
	object oTimmy = GetObjectByTag("timmy");
	
			if (CheckIfCreaturesWithTagAreAllDead("l_boardire2"))
			{				
			
			AssignCommand(oTimmy, ClearAllActions());
			
			LBRemoveAllEffects(oTimmy);
			//PlayCustomAnimation(oTimmy, "%", FALSE);
			
			//ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectKnockdown(), oTimmy);
			SetLocalInt(OBJECT_SELF,"Done",1);
			
			}
			
				

}

So it seems that the SelectableWhenDead doesn’t work with removing the death effect. Sure, I can see that the character is clickable, but that seems to be the only thing it does.

I’ll give up on this idea then, and just do with the prone animation lying down that I had before trying this. It’s too bad that NWN2 is a bit crude when it comes to details like this. There are many things I wish were possible in NWN2 that it wasn’t made for apparently. Animations being a huge part of this where NWN2 is quite lacking and where it’s very hard to control how the game does things, and where things always get very buggy (I’m thinking of sitting animations for NPCs, for example).

Sorry, I see that I forgot what @kevL_s suggested. I’ll check that 2da file.

Ok. So I found that file and see that it says:

	LABEL	STRING_REF	COLOR	BOLD	DMG_LEVEL
0	UNINJURED	6409	white	1	1
1	BARELY_INJURED	6410	yellow	1	0.95
2	INJURED	6411	orange	1	0.75
3	HEAVILY_WOUNDED	6412	orange	1	0.5
4	NEAR_DEATH	6413	red	1	0.25
5	DEAD	6414	red	1	0
6	DYING	232104	pink	1	-0.49
7	DEAD	6414	red	1	-0.5

Do you mean that I could somehow manipulate the string_ref by scripting or something like that? Or how would I modify this without damaging the game completely? I guess I could just take my own version of this 2da and put it in the override folder, but still…what do I do and how, to achieve this?

// Place on the tigger's OnEnter event

#include "ginc_object"

void Death(object oObject)
{
	AssignCommand(oObject, SetIsDestroyable(FALSE, TRUE, TRUE));
	SetImmortal(oObject, FALSE);
	SetPlotFlag(oObject, FALSE);
	ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDeath(), oObject);
	SpawnCreatureAtWP("l_boardire2", "de_direb");
}

void main()
{
	object oPC = GetEnteringObject();
	
	if(!GetIsPC(oPC)) return;
		
	if (GetJournalEntry("q_missingson", GetFirstPC()) == 11 && !GetLocalInt(OBJECT_SELF, "done"))
	{
		object oTimmy = SpawnCreatureAtWP("timmy", "timwp");
		
		SetLocalInt(OBJECT_SELF, "done", TRUE);
		DelayCommand(1.0f, Death(oTimmy)); 
	}	
}
// Place on the boar's OnDeath event

void main()
{
	object oTimmy = GetNearestObjectByTag("timmy");	
	effect eEffect = EffectResurrection();

	eEffect = EffectLinkEffects(eEffect, EffectHeal(GetMaxHitPoints(oTimmy)));
	ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oTimmy);
	
	ExecuteScript("nw_c2_default7", OBJECT_SELF);
}
1 Like

Oh…Ok, that’s a way to do it, I guess, by resurrecting him.
One question though, will that have a visual effect like when “dead” companions come back to life after a fight? 'Cause if that is the case, then I don’t think it will work in this case, actually.

I’ll try that out later tonight.

No visual effect. Timmy should just stand up from being dead.

i dont think so. I put it up just for general reference (that should be where the “Uninjured” string comes from …)

but go w/ travus’ scripts,

Tried out your script, @travus . It looks really good! Thank you! I’ll go with that.

@kevL_s - Thanks for clarifying.

2 Likes