Jump to content

Weird Bug Regarding Agent Event Broadcasting


Recommended Posts

First, without modifying any original code, I tried to listen for the agent_location_changed event. It never triggered for some reason.

Then I tried to look up sample codes, and I decided to listen for caravan_member_event, and check event id with agent_location_changed. It only triggered when the player tries to move. But I don't want to do that, because I want to check for this event for every agent.

Then I saw a potential problem: Nothing triggers, because an event is only broadcasted when an agent has an event listener already defined. So I modified the code so that if an agent doesn't have an event listener, it calls TheGame:BroadcastEvent instead. It brings up a new, unrelated bug, where CrewPortrait magically stopped working because something about "Attempt to call a nil value" on line 142, the GetPortrait field. Now I'm baffled.

 

Unrelated, is there a good way to add a workposition for a location on demand? Like adding it as part of a quest or something. I tried to add one, but it causes some problems with save/load.

Archived

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

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...