ROG replace actor lua function

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
erichey
Posts: 2
Joined: Tue Apr 18, 2023 3:36 pm

ROG replace actor lua function

Post by erichey »

Hi Tony,

I'm using your ROG integration and I'm currently attempting to swap out an actor with a sleeping variant: RogReplaceActor("Guard Benjamin 2", "Actor_GuardBenjaminSleep");

It has worked before on other actors, but now I'm getting the following error. I've checked the naming conventions and everything seems to be in order.

Exception: Attempted to move unregistered actor: Actor_GuardBenjamin2 (Rog.Actor)
Rog.Map.MoveActorTo (Rog.Actor actor, System.Int32 destX, System.Int32 destY) (at Assets/Rog/Scripts/Map/Map.cs:344)
Rog.Action_MoveTo.Perform (System.Object info) (at Assets/Rog/Scripts/Action/Action_MoveTo.cs:27)
Rog.Actor.PerformAction () (at Assets/Rog/Scripts/Actor/Actor.cs:194)
Rog.TurnBasedSystem+<ProcessMiniTurn>d__12.MoveNext () (at Assets/Rog/Scripts/TurnBasedSystem/TurnBasedSystem.cs:103)
Rog.TurnBasedSystem.Perform () (at Assets/Rog/Scripts/TurnBasedSystem/TurnBasedSystem.cs:57)
Rog.Map.SimulateTurn () (at Assets/Rog/Scripts/Map/Map.cs:528)
Rog.Framework.SimulateTurn () (at Assets/Rog/Scripts/Framework/Framework.cs:453)
Rog.Client.Update () (at Assets/Rog/Scripts/Client/Client.cs:49)

Any ideas what might be causing this? Thanks so much in advance!
User avatar
Tony Li
Posts: 22131
Joined: Thu Jul 18, 2013 1:27 pm

Re: ROG replace actor lua function

Post by Tony Li »

Hi Ethan,

Make sure your Resources/Actors/ folder contains an actor prefab whose Actor component's Name is set to exactly "Guard Benjamin 2".

Also make sure there's another actor prefab in Resources/Actors/ whose prefab name in the Project view is exactly "Actor_GuardBenjaminSleep". If it still reports an error, try setting its Actor component's name to exactly "Guard Benjamin 2".
erichey
Posts: 2
Joined: Tue Apr 18, 2023 3:36 pm

Re: ROG replace actor lua function

Post by erichey »

Thanks for the response, Tony! Apologies for my late reply. I've double checked that the actors are named correctly and are located in the correct folder. I've also tried changing the actor component's name with no luck. The errors are still present. Not sure what it could be.
User avatar
Tony Li
Posts: 22131
Joined: Thu Jul 18, 2013 1:27 pm

Re: ROG replace actor lua function

Post by Tony Li »

Is it possible that, on the Actor component on "Guard Benjamin 2"'s prefab, there's an extra blank space at the end of the Name field, or something like that?
Post Reply