NPC won't attack invisible and sneaking player

Post » Wed Jun 20, 2012 3:58 pm

I need to get a set of NPCs to attack any hostile opponents, including other NPCs and the player. This is simple enough to achieve, but I need the NPC to attack the opponents even if they are sneaking or invisible.

I've tried multiple ways - tried making scripts using StartCombat(), using a cloak spell that dispels invisibility - each with its own downsides (or complete and utter failures).

What would be the best way for me to go about this?

These are not unique NPCs, I just want to adapt their combat.
User avatar
Naomi Lastname
 
Posts: 3390
Joined: Mon Sep 25, 2006 9:21 am

Post » Wed Jun 20, 2012 1:14 pm

If the mob can't see the player it won't attack. Some mobs have a kind of resistance to sneaking however...maybe a closer look at the Falmer?
User avatar
Eilidh Brian
 
Posts: 3504
Joined: Mon Jun 19, 2006 10:45 am

Post » Thu Jun 21, 2012 2:44 am

Well I read the creation kit's section on Detection...sadly there's no way to alter that value directly, so it's a matter of tweaking all the variables that add up to detection. I'm assuming that's what you meant by "see"?

As far as I know, the Falmer just have blindness...don't they? (So no visual input toward detection).

It seems like the Falmer have blindness and fortify sneak by 30 if in combat.
User avatar
Elizabeth Davis
 
Posts: 3406
Joined: Sat Aug 18, 2007 10:30 am

Post » Wed Jun 20, 2012 11:51 pm

Well, bumping the enemies sneak skill up to 100 would make it easier for them to detect a sneaking player.
As for invisibility....

The cloak spell that dispels sounds interesting.
I wonder....
What if you give an NPC a 'detect life' spell. He probably won't cast it on his own, but if you made him cast it in an 'onhit' event like:
Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, \  bool abBashAttack, bool abHitBlocked)  Debug.Trace("We were hit by " + akAggressor)  EquipSpell(DetectLife,2)  DoCombatSpellApply(DetectLife,self)EndEvent

Then invisibility+sneak up to the enemy, attack, and see if after casting the detect life spell he comes after the player even when they are invisible
User avatar
Shiarra Curtis
 
Posts: 3393
Joined: Thu Jan 04, 2007 3:22 pm

Post » Wed Jun 20, 2012 12:36 pm

That would be pretty sweet, and I think that's the approach I'm going to take. Wouldn't want a constant detect life effect. Could add a check for "IsAlerted == 1".

But how exactly would the detect life spell work? It's sadly visual only - and a computer won't be able to use the detect life shaders to attack someone. They'll have to detect them first.

Dragons (some of them anyway) already have 100 sneak - tried sneaking around them while invisible and they couldn't find me.
User avatar
k a t e
 
Posts: 3378
Joined: Fri Jan 19, 2007 9:00 am

Post » Wed Jun 20, 2012 9:48 pm

i honestly wasn't sure if 'detect life' was just a visual effect or if AI could use it, was hoping you would test that out and let me know ;)

Seriously though, how did that 'dispel invisibility' cloak spell work? and what what where the drawbacks? That sounds like the most legit way to do this to me, without resorting to updating quests with aliases.
User avatar
ZzZz
 
Posts: 3396
Joined: Sat Jul 08, 2006 9:56 pm

Post » Thu Jun 21, 2012 1:45 am

another idea is the function RegisterForLOS()
http://www.creationkit.com/RegisterForLOS_-_Form

If called on an actor, it uses the detections system. But i think if you use an objectreference it will just do a raycast (haven't tested this so it's just a guess)
That means an objectreference might be able to see you where an actor would not. You could then use the objectreference to dispel the invisibility effect
User avatar
MISS KEEP UR
 
Posts: 3384
Joined: Sat Aug 26, 2006 6:26 am


Return to V - Skyrim