Help with UI Coding ?

Hello. I am in the process of creating UI elements that will track team kills and individual player kills of a custom NPC class I created. I can get the UI to update for everyone (team kills) but can’t get a single player’s kills to update. I can’t figure out why my [fort_character]int map is not registering how I expect it to.

Basically, THIS code works (from my game manager device):

But this code doesn’t, from the custom NPC behavior :

No errors, all of the types match up ( I used fort_character finally after trying combinations of player and agents gathered by the GetInstigatingAgent() and casts to it ) and the InstigatingCharacter is successful, just before this code i test for it and the Instigating agent to grant gold for the kill and that works.

The map initializes correctly for each player, verified through debug, but I can’t access 1 of the maps. Any help is greatly appreciated, thanks in advance

Here is the full function of the code that is not working. The GoldGranter and InstigatingAgent are successful in their parts, but the InstigatingCharacter is not.

The GameManager you’re trying to access from the NPC behavior is not the same object, editable links inside NPC behavior seem to not work properly, I suggest you pass the reference to your game manager through another mean

1 Like

Thanks for your response. The GameManager is accessing a Gold Granter (item granter device set to gold) and successfully grants the eliminating agent gold. But I can’t get anything past that line of code to fire here: (Dialed everything back to agent for simplicity sake since I realized that wasn’t the issue)

So it appears that I can’t access the UI Device’s map of [agent]UIManager from my NPC class correctly, nor can I access my Game Manager’s map of [agent]int from the NPC class.

Not sure what is going on here but it looks like my custom stuff is not working from the NPC class. Any advice/ideas on how to go about handling this by chance?

Thanks again!

I believe you’re accessing an empty manager, the NPC behavior is a concrete class so the editable links can be empty, it’s probably a bug or something I didn’t understand yet, maybe I’m wrong, try not using editables I think

1 Like

Thanks for your help! I changed my method of attack and used the NPC spawner’s EliminatedEvent and subscribed to that directly in the Game Manager. Not sure what the heck was the deal here but at least we got it working :smiley:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.