Aller au contenu

Photo

kick'em when they're down


  • Veuillez vous connecter pour répondre
27 réponses à ce sujet

#1
erin3372

erin3372
  • Members
  • 61 messages
is the a script that makes npc's stop hitting characters that have fallin?

#2
Jezla

Jezla
  • Members
  • 173 messages

If you're refering to being victimized by the knockdown feat, the easy answer is to find away to resist the knockdown, as that is how it's supposed to work.  A high strength will help resist it.  If you have a character with low strength, try to avoid melee.



#3
Tchos

Tchos
  • Members
  • 5 054 messages

If it's enemies continuing to hit a character that's down and dying, but not dead, as in the SoZ death system, that's annoying to me, too, but it seems to happen only randomly.  I'm not sure if it's intended behaviour, but I can't fault the enemies for wanting to make sure my party member can't get back into the fight with a simple healing spell or healing kit instead of a Raise Dead spell.  Still, if I knew of a ready-made way to stop that from happening, I'd tell it here, but unfortunately I don't.  A script could be made to do that, though.



#4
kevL

kevL
  • Members
  • 4 061 messages

There are event hooks for PCs, Companions, etc. that could be used, but unfortunately the important ones, for something like this, become disabled as soon as Player controls that character.

i came to this conclusion when trying to find a way to stop my PC from auto-retaliating when attacked, and within melee range.

:\

 

 

That said, from the NPC-perspective, the AI could be tweaked to stop NPCs from attacking opponents with less than 1 hp.

( not sure if there's a 'getIsKnockedDown' function tho, which would sorta be needed to check for Knockdown )


Modifié par kevL, 19 août 2014 - 08:51 .


#5
Arkalezth

Arkalezth
  • Members
  • 3 189 messages

I'm not sure if it's intended behaviour, but I can't fault the enemies for wanting to make sure my party member can't get back into the fight with a simple healing spell or healing kit instead of a Raise Dead spell.

 

I actually find that a bit silly. I mean, if there's an unconscious guy, or at least not in shape to fight anytime soon, and I have another one hacking at me meanwhile, I would go for the latter.

 

Now, if it's the knockdown feat, I would finish him off.


  • erin3372 aime ceci

#6
Tchos

Tchos
  • Members
  • 5 054 messages

I understand that there are tactical arguments against it, and in most cases I tend to focus on active combatants when for instance I've used a Sleep spell to incapacitate some others, but I think it's also a valid choice in a world where a quick healing spell available in abundance from any cleric (other classes too, but clerics have spontaneous conversion) can put an unconscious person in that state right back into combat.


  • rjshae aime ceci

#7
erin3372

erin3372
  • Members
  • 61 messages

i was speaking of dying. knockdown and such is fair game. this issue is more annoying while playing BGR where the whole game ends when the pc dies. i dont mind that to much but it does suck when the pc goes below zero and your exhausting all your resources trying to keep him/her above -10 while the enemy continues to pummel him/her. 



#8
kevL

kevL
  • Members
  • 4 061 messages

I've been sorta wanting to look into that, honestly. Find where the NPC chooses its target, and if less than 1hp choose the next one ...

there's a lot of code/scripts to muck through tho. Right now i've got a Sectopod to deal with,



#9
Tchos

Tchos
  • Members
  • 5 054 messages

Ah, when it's the main PC, that's a bit of a special case, since many scripts that people use in conversations to turn a neutral NPC into a hostile NPC automatically target the main PC rather than the PC speaker, even if the main PC was way in the back, thanks to the focus on the main PC in the OC and MotB, with all the force-swapping whenever you step on a speak trigger, etc.  Even after SoZ, though, many user-made modules still use those scripts that focus everything on the main PC.


  • erin3372 aime ceci

#10
Dann-J

Dann-J
  • Members
  • 3 161 messages

I certainly wish the companion AI would ignore trolls once they've gone down. Having your entire party continue to pound away at a collapsed troll, while live trolls attack them from behind, doesn't make much sense. A lore check that allows a companion to automatically use fire or acid on them (if available) would be nifty as well.



#11
Arkalezth

Arkalezth
  • Members
  • 3 189 messages

Mechanically, though, I prefer it that way. I don't want the troll regenerating while I rummage through my inventory until I find something with fire/acid.

 

Also, thread theme:

 


  • erin3372 et GCoyote aiment ceci

#12
kevL

kevL
  • Members
  • 4 061 messages
i Found a function in 'x0_inc_generic', called from DetermineCombatRound(), called bkAcquireTarget()

now i know this is all complicated & no one really wants to get into it (except me..)

Very basically, the combatAI can either have oIntruder passed into DCR, or it can use bkAcquireTarget(). The various event hooks for an NPC pass in oIntruder sometimes, and in any case the stock AI usually just keeps on clobbering the same target from round to round.

until its dead or disappears ...

here are the ValidTargets, as acquired by bkAcquireTarget()
 
int ValidTarget(object oTarget)
{
    if (GetIsObjectValid(oTarget))
        if (oTarget != OBJECT_SELF)
            if (GetIsEnemy(oTarget))
                if (!GetFactionEqual(OBJECT_SELF, oTarget) || GetLocalInt(OBJECT_SELF, EVENFLW_AI_CONFUSED))
                    if (!GetAssociateState(NW_ASC_MODE_DYING, oTarget))
                        //if (!GetPlotFlag(oTarget))
                            if (GetAssociateType(oTarget) != ASSOCIATE_TYPE_FAMILIAR)
                                return TRUE;

    return FALSE;
}
(because i'm sure someone's beard needs scratching ;) HOWEVER, none of that runs if oIntruder is passed in from one of the NPC's event scripts : oIntruder gets set as a local object on the NPC, who then gets clobbered without checking "if (!GetAssociateState(NW_ASC_MODE_DYING, oTarget))" -- yet that seems to (a)deal only with associates, and (b)might be a throwback to NwN1, partly. But there's no rule that says either (a) or ( B) has to be true; in fact, a fair bit of code i'm looking at suggests (a) is universal, and applies to more than only associates. Back to DCR, of more interest is this:
 
// If for some reason my target is dead, then leave
// the poor guy alone. Jeez. What kind of monster am I?
if (GetIsDead(oIntruder))
{
    return;
}
I figure a reasonable start would be to change the condition to

if (GetIsDead(oIntruder, TRUE))

which means, literally, ignoreDying. But then the game would break if no other enemy is perceived. Because PC would just lay there with an orc standing over them, grunting "Pick up the sword."

So I'd want something like,
 
if (GetIsDead(oIntruder, TRUE)
    && GetIsObjectValid(GetNearestPerceivedEnemy()))
{
    oIntruder = GetNearestPerceivedEnemy();
}
else if (GetIsDead(oIntruder))
{
    return; // this prob stops the NPC's combatAI.
}
And then a whackload of scripts need to be recompiled, and debugged. So, to answer your question, Erin

no.

#13
kevL

kevL
  • Members
  • 4 061 messages

[edit] bargh
DCR then goes on to ignore oIntruder and uses GetNearestSeenEnemy() ...



#14
Tchos

Tchos
  • Members
  • 5 054 messages

Good use of a Bill Hicks clip.  What about a script you could run from the console to force the enemy to pick a different target?  Hopefully once the enemy had moved to attack the new target, it wouldn't be as likely to target the fallen one again.  Just to be used for isolated cases, when the enemy is really annoying you.



#15
kevL

kevL
  • Members
  • 4 061 messages

since the ai seems to always choose the closest target, I'd first try to get a different character to take aggro.

A script would be pretty simple too, but less immersive ofc.

#include "nw_i0_generic"

void main()
{
    object oHostile = GetPlayerCurrentTarget();

    AssignCommand(oHostile, ClearAllActions(TRUE));
    AssignCommand(oHostile, DetermineCombatRound(OBJECT_SELF));
}

or somethin like that.

 

Btw, I'm looking at TonyK's scripts atm: they are very advanced over the stock NwN1-style scripts. I suggest to Erin, put in TonyK's AI if you don't have it



#16
erin3372

erin3372
  • Members
  • 61 messages

k... i'm way outa my depth so this may be an ignorant statement/question. could a heartbeat function be used to have npc's ignore a dying character for a few second, after wards that dying character would again be fair game. my thinking is this. once the dying character has been ignored the npc would then focus on a new target (logically that would be a character that is currently causing the npc the most pain. but that is beyond the scope of this post) and would continue to focus on this new character even after the script has run it's course. or in an extreme sense something attune to a sanctuary spell that run on character death that lasts just long enough for the npc to target a new victim.

 

i am currently using tony's a.i. i couldn't play with out it. maybe an update to it is in order though. as it's a couple years old. thank you for looking into this.



#17
kevL

kevL
  • Members
  • 4 061 messages


k... i'm way outa my depth so this may be an ignorant statement/question. could a heartbeat function be used to have npc's ignore a dying character for a few second, after wards that dying character would again be fair game.

The heartbeat script fires on 6 sec. intervals. I don't think that's fast enough to intercept multiple attacks per round. There are about 8 event scripts that all try to keep the NPC attacking: onHeartbeat, onPerception, onDamaged, onSpellCastAt, onEndCombatRound, etc. And I don't believe they all line up nice, to say this one goes first, this next ... so as far as events are concerned, that aspect of scripting is just random afaict.

ie. it would have to be done on a deeper level.

my thinking is this. once the dying character has been ignored the npc would then focus on a new target (logically that would be a character that is currently causing the npc the most pain.

some games work like that, but i'm pretty sure that NwN2 AI doesn't. It just goes for the closest character that has a bad rep. In fact i 'often' tag off aggro by moving another companion closer to the hostile -- but I can never tell when it's really going to take effect, because of those event scripts and the pseudo-random timing ....

What I think you might need is a custom item that does what you want; say you can pause the game, target the hostile with the item, and it would clear the NPC's aggro-state -- essentially just make it go duh for a half second. Then let it acquire the closest target again,

but that is beyond the scope of this post) and would continue to focus on this new character even after the script has run it's course. or in an extreme sense something attune to a sanctuary spell that run on character death that lasts just long enough for the npc to target a new victim.

an item with a Sanctuary effect may work, and prolly wouldn't be too hard to rig in the Toolset.

i am currently using tony's a.i. i couldn't play with out it. maybe an update to it is in order though. as it's a couple years old. thank you for looking into this.

np. We've hashed over tackling the stock AI before (including Tony's) but no one really wants to take a year off life to understand it first...
  • erin3372 aime ceci

#18
Dann-J

Dann-J
  • Members
  • 3 161 messages

Scripting dying party members so that they get a temporary ethereal effect (without the visual effects) should stop enemies from continuing to attack them. Ethereal is generally better than sanctuary as the latter allows for a will save to ignore, whereas the former doesn't.



#19
erin3372

erin3372
  • Members
  • 61 messages

thank you KevL... mostly for not making me sound like a total noob , but also for the clear explanations. 



#20
kevL

kevL
  • Members
  • 4 061 messages

ok.. Dj just gave me another idea tho. it's not a good idea but, the *module* events have a script for onPlayerDying.

That seems like where your idea should be implemented seamlessly. Unfortunately you'd have to change it for every module played.


so perhaps try to stick a cast of, per Dj, Etherealness or Ethereal Jaunt onto an item with unlimited casts, console it in and uhh you know, try not to abuse it.


merry x-mas - it seems to work, my OgreMagi sure switched off its target quickly. if you want it tweaked etc let me know,



#21
Dann-J

Dann-J
  • Members
  • 3 161 messages

I had a similar problem with the RWS ankheg model when it disappeared below ground during a fight. Even though I was script-hiding it for a while, any party members that were in melee combat with it before it burrowed down continued to pound away, even though it was invisible and undamageable. Adding an ethereal effect to the ankheg once it had played its disappear animation stopped any melee combat in its tracks. Then its heartbeat script took over, searching for a noisy party member (listen vs move silently) to pop up behind of and continue the fight.



#22
kevL

kevL
  • Members
  • 4 061 messages

<g> in the package i put together there, the effect is supposed to go on a partymember - just a note.

 

I didn't try it on a 'dying' member, tho, so I'm unsure what's gonna happen ...



#23
Kaldor Silverwand

Kaldor Silverwand
  • Members
  • 1 592 messages

Or you could just install my BGR Enhancements which among other things prevents the game from ending when the main PC is killed.

 

I don't have a version compatible with BGR 1.4 released yet, but there are versions for BGR 1.2 and BGR 1.3 and I will release one for v1.4.

 

Regards



#24
erin3372

erin3372
  • Members
  • 61 messages

i don't mind that the game ends when the main pc dies, it's watching a fallen character continued to get pummeled that just sends shivers up my spine. there is just something inherently wrong about that from both a practical standpoint (imho) and a moral one. course many of my foes are evil in nature so i could make it ok in my mind and excuse as psychotic evil blood lust. although it still makes more sense to me to attack whoever is currently causing you pain as opposed to the person down on the ground who is not causing you pain. Tchos does make a good opposing argument to this but id still be apt to dealing with whomever is currently hurting me... thought: can a script be written that tells an npc to focus on a combatant that is currently inflicting injury/pain/damage vs a combatant who is incapacitated?



#25
Dann-J

Dann-J
  • Members
  • 3 161 messages

What we really need is an AI system that distinguishes between varying levels of intelligence in enemies. You wouldn't expect a pack of enraged worgs to employ the same strategies as a squad of well trained soldiers. The former are more likely to continue to savage a fallen enemy, while the latter would have more sense than that.

 

Most melee AI in the current system seems to be fairly 'dog-brained' - a term which is actually an insult to the sort of highly-structured coorperative hunting strategies canids employ ('bear-brained' would seem to be a better term).