Getting a player to detect objects around them
by Drew Kario · in Torque Game Engine Advanced · 08/10/2009 (5:34 pm) · 2 replies
Hi guys. Im stumped on this.
What im trying to do is make it so the player searches for an object around it in a radius, and when it does, to toggle the visibility of one of the gui's i have set up for this. Now, ive made sure the gui's work but i cant seem to make any headway on this problem.
This is what i have put together so far, by searching the forums and resources, and tdn, and referencing and lots of stuff like that.
Im using AFX combopack as well, if that matters.
Ive stuck this into player.cs right after the end of the datablocks.
I'm not even getting the echo in this, so im sure i missed something somwhere.
Someone help?
What im trying to do is make it so the player searches for an object around it in a radius, and when it does, to toggle the visibility of one of the gui's i have set up for this. Now, ive made sure the gui's work but i cant seem to make any headway on this problem.
This is what i have put together so far, by searching the forums and resources, and tdn, and referencing and lots of stuff like that.
Im using AFX combopack as well, if that matters.
Ive stuck this into player.cs right after the end of the datablocks.
function PlayerData::processTick(%this, %player)
{
echo ("test for ticks");
%position = localclientconnection.player.getPosition();
InitContainerRadiusSearch ( %position , 10 , ItemObjectType );
echo("Initializing Search");
%obj = ContainerSearchNext();
echo("Results: " @ %obj);
if(%obj.getClassName() $= "popupgui")
{
if (%obj.getSubClassName() $= "weapon")
weapongui.Visible = true;
else
weapongui.Visible = false;
}
}I'm not even getting the echo in this, so im sure i missed something somwhere.
Someone help?
#2
08/16/2009 (8:33 pm)
that sounds a bit too complex. Umm.. Is there a way to set a timer? So that when oncollision happens it sets up like a 2 tick timer before it decides to execute the function, and if the player remains in the same area the timer is never able to count down?
Torque 3D Owner Mark Dynna
I'm not sure that there is a ProcessTick callback into script from the engine, you might have to write that part.