Hi cthoennes,
as a basis, please consider
this example of a trigger handler:
Code: Select all
function TestTrigger:OnTrigger(Activator)
-- Choose the variant of logic you want to test.
local variant=0;
-- ...
Console.Print(Activator:GetName());
end
Note that
Activator
is typically the human player entity -- which also happens to hold the HUD GUI in which you could display your text!
That is, you could write e.g.
Code: Select all
function TestTrigger:OnTrigger(Activator)
-- deactivation and re-activation omitted...
Activator:ShowHelpText("Press Spacebar to jump");
wait()
Activator:ShowHelpText(""); -- or simply (nil), or ()
end
All that you have to implement is the
ShowHelpText()
script function in the human player entity. It could, for example, find a predefined, but initially hidden window in the HUD GUI, and if the given string is non-empty, set the string as the window text and show the window. Vice versa when the string is empty (or not given at all).
Alternatively, if you have a recent release of the source code, you can also make the HUD GUI "poll" the human player entity for a string to be shown (which would require another script method, e.g.
GetHelpText()
in the human player. The result will be the same, but the logic of showing or hiding the window with your text is in the HUD rather than in the human player entity code.
Does that help?
Please let me know if you need help with e.g. the
ShowHelpText()
script function.
(As a completely different alternative, it would also possible to (mis-)use the chat system for issuing a message, but you'd have much less control over the details, and would not be able to e.g. add a custom image etc.)