Quick trigger question
by Ian Coffey · in Torque Game Engine · 09/26/2005 (7:37 am) · 6 replies
Hello all,
Im trying to push a gui when the player enters the trigger area. So far, I have the trigger echoing, so its working in that regard, but I cant get the gui to open. I just added the line Canvas.pushDialog(dlg) to the body of the onenter trigger function. Am i way off base?
Thanks,
Ian
Im trying to push a gui when the player enters the trigger area. So far, I have the trigger echoing, so its working in that regard, but I cant get the gui to open. I just added the line Canvas.pushDialog(dlg) to the body of the onenter trigger function. Am i way off base?
Thanks,
Ian
About the author
#2
Not to sound like a dolt, but what exactly is a clientcommand, and where are they defined?
I searched high and low before posting.
Thanks
09/27/2005 (8:03 am)
Hello,Not to sound like a dolt, but what exactly is a clientcommand, and where are they defined?
I searched high and low before posting.
Thanks
#3
09/27/2005 (8:27 am)
He's talking about using the commandToClient/clientCmd script interface to pass the event from the server (where the trigger exists) to the client (where the gui exists) when the trigger is activated.
#4
Your trigger
and in starter.fps/client/scripts/client.cs
add this
A small example ,but you need to tweak it a little so it works for you,this one push the optionsdialog.
09/27/2005 (8:53 am)
Ok sorry , try something like this .Your trigger
datablock TriggerData(GuiTrigger)
{
tickPeriodMS = 100;
};
function GuiTrigger::onEnterTrigger(%this,%trigger,%obj)
{
Parent::onEnterTrigger(%this,%trigger,%obj);
commandToClient(%obj.client,'showGui');
}
function GuiTrigger::onLeaveTrigger(%this,%trigger,%obj)
{
Parent::onLeaveTrigger(%this,%trigger,%obj);
}and in starter.fps/client/scripts/client.cs
add this
function clientCmdShowGui()
{
Canvas.pushDialog(OptionsDlg);
}A small example ,but you need to tweak it a little so it works for you,this one push the optionsdialog.
#5
09/27/2005 (1:42 pm)
Ah I see. Very wonderful explanation. Thanks much!
#6
09/28/2005 (8:03 am)
Ah I see. Very wonderful explanation. Thanks much!
Torque 3D Owner Billy L