I need help creating an instance editable variable to reference the existing Trigger Volume in the level. I am not sure how to assign the reference in the Level Editor. Also, how do I use the OnActorBeginOverlap and OnActorEndOverlap events of the Trigger Volume to turn the UI on and off? I need to cast the Other Actor to BP_Bot with the appropriate OnActorBeginOverlap event so that only the player can activate the UI by walking into the studio. For the OnActorEndOverlap event, how do I cast the Other Actor to BP_Bot so that only the player can deactivate the UI? I have figured it out, but I have a new problem my trigger volume reference doesn’t work with the trigger volume
I would suggest not casting to the bot. Select the bot actor in your content browser and give him an actor tag “bot” and then on the overlap check if actor has the tag.
Have you player use the actor tag player and then no casts are needed.
Edit: fixed up ui reference to not be time dependant
Hud reference init
Inside of your hud class create the widget
Remember to add the proper tags to the actors
I’m guessing the bot is supposed to be possessed by the player to activate / deactivate these widgets?
Edit: this will work only for standalone games though as the trigger lives on the server in mp games and can’t access the player hud then. You would need more complex logic then.
I am doing an assignment and the instructions said to cast to bot but when I do so it does not activate the UI when I walk on the Trigger Volume, nor does it deactivate when I walk out of the trigger volume,
I am wondering what the problem is because I must use cast to bot for the assignment.
Is your player character set to the BP_Bot?
Make sure your game mode in your project settings => “maps and modes” set the default player correctly to BP_Bot
It should pass the cast correctly
overlap
end overlap
As for setting the widget reference inside of a blueprint function library, you need to make a function that takes in an input of type widget then you need
Revised hud and functions to work with a bp library
Hud:
Activate
Deactivate
Is it not working because the player is a pawn?
The only actor where the cast will work for the trigger is BP_Bot, because that is what you are trying to cast to