RTS Prototype Movement Question
by Chris Sargent · in Torque 3D Professional · 02/20/2010 (7:15 pm) · 2 replies
Just a preliminary statement I am learning how to use Torquescript and following the material in the docs.
Ok I was following along the RTS Tutorial. I'm using beta 1.1. Everything was going well until I got to the movement part. The instructions say to remove:
Ok I was following along the RTS Tutorial. I'm using beta 1.1. Everything was going well until I got to the movement part. The instructions say to remove:
// If the terrain object was found in the scan
if( %scanTarg )
{
// spawn a new object at the intersection point
%obj = new TSStatic()
{
position = getWords(%scanTarg, 1, 3);
shapeName = "art/shapes/building/orcburrow.dts";
scale = "0.5 0.5 0.5";
};
// Add the new object to the MissionCleanup group
MissionCleanup.add(%obj);
}About the author
#2
02/20/2010 (11:10 pm)
Try this:function PlayGui::onRightMouseDown(%this, %pos, %start, %ray)
{
// find end of search vector
%ray = VectorScale(%ray, 2000);
%end = VectorAdd(%start, %ray);
// only care about terrain objects
%searchMasks = $TypeMasks::TerrainObjectType;
// search!
%scanTarg = ContainerRayCast( %start, %end, %searchMasks );
// If the terrain object was found in the scan
if( %scanTarg )
{
%ai = LocalClientConnection.player;
if(%ai>0)
%ai.setMoveDestination(getWords(%scanTarg,1,3));
}
}
Torque Owner Chris Sargent
Glorious Software
if( %scanTarg ) { ClientGroup.getObject(0).player.setMoveDestination( getWords(%scanTarg, 1, 3) ); }When I do this, the right mouse button does nothing when I have the cursor enabled. I get this error in the console log which, as I am still learning does not really help me much in terms of finding the problem.
38: Cannot re-declar object [MainMenuAppLogo].
scripts/gui/playGui.cs Line: 88 - syntax error
>>>Advanced script error report. Line 88.
>>>Some error context, with ## on sides of error halt:
// only care about terrain objects#
%searchMasks = $TypeMasks::TerrainObjectType;#
#
//search!#
%scanTarg = ContainerRayCast( %start, %end, %searchMasks );#
if(%scanTarg)#
{#
ClientGroup.getObject(0).player.setMoveDestination(getWords(%scanTArg, 1, 3) );#
}#
#
#
#
>>> Error report complete
so i'm clueless nothing new about that though! Any help would be appreciated.