Jump to content

Photo

enemy nearby fix question


  • Please log in to reply
5 replies to this topic

#1
greyday01

greyday01

    Fan

  • Premium Member
  • 291 posts

If you want all npc's that are moved to a certain spot no longer cause that "You cannot sleep with an enemy nearby" message how would you go about it?

Add them to the players faction? Use stopcombat? Change some other parameter? Use a Calm spell?

I just need it in a small area so I though to use an OnEnter Event to trigger it since they can't leave that spot.



#2
maxarturo

maxarturo

    Faithful poster

  • Members
  • PipPipPipPip
  • 1,727 posts
That depends on what you are trying to do and on the enemy itself, but in general you will need to:
- First add them to the 'Player's Faction'
- Second 'StopCombat()'
- Third 'EvaluatePackage()'
 
But as i said, this depends on the enemy, for example:
- In the mod i recently released some of the enemies have either a "Hunting Player and Allies Package" that neither one of the above will ever work. The npc will always 'Hunt' the player.
- The enemy is been scripted to "Always" be in a state of combat with the player and his allies.
 
So, the approach above will never work on this npcs no matter what you do, the only way that those npcs can be affected is, if they are directly modify in CK.
 
So, this approach is not 100% reliable since i'm sure that i'm not the only one that does this.
 
If is intended to work only in your mod with your npcs, then it can be 100% reliable.
* But if this is the case, then a simpler way of doing this is to just remove from those npcs their hostile towards the player faction.
 
I hope it helps.


#3
greyday01

greyday01

    Fan

  • Premium Member
  • 291 posts

It will only be needed for vanilla creatures as those are the only ones in my formlist.

I tried RemoveFromAllFactions followed by StopCombat and this did not work.

I'll try adding them to the Players faction and then evaluate package as you suggested.

Just a question. Would a calm spell work on your creatures?



#4
maxarturo

maxarturo

    Faithful poster

  • Members
  • PipPipPipPip
  • 1,727 posts
The problem with "RemoveFromAllFactions" is that it will remove the vanilla actor form its faction on "TriggerEnter()" (if you are using a trigger box), but how will you or the trigger's script know in which faction they were to add it again "OnTriggerLeave()", this will lead to the issue that every npc that had at least enter the trigger once will remain without faction for the rest of the game, since even if you kill the npc and in the case of animals, they are all set to "Respawn", they will retain the call by your script's function.
* I'm not 100% sure about the last, this needs testing.
 
So, the best way to handle this is by "Adding" and then "Removing" a faction even if it is a vanilla faction or your custom made faction.
 
 
"Would a calm spell work on your creatures?"
NO !, they are set up in such a way so no other mod (spell mod - immersion mod - console command (some CC) - cheat mod... etc) can affect them, and make the fight challenging to any player even if he is using the most powerfull spell mods.
* It's not been done on all npcs just on the quest story bosses, there is a reason why, that you can only understan if you play it.
 
I hope it helps.

Edited by maxarturo, 03 July 2020 - 07:42 PM.


#5
greyday01

greyday01

    Fan

  • Premium Member
  • 291 posts

My creatures were just spawned in a cage from a formlist of vanilla encounter creatures and then deleted when a new one was spawned in their place. The references spawned didn't need any factions really since they were stuck in a cage.

It didn't work anyway. I tried stopcombat, modav aggression, removing factions and adding Playerfaction, an OnTriggerEnter script that added a calm spell. Didn't work. The only thing that did work was duplicating the encCreatures and editing their aggression and factions, ect to turn them into bunny rabbits and using those in my formlist. I had hoped to find a better way but after playing around all day I'm not getting anywhere.

 

Thanks for your advice but I think I'm stuck with the quick and dirty fix.



#6
NexusComa2

NexusComa2

    Newbie

  • Members
  • Pip
  • 18 posts

If they are in cages like you said and never used for more than that. Add them to the player's faction, remove them from any other faction then change aggression. Don't think you need the rabbit thing. Not so much of a "dirty fix" as the way to do it.


Edited by NexusComa2, 08 July 2020 - 02:14 AM.





Page loaded in: 0.937 seconds