Hello Everyone,
I am trying to make my own mod for more immersive NPCs. So far I am able to spawn wolves and bandits that attack the player and take care of the garbage without crashes or savegame bloating, but I plan more...
I have some trouble making the spawned soldiers (Imperials and Stormcloaks) do start patrolling instead of just standing around. Plan is to create a LinkedReference at a random position and make them patrol to that point and back to their spawningpoint (ping-pong-patrol) or use Vanilla PatrolIdleMarkers so that spawned soldiers first move fromm their spawningpoint to a first vanilla PatrolIdleMarker, then ping-pong-patrol between that first marker and a second vanilla PAtrolIdleMarker.
I also have trouble with my spawned groups of bandits, which I want to remain at the spawned point and not attack player until they discover the player. So far I am able to walk up to them and actually kill them before they attack me. When I have hit one of them, the others starts to fight, but that is a bit too late. I would like them to attack the player as soon as they can see the player.
Spawntimer is done with RegisterForSingleUpdate(60.0), so every minute the script checks what can be cleaned up (far enough from the player) and respawned.
Since I am doing all in Papyrus and NOT using Creation Kit more than to set up quest and fill the properties, I have not found any example that provides the answers I need. I would be very happy if someone could type the lines of papyrus code needed for this.
From my script, only the rows for one of the imperial guards, taken out of the full script:
ScriptName DarlanioImmersiveNPCs extends Quest
Actor property PlayerRef Auto
ActorBase property LvlGuardImperial auto
...
Float Direction = Utility.RandomFloat() * 360
MyActor = PlayerRef.PlaceActorAtMe(LvlBanditAmbushMeleeEvenTonedM, 2)
MyActor.MoveTo(PlayerRef, Math.Sin(Direction) * SpawnDistance, Math.Cos(Direction) * SpawnDistance, 0.0)
...
Maybe I need something similar to what I use for the wolves and solo bandits:
MyActor.StartCombat(PlayerRef)
Maybe something like:
MyActor.StartPatrol(SomeLinkedReference) ?
Please write answer in form of Papyrus lines and explanation - I do not want to use Creation Kit more than necessary and I do not want to make specific markers in the Tamriel World...