The Verse API Show(Agent : agent) of the HUD Message Device is not functioning as intended.

Summary

As stated in the title, the Verse API Show(Agent : agent) of the HUD Message Device does not work as expected. Instead, it behaves the same as the standard Show() method, displaying the HUD message to all agents.

Please select what you are reporting on:

Verse

What Type of Bug are you experiencing?

Devices

Steps to Reproduce

Used the Show(Agent : agent) method of the HUD Message Device to display a HUD.
In my case, I set it up to display the HUD to the agent who triggered it by using a Trigger Device.

Expected Result

The HUD message should display for the specified agent only.

Observed Result

The HUD message is displayed to all agents in the space.

Platform(s)

Windows 10

Additional Notes

It was possible to display messages to individual agents using a function with the following parameters, which include the Message type as an argument:

Show(Agent : agent, Message : message, ?DisplayTime : float = external {}) : void = external {}

Heres a script I use in all my new projects to thank players and it seems to work perfectly… i only use the agent as an argument so maybe using multiple arguments in causing your script to bug out but thats just a guess.

ty_for_playing := class(creative_device):
    @editable spawners:[]player_spawner_device = array{}
    @editable ThankYou : hud_message_device = hud_message_device{}

    
    OnBegin<override>()<suspends>:void=
        for(spawner:spawners):
            spawner.SpawnedEvent.Subscribe(InitPlayer)

    InitPlayer(Agent:agent):void=
        if (Chr := Agent.GetFortCharacter[]):                              
            Chr.EliminatedEvent().Subscribe(OnElimination)

    OnElimination(Elimination:elimination_result):void=
        if(Eliminated := Elimination.EliminatedCharacter, EliminatedAgent := Eliminated.GetInstigatorAgent[]):
            ThankPlayer(EliminatedAgent)

    ThankPlayer(ElimedAgent:agent):void=
        ThankYou.Show(ElimedAgent)

Thank you!

I used below code for the test in this case

In OnTriggeredEvent(), it was shown to all Agents in the space, while in OnTriggeredEvent2(), it only showed for the triggering Agent.

Since this happened during a simple test, I thought it was something affecting everything, but maybe there’s another cause at play…

If you configured your HUD message to broadcast to All, then it’s the expected behavior :eyes:

2 Likes

I had a weird scenario where i was showing a Hud to an agent the Hud device was set correct and if that agent left the game it showed to another random agent in the game. Makes no sense to me everything was ok and i had to check the agent was IsActive which helped a little but also show a blank Hud.

1 Like

This topic was automatically closed after 180 days. New replies are no longer allowed.