Jump to content

[Script] Adding AI Packages to the Player


Zorkaz

Recommended Posts

Has anyone experience with adding AI packages to NPCs, in my case the player?

Does it work properly?

 

Basically I'd like to add and remove a package using a script without editing the NPC manually

Link to comment
Share on other sites

The console commands SetPlayerAIDriven and ToggleControlsDriven don't work as far as I know.

 

Moving the player as if they were controlled by an AI package would be possible with a dummy (invisible) furniture, a custom furniture animation and FurnitureRef.Activate(PlayerRef).

Link to comment
Share on other sites

SetPlayerAIDriven does work as far as I remember as I've used it to control a cat instead of the player

Game.Getplayer().RemoveItem (CFCatFood, 1)
Game.ForceThirdPerson()
CatMinkaActor.SetPlayerControls(true)
CatMinkaActor.EnableAI(True, False)
Game.SetPlayerAIDriven(true)
Game.SetCameraTarget(CatMinkaActor)

KmyQuest.CatControl()

The real issue is that I propably can't add and remove a package to the playerref as there is no script for that

Link to comment
Share on other sites

SetPlayerAIDriven does work as far as I remember as I've used it to control a cat instead of the player

Game.Getplayer().RemoveItem (CFCatFood, 1)
Game.ForceThirdPerson()
CatMinkaActor.SetPlayerControls(true)
CatMinkaActor.EnableAI(True, False)
Game.SetPlayerAIDriven(true)
Game.SetCameraTarget(CatMinkaActor)

KmyQuest.CatControl()

The real issue is that I propably can't add and remove a package to the playerref as there is no script for that

 

I take control of the player in a couple of my scenes as well - albeit only for a couple of seconds, because it's super janky. The way I apply AI packages to the player is in scenes. It's pretty much the same approach as with NPCs in scenes. That's probably not what you're looking for since you want to do it script based, but maybe you can make it work for you.

 

Link to comment
Share on other sites

So far no luck. Using

Game.ForceThirdPerson()
Game.SetPlayerAIDriven(true)
utility.wait(0.1)
PSPlayerSandboxQ.start()
PSPlayerSandboxQScene.start()

in a magic effect

 

and having a scene where the player has a sandbox package applied only lets the player stand around immovable

Link to comment
Share on other sites

  • Recently Browsing   0 members

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