Knockdown Effect - Can it be detected on a PC?

The subject says it all.

Is it possible to detect if a PC has the Knockdown effect on them?

Thanks in advance.

not sure, try this tho

int hasKnockdown(object oTarget)
{
    return GetHasFeatEffect(FEAT_KNOCKDOWN, oTarget)
        || GetHasFeatEffect(FEAT_IMPROVED_KNOCKDOWN, oTarget);
}

No, it’s not possible without using local vars (or custom spell ids, maybe). The code above will not work.

Hi KevL,

I had not seen (or had use of) that function before and so looked it up in the lexicon and found this in its remarks - and so will try it out just in case.

" Remarks

This should return TRUE even if the feat applies spell-like effects (such as Barbarian Rage, which has a “spell” attached to it, to apply effects), although it cirtainly accuratly reports when such feats as Knockdown are applied to a target." (SIC)

Hi Aqvilinus,

That was my initial conclusion, but unless there is something I have missed, it may be that KevL has seen a means to detect it. Unless the Lexicon is out of date with ref to NWN2 perhaps?

Thanks all, Lance.

to me it’s still up in the air. I used to use a custom var, eg. kL_VAR_ISKNOCKEDDOWN like Aqvilinus suggests. Later I saw GetHasFeatEffect() but didn’t test it …

Hi Again,

Well, I just tried testing that function and I am still not 100% sure even now, because the PC appeared to be “knocked down”, but I still had some aspect of control and my own test code was not reporting “compromised” - which would suggest it does not work … except I have not yet been able to confirm from a positive aspect if it does report “compromised” when I do not have any control - regardless of what the animation may look like.

Anyway, I will leave the function in place and see how it goes with further testing. I don’t really fancy adding var checks to the OC if I can help it. It’s a “minor … ish” aspect of the turn-based feedback, in case the player did not realise they were “knocked down” and so “compromised” as a reason for not being able to possess and control a PCs actions (if the animation was also not quite in synch with the effect).

Cheers!

did some tests: didn’t work on either a monster or my PC.

which means you’d basically have to replace the Knockdown/Improved feats … i’d think

set them up with impactscripts, etc.

 
GetCommandable() returns false if knocked down though.

1 Like

Are they lying on the ground in the middle of the battle and not groaning?

I wonder what GetCurrentAction shows?

ACTION_INVALID - 65535

/tested

I have tested ACTION with a 0.1 seconds delay check after using an item and it returned ACTION_ITEMCASTSPELL (19), it takes a non-zero amount of time (more than 0.1 seconds) for action to clear to invalid after a knockdown.

I have made this subroutine to check if a creature is knocked down or not, and tested it (not very much)
If someone thinks that it can yield false positives (for false negatives I’m more confident, although I didn’t test if the hardcoded knockdown feats apply an effect or not) then we’ll see if we can add further checks, if it’s something that can happen outside of 1 in a billion chance in normal gameplay.

int GetIsKnockedDown(object oPC)
{
	if (GetIsImmune(oPC, IMMUNITY_TYPE_KNOCKDOWN) == TRUE) return FALSE;
	if (GetCommandable(oPC) == TRUE) return FALSE;
	
	effect eFX = GetFirstEffect(oPC);
	while (GetIsEffectValid(eFX) == TRUE)
	{
		if (GetEffectType(eFX) == EFFECT_TYPE_INVALIDEFFECT)
		{
			if (GetEffectInteger(eFX, 0) == 0)
			{
				if (GetEffectInteger(eFX, 1) == 0)
				{
					if (GetEffectInteger(eFX, 2) == 0) return TRUE;
				}
			}
		}
		eFX = GetNextEffect(oPC);
	}
	return FALSE;
}
1 Like



increase the odds to a billion++

// call after a delay else Action may not be evaluated correctly
int IsKnockedDownByStandardFeat(object oTarget)
{
    if (!GetCommandable(oTarget)
        && GetCurrentAction(oTarget) == ACTION_INVALID
        && !GetIsImmune(oTarget, IMMUNITY_TYPE_KNOCKDOWN))
    {
        effect eScan = GetFirstEffect(oTarget);
        while (GetIsEffectValid(eScan))
        {
            if (GetEffectType(eScan) == EFFECT_TYPE_INVALIDEFFECT
                && GetEffectDurationType(eScan) == DURATION_TYPE_TEMPORARY
                && GetEffectSpellId(eScan) == -1
                && !GetEffectSubType(eScan)
                && !GetEffectInteger(eScan, 0)
                && !GetEffectInteger(eScan, 1)
                && !GetEffectInteger(eScan, 2)
                && !GetEffectInteger(eScan, 3))
            {
                return TRUE;
            }
            eScan = GetNextEffect(oTarget);
        }
    }
    return FALSE;
}
1 Like

With ACTION_INVALID it can give false negatives, I have replicated it already with a knockdown applied by an item on myself, checking after a 0.1 delay it still returned 19 ACTION instead of 65535. Knockdown does not clear action immediately.

Also, the duration check and the spell id check will give false negatives on custom-made knockdowns or knockdowns associated to spells. That would only work for the feat knockdowns.

cool. I changed the function name and added a note

Hi All,

Thanks everyone! (I have just caught up after the last Lord’s Day.)

This is good to know, so this should be a good workaround. (I was looking too closely at the problem, and this may be a solution along the lines of “not seeing the wood for the trees scenario”.)

The call checks that are made are “continuous” from an active XML (update), so any delay would/should not come into it - hopefully.

Sounds good! I’ll try that piece of code - although I may simply also only need/use the GetCommandable() option, as I am undecided whether to indicate every “compromised” option (by exact description), or simply stick with just “compromised” irrespective of the condition causing the compromise.

So, as GetIsCommandable is a good catch-all for any other conditions I may be forgetting, it may be the simplest answer.

Many Thanks to every one who helped!
Lance.

UPDATE: Testing has confirmed that the catch-all GetIsCommandable is a good workaround as it highlights the issue to the player as to why they cannot also “possess” the PC to issue a command when the game is paused. Great help! :slight_smile: (i.e. A PC cannot be “possessed” when in the knockdown state.)

2 Likes