Jump to content

Trying to make NPC always detect player


Recommended Posts

So I'm working on a scripted boss fight. The boss encounter is in a large circular room, and the boss spawns on a platform in the middle. I have it so that the boss stays put at the spawn location by making him overburdened, because I just want him to stand still and cast magic at the player when the player is far away.

 

When the player steps onto the platform, the boss becomes unburdened and starts melee combat, and if the player runs out of the ring then the boss will drop combat, run to the center, and then start combat again and stay in place and hopefully start casting spells.

 

The problem I'm having is that if I'm far away enough, and sneaking, then I can just stay in stealth and keep getting sneak attacks with arrows while the boss doesn't do anything, and even though he should see me, he is not casting his spells at me... The detection icon in the middle of the screen is even lit up, but he still won't attack me half of the time if I am far away enough, even though I started combat with player via script.

 

Also with console commands, I was testing what the detection level was after starting combat with getDetected Player and it usually returned -50

 

UPDATE: With more testing I've figured out that the problem is not that he isn't detecting me, its that there seems to be a set range at which he will cast a spell at me... He stands in place, and he always starts casting at the same distance.. I tried changing this in his combat style, but nothing worked.

Edited by kthonia
Link to comment
Share on other sites

So I'm working on a scripted boss fight. The boss encounter is in a large circular room, and the boss spawns on a platform in the middle. I have it so that the boss stays put at the spawn location by making him overburdened, because I just want him to stand still and cast magic at the player when the player is far away.

 

When the player steps onto the platform, the boss becomes unburdened and starts melee combat, and if the player runs out of the ring then the boss will drop combat, run to the center, and then start combat again and stay in place and hopefully start casting spells.

 

The problem I'm having is that if I'm far away enough, and sneaking, then I can just stay in stealth and keep getting sneak attacks with arrows while the boss doesn't do anything, and even though he should see me, he is not casting his spells at me... The detection icon in the middle of the screen is even lit up, but he still won't attack me half of the time if I am far away enough, even though I started combat with player via script.

 

Also with console commands, I was testing what the detection level was after starting combat with getDetected Player and it usually returned -50

You can probably do this by adding the player a capacity with the light effect through a scripted event.

Edited by Oblivionaddicted
Link to comment
Share on other sites

With more testing I've figured out that the problem is not that he isn't detecting me, its that there seems to be a set range at which he will cast a spell at me... He stands in place, and he always starts casting at the same distance.. I tried changing this in his combat style, but nothing worked.

 

So one work around I've found is to make an ai procedure for the boss to keep casting his spell when he is in his area, but I can't make the player the target in the "cast" type of ai procedure, so I have to get around that too by making him cast a "self" Script Effect spell, and in the script, on ScriptEffectStart it moves an activator above him and the activator ref casts the spell I want the boss to cast at the player.

 

So now I'm just trying to get him to move back to the middle of the room (after the player crosses the start melee combat boundary) before the ai procedure to cast runs.. Which so far I've been unsuccessful :<

Link to comment
Share on other sites

  • 2 months later...

Have you tried to use a scripted casting function onto your boss?

 

 

<YourBoss>.Cast <YourSpell> Player

 

You may try it like this:

 

 

scn YourBossScript
 
float fCastingTime
 
Begin GameMode

  If GetDistance Player > 1000

    if fCastingTime > 5
      <YourBoss>.Cast <YourSpell> Player
      Let fCastingTime := 0
    else
      Let fCastingTime += GetSecondsPassed
    endif

  endif
End

 

So now your boss should cast on the player every 5 seconds, as long as the player is further away than 1000 units.

The GameMode should only run if you are nearby the boss, so I hope you are using it in an interior.

As otherwise, it may try to cast spells onto your char even if he / she is far far away, as the GameMode of world space objects kicks in pretty early which could lead to bad results in that case.

 

But if you use your boss only in a closed interior, it should work fine. :)

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...