Jump to content

How to keep an NPC out of a certain area. An off limits area.


oc3

Recommended Posts

I want to have an area that is protected by garlic to keep vampires out. Is it possible? How can I make it where they will not go there even if they are pursuing me? It is in a cave, so I can't take advantage of doors.

 

I searched the forums and came up with nothing. Thanks for the help.

Link to comment
Share on other sites

I thought of something but let me ask you first,is there a chance that vampires could appear in the cave while you're away? (either by spawning or any other way)

Other than that,we know the chance that they might get in by chasing you. What other possibilities are there? Just trying to tackle every possible problem beforehand.

Link to comment
Share on other sites

you can surround the area you want with collision boxes -Dungeons\Misc\CollisionBox01.NIF- ,and enable disable them when certain conditions are met (perhaps with a trigger zone)

 

another one is to put a script (with search loop) in an object like a special garlic or a trigger zone

sth like

 

ScriptName AAAVampireHaterGarlicS

ref HaterGarlic
ref AllergicVampire

Begin Gamemode

set HaterGarlic to getself ;this makes the object containing the script to be the HaterGarlic

set AllergicVampire to GetFirstRef 35 1 ;35 is npc the


while (AllergicVampire)
if AllergicVampire getisRace.Vampirerace == 1
AllergicVampire.SetActorValue confidence 0;this will propably make them flle
AllergicVampire.addsript package XXXXXX ;or make a package to lead them to a point
endif
set AllergicVampire to GetNextRef ;continue to next npc

;AllergicVampire.evp ;if you choose to add a package
loop


 

 

in addittion you may put some conditions in the script like

if player.isincombat

if player.getdistance HaterGarlic < 400 or

if HaterGarlic.getdistance AllergicVampire < 400 or both

This script propably wont run is only to demonstrate the idea

Edited by kastano
Link to comment
Share on other sites

@Legotrash,

The cave in question has several vampires that will spawn there. They will already be there when the player arrives. I have a small area of the cave that is meant to be a safe area where you can retreat to so that the vamps will not follow you there.

Link to comment
Share on other sites

@Kastano,

 

The collision box idea might work to some extent, but would just be an invisible barrier. The vampires would just look like they are running in place when they hit it. I would like them to just halt and stand there, still able to cast spells or other ranged attacks.

 

If their confidence was changed to 0 and they fled, is it possible to have their confidence return to normal in a set amount of time? If so, that may be OK.

Thanks

Link to comment
Share on other sites

In the safe area's cell? Sorry for the questions but that might help to avoid possible pitfalls. :D

Kastano posted first his idea so if you want,go with that. I don't know how good mine is. I can tell you that it'd definitely need some tweaks/corrections. There's no way to avoid mistakes,especially without working on it. :P

Link to comment
Share on other sites

In the safe area's cell? Sorry for the questions but that might help to avoid possible pitfalls. :D

Kastano posted first his idea so if you want,go with that. I don't know how good mine is. I can tell you that it'd definitely need some tweaks/corrections. There's no way to avoid mistakes,especially without working on it. :tongue:

If I understand things correctly they are in the same cell. The cave is all one interior location. Any ideas?

Link to comment
Share on other sites

This is something I haven't tried personally but I think it'll work: Make your main script disable that specific "leveledcreature" static(or statics if there are more) that spawns the vampires inside the cave. If you'll do that then also make your main script,upon saving,enable them (to keep the save files clean). When it's back in gamemode and can go back on having them disabled.

 

Can't post a script right now,it's a bit late and I'm tired. If you'll need further help then post here and we'll take it from there.

Link to comment
Share on other sites

there are two scripts

one in an object (activator)

 

ScriptName AAAVampireHaterGarlicS

short activated
ref HaterGarlic
ref RVampire


Begin Gamemode
if activated == 0
if player.GetInCell BarrenCave == 1
set activated to 1

set HaterGarlic to getself ;this makes the object containing the script to be the HaterGarlic
elseif player.GetInCell BarrenCave != 1
set activated to 0

endif
endif



if activated == 1

if (HaterGarlic.getdistance player < 1200 && activated == 1)
set RVampire to GetFirstRef 35 1 ;35 is npc the


while (RVampire)
if (RVampire.GetInFaction VampireFaction && RVampire.GetItemCount AAAHGarliceffectToken == 0 && RVampire.getdistance HaterGarlic < 1000 )


RVampire.additem AAAHGarliceffectToken 1

endif
set RVampire to GetNextRef ;continue to next npc


loop
endif
endif
end

 

and one in a token which is added to vampire with a timer

 

ScriptName AAAGarlEff


ref meownerP
float timer
short confVar




begin onadd
set timer to ( timer + GetSecondsPassed )
set meownerP to GetContainer
set confVar to meownerP.getAv confidence
meownerP.RemoveScriptPackage AAAAGVAMPflee
meownerP.AddScriptPackage AAAAGVAMPflee

meownerP.SetActorValue confidence 0
meownerP.evp
end


begin gamemode




if (timer > 10 || meownerP.getdistance player > 1500 )


meownerP.RemoveScriptPackage AAAAGVAMPflee
meownerP.SetActorValue confidence confVar

meownerP.evp

removeme

endif

end

 

 

and a package

 

These need to be developed more

Link to comment
Share on other sites

  • Recently Browsing   0 members

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