Jump to content

Help with Stalker NPCs (pathfinding)


Recommended Posts

Posted

I have various little quest-ideas (or let's say "curses") that should make my dragonborns live a little more interesting :)

 

As an addition to the first companion/werwolf quest, there should be some complications, such as the PC having problems focusing and NPCs (Werewolves and/or canines) being unduly attracted to her. It works quite OK, so far (a high arousal causes escalating "Sexy Idles", the character begins to crawl and run on all fours if her arousal get's to high) and with my first Cloak-Spell the targeted NPCs get hornier so it's just a matter of time, before one of my installed mods fires up a sex scene.

 

On top of this I'd like to make the NPCs stalk the PC, at least as long as we stay in the "current location" (I don't want to kite dozens of NPCs or so over the half continent).  However, that's a troblem for tomorrow, today even the "stalking" part doesn't work. I tried to use "KeepOffsetFromActor" but that froze the NPCs in place:

Scriptname whgBitchInHeatScentTrailScript extends activemagiceffect  
{is attached by Cloakspell}

Import MiscUtil
whoreGasmMainQuest Property whg Auto;
Spell Property whgBitchInHeatScentTrailSpell  Auto  
Actor Property PlayerRef Auto
Faction property SLAFacAroused Auto
Actor Property stalker Auto
Location Property NPCStartLocation Auto

Event OnEffectStart(Actor akTarget, Actor akCaster)
    stalker=akTarget;
    stalker.KeepOffsetFromActor(PlayerRef,0,0,20);afCatchUpRadius and  afFollowRadius used with defaults
    ;NPCStartLocation=stalker.GetCurrentLocation();
    RegisterForSingleUpdate(1.0);    
EndEvent

Event OnUpdate()
    if playerRef.GetFactionRank(SLAFacAroused)<50; || NPCStartLocation != PlayerRef.GetCurrentLocation()
       ;Stop Stalking if no longer aroused or player has left the building
       Debug.Notification((stalker.GetBaseObject().GetName())+" lost interest.")       
       stalker.removespell(whgBitchInHeatScentTrailSpell)
    Else
       PrintConsole((stalker.GetBaseObject().GetName())+", still stalking!")
       whg.manipulteArousal(stalker,5.0);
       RegisterForSingleUpdate(5.0);
    EndIf
    
EndEvent

Event OnEffectFinish(Actor akTarget, Actor akCaster)
    stalker.ClearKeepOffsetFromActor()
    ;stalker.pathToReference(NPCStartLocation, 0.5)
EndEvent

Most likely using GetCurrentLocation wouldn't work anyways but it's not in use currently, either. Anybody got an idea, what better to use instead of "KeepOffsetFromActor"?

Posted

You need to use a package to do that.

The direct API call does very little, because it will be overridden immediately by what the current AI package of the actor tells the NPC to do.

Posted

I advise to create your own stalker package, and use the call ActorUtil.addPackageoverride(stalker, yourStalkerPackage) to avoid to lose it.

Be sure to remove it when the magic effect is gone.

Posted

I wouldn't have found addPackageoverride in the CreationKit-Wiki and kinda skipped it in your awesome Papyrus-Guide,  d' :o h!

 

Thanks for your advice.

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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