Game Development Community

Question on the weaponshop in the zombieresource

by Tom Timothy · in Torque 3D Professional · 05/24/2012 (2:36 pm) · 4 replies

For starters I am talking this resource here

http://www.garagegames.com/community/blogs/view/21702.

The shop feature seem like a great deal but cant seem to get it working. Figure easy way would be player enters trigger open gui but my beginner level scripting is failing me Ive tried the following.

function StoreOpenTrigger::onEnterTrigger(%this, %trigger, %obj)
{
// Print a string to the console window.
echo("Player has entered store trigger.");
enterShop().setActive(true);
}
function StoreOpenTrigger::onLeaveTrigger( %this, %trigger, %obj )
{
// Print a string to the console window.
echo("Player has left store trigger.");


enterShop.setActive(false);
}


Also tried this

function StoreOpenTrigger::onEnterTrigger(%this, %trigger, %obj)
{
// Print a string to the console window.
echo("Player has entered store trigger.");
GUIshop.setVisible(true);
showCursor();
}
function StoreOpenTrigger::onLeaveTrigger( %this, %trigger, %obj )
{
// Print a string to the console window.
echo("Player has left store trigger.");


GUIshop.setVisible(false);
hideCursor();
}

Both don't seem to work


#1
05/24/2012 (5:48 pm)
Haven't worked with the zombieresource, but for showing GUI (haven't worked with this)
But this is what i saw in startupGUI:
function StartupGui::next(%this)
{
   // Set us to a blank screen while we load the next one
   Canvas.setContent(BlankGui);
Try the Canvas.setContent method
#2
05/24/2012 (7:53 pm)
thanks Lukas but that wont work it will remove the playGui from the canvas and replace it with whatever canvas control you pass to the function argument.
#3
05/25/2012 (3:21 am)
Canvas.setContent(GUIshop); is what he's Lukas is talking about.
So your code would look something like this:
function StoreOpenTrigger::onEnterTrigger(%this, %trigger, %obj)
{
// Print a string to the console window.
echo("Player has entered store trigger.");
Canvas.setContent(GUIshop);
}

You'll also need to delete the gui when the player is finished.


#4
05/25/2012 (10:16 am)
And in your onLeaveTrigger() callback just call Canvas.setContent(PlayGui) to restore the PlayGui....