Jump to content

NPCs not moving on cold load boot


Recommended Posts

5 hours ago, SKKmods said:

Teleporting to target == no clear path.

Its 99% of the reason Fallout 4 attackers seem to spawn inside settlements (they dont, just teleport to package destination inside the players finely constructed path blocking walls).

Try to throw Debug.Traces on the actors in the error condition with PathToReference() to see if the return is true or not.


; Note: this method doesn't return until the goal is reached or pathing
; failed or was interrupted (by another request for instance)
; Return values (see above):
; 0 - Success
; 1 - Failure
; 2 - Stopped
; 3 - Cleared
int Function PathToReference(ObjectReference aTarget, float afNormalizedSpeed, float afNormalizedRotationSpeed, float afTargetRadius=-1.0, bool abHardRadius=false) native
 

Note: function was buggy as hell in Fallout4, dunno if it actually works on Starfield, so let us know !

I'm only getting 1s out of it.

One thing though. If I create a new actor, they just stand there doing nothing. Just like my controlled test bots. So it seems that indeed it is a bug from when the game is loaded. They won't sandbox.

 

Spoiler

Screenshot2024-06-192130262.thumb.jpg.b18267d3051959697f702e048ae36b9f.jpg

 

Link to comment
Share on other sites

OK, so here's the new information I could gather so far about this.

If I create new actors in an outpost but do not assign them to a RefCollectionAlias, they will sandbox normally. If I do add them, thus assigning possible packages, and I save and do a cold load, they become non responsive. Event if I remove them from the RefColAlias they will not sandbox anymore.

It seems that something I am doing is making them become stuck. So here is what my script does:

1. It creates an XMarker ref and Links it to the Actor with a keyword that is used by the 3 packages I have
2. I move the marker to a given location and set the conditional needed to enable the package to true
3. Once the actor is close enough to the marker, I get a callback and either play an idle animation, or, change the condition so it changes the active package to an attack package.
4. After a given time expires, it goes back to step 2.

It works without issues for hours if I just let it run without loading. If I save and load, without closing the game, they resume the loop properly.

If I do the cold boot, they are stuck until I fast travel away and back.

That's basically what it does.

Link to comment
Share on other sites

Here are a few tips for debugging:

1) Make sure the your custom AI Package is on top of their AI stack

Scriptname GlobalFunctions

; CGF "GlobalFunctions.XXXXX" RefID

Function LogCurrentAIPackage(ObjectReference Ref) Global
	Debug.OpenUserLog("GlobalFunctions")
	Debug.TraceUser("GlobalFunctions", "LogCurrentAIPackage: " + Utility.IntToHex(Ref.GetFormID()) + " --> Current AI Package: " + (Ref as Actor).GetCurrentPackage())
EndFunction

 

2) Starfield's vanilla Papyrus has "condition runner" which can be quite handy. You can check whether the NPC is in their Package Location with something like

Function GetWithinPackageLocation(Actor theActor) Global
	ConditionForm Condition = Game.GetFormFromFile(0x01234567, "Something.esm") as ConditionForm		; this condition should have one condition function: GetWithinPackageLocation, Run on: Subject
	If !Condition
		Debug.MessageBox("error: Condition cannot be found")
		Return None
	EndIf
	If Condition.IsTrue(theActor) == true
		Debug.MessageBox(Utility.IntToHex(theActor.GetFormID()) + " + is within their package location.")
	Else
		Debug.MessageBox(Utility.IntToHex(theActor.GetFormID()) + " + is NOT within their package location.")
	EndIf
EndFunction

 

3) Try calling Console ConsoleSelectedRef.EVP or Papyrus Actor.EvaluatePackage on the NPC to force reevaluate their package data.

4) While the Command Mode is left unfinished in Starfield, the native code still exists. If you call ConsoleSelectedRef.SetPlayerTeammate 1 (or any Papyrus equivalent), you can command this NPC. Command them to somewhere and see if the command mode AI works. The command mode relies on Pathing just like any AI package.

Link to comment
Share on other sites

So:

1. The current packages are the right ones on  the moments I sampled, which was when they were told to move, thus toogling the condition needed to activate the package.
2. The condition runner always returned false when checking against GetWithinPackageLocation
3. I always call the EvaluatePackage
4. I did the call to SetPlayerTeammate and he would not follow commands, or follow me. In truth, my companions will not follow the player when this issue triggers.

And an important piece of information, I have 2 types of bots in there... the ones bugging and the others which simply patrol, but also using a TravelTo package. I tried yesterday switching the packages in the RefColAliases and it made no difference. Still the patrol guys do not get stuck. And as mentioned, the companions also get stuck.

So I am certainly doing some noobish thing, because if I don't instal and deploy my mod, it works properly.

NoobBard

Link to comment
Share on other sites

  • Recently Browsing   0 members

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