RTS prototype Unknown command setMoveDestination.
by gowinder · in Torque Developer Network · 01/12/2010 (2:56 am) · 32 replies
when i follow the document to the rts prototype, after i add
if( %scanTarg )
{
ClientGroup.getObject(0).player.setMoveDestination( getWords(%scanTarg, 1, 3) );
}
in scripts/gui/playGui.cs at the PlayGui::onRightMouseDown function,then i run the demo to test it with torsion, at the output window there is an error:
scripts/gui/playGui.cs (84): Unknown command setMoveDestination.
Object (3244) Player -> ShapeBase -> GameBase -> SceneObject -> NetObject -> SimObject
what is my problem?
Please help me guys!
if( %scanTarg )
{
ClientGroup.getObject(0).player.setMoveDestination( getWords(%scanTarg, 1, 3) );
}
in scripts/gui/playGui.cs at the PlayGui::onRightMouseDown function,then i run the demo to test it with torsion, at the output window there is an error:
scripts/gui/playGui.cs (84): Unknown command setMoveDestination.
Object (3244) Player -> ShapeBase -> GameBase -> SceneObject -> NetObject -> SimObject
what is my problem?
Please help me guys!
#22
If you did this, then of course it's firing once and stopping....
Next, look at the script for selecting your unit - I'll bet it clears your selection after you click your target.
Remember - this is an "RTS Prototype", not a complete RTS game. It's just to get the wheels turning, get you thinking about how you could take it further. It's not supposed to be Command and Conquer at the end of the tutorial....
01/29/2014 (3:08 pm)
Quote:
Next, we will change the auto-fire behavior. Instead of having the AI constantly attack a target, even after it is dead, we are going to modify the code to only cause our player to attack when a mouse button is clicked. In the same function we were just working in, locate the first schedule line we created
// Tell our AI object to fire its weapon in 100 milliseconds
%player.schedule(100, "setImageTrigger", 0, 1);
Then add the following directly under it:
// Stop firing in 150 milliseconds
%player.schedule(150, "setImageTrigger", 0, 0);
If you did this, then of course it's firing once and stopping....
Next, look at the script for selecting your unit - I'll bet it clears your selection after you click your target.
Remember - this is an "RTS Prototype", not a complete RTS game. It's just to get the wheels turning, get you thinking about how you could take it further. It's not supposed to be Command and Conquer at the end of the tutorial....
#23
01/30/2014 (12:45 pm)
I think I found another problem ... robot uses not Lurker he is holding a simple gun, and in the script work is carried out with a Lurker. Or so it should be, I completely confused?
#24
01/31/2014 (3:30 pm)
How are you spawning your bots? If you're spawning them using the buildings then you somehow missed this:function serverCmdspawnTeammate(%client, %source)
{
// Create a new, generic AI Player
// Position will be at the camera's location
// Datablock will determine the type of actor
%spawnName = "team1Spawn" @ %source.getId();
// Defaults
%spawnClass = $Game::DefaultPlayerClass;
%spawnDataBlock = $Game::DefaultPlayerDataBlock;
// Overrides by the %spawnPoint
if (isDefined("%spawnName.spawnClass"))
{
%spawnClass = %spawnName.spawnClass;
%spawnDataBlock = %spawnName.spawnDatablock;
}
else if (isDefined("%spawnName.spawnDatablock"))
{
// This may seem redundant given the above but it allows
// the SpawnSphere to override the datablock without
// overriding the default player class
%spawnDataBlock = %spawnName.spawnDatablock;
}
%spawnProperties = %spawnName.spawnProperties;
%spawnScript = %spawnName.spawnScript;
// Spawn with the engine's Sim::spawnObject() function
%newBot = spawnObject(%spawnClass, %spawnDatablock, "",
%spawnProperties, %spawnScript);
%spawnLocation = GameCore::pickPointInSpawnSphere(%newBot, %spawnName);
%newBot.setTransform(%spawnLocation);
%newBot.team = 1;
%newBot.clearWeaponCycle();
%newBot.setInventory(Lurker, 1);
%newBot.setInventory(LurkerClip, %newBot.maxInventory(LurkerClip));
%newBot.setInventory(LurkerAmmo, %newBot.maxInventory(LurkerAmmo));
%newBot.addToWeaponCycle(Lurker);
if (%newBot.getDatablock().mainWeapon.image !$= "")
{
%newBot.mountImage(%newBot.getDatablock().mainWeapon.image, 0);
}
else
{
%newBot.mountImage(Lurker, 0);
}
// This moves our new bot away from the front door a ways to make room for
// other bots as we spawn them.
%x = getRandom(-10, 10);
%y = getRandom(4, 10);
%vec = %x SPC %y SPC "0";
%dest = VectorAdd(%newBot.getPosition(), %vec);
%newBot.setMoveDestination(%dest);
addTeam1Bot(%newBot);
}If not, look in scripts/server/gameCore.cs for GameCore::loadOut(). It should look like this:function GameCore::loadOut(%game, %player)
{
//echo (%game @"\c4 -> "@ %game.class @" -> GameCore::loadOut");
%player.clearWeaponCycle();
//%player.setInventory(Ryder, 1);
//%player.setInventory(RyderClip, %player.maxInventory(RyderClip));
//%player.setInventory(RyderAmmo, %player.maxInventory(RyderAmmo)); // Start the gun loaded
//%player.addToWeaponCycle(Ryder);
%player.setInventory(Lurker, 1);
%player.setInventory(LurkerClip, %player.maxInventory(LurkerClip));
%player.setInventory(LurkerAmmo, %player.maxInventory(LurkerAmmo)); // Start the gun loaded
%player.addToWeaponCycle(Lurker);
//%player.setInventory(LurkerGrenadeLauncher, 1);
//%player.setInventory(LurkerGrenadeAmmo, %player.maxInventory(LurkerGrenadeAmmo));
//%player.addToWeaponCycle(LurkerGrenadeLauncher);
//%player.setInventory(ProxMine, %player.maxInventory(ProxMine));
//%player.addToWeaponCycle(ProxMine);
//%player.setInventory(DeployableTurret, %player.maxInventory(DeployableTurret));
//%player.addToWeaponCycle(DeployableTurret);
if (%player.getDatablock().mainWeapon.image !$= "")
{
%player.mountImage(%player.getDatablock().mainWeapon.image, 0);
}
else
{
%player.mountImage(Lurker, 0);
}
}Note that all of the weapons except the Lurker are commented out. I didn't put this in the RTS Prototype because by the end you're using the server command from the first code block and the bots spawn with the correct loadout.
#25
02/01/2014 (11:37 am)
Ok, I've set up a copy of the documentation on my site at http://www.roostertailgames.com/TorqueRef/index.html - I've updated the RTS article to reflect the changes noted.
#26
PS No I still have not come down there, I have yet to create a step, destination marker. http://docs.garagegames.com/torque-3d/official/content/documentation/Scripting/Advanced/RTSPrototype.html#Destination_Markers
02/02/2014 (12:17 pm)
Wow, thank you again, I'll try to deal with it in order to understand. PS No I still have not come down there, I have yet to create a step, destination marker. http://docs.garagegames.com/torque-3d/official/content/documentation/Scripting/Advanced/RTSPrototype.html#Destination_Markers
#27
Reference to section with a misprint ...
http://docs.garagegames.com/torque-3d/official/content/documentation/Scripting/Advanced/RTSPrototype.html#GoingRTS
Text catalog with custom error ...
Now we have to modify scripts / player / default.bind.cs to add some new functions and a new bind right after our bind to spawn enemy targets.
!PLAYER directory does not exist but there is CLIENT!
02/07/2014 (7:38 am)
Just found one more misprint. In the text.Reference to section with a misprint ...
http://docs.garagegames.com/torque-3d/official/content/documentation/Scripting/Advanced/RTSPrototype.html#GoingRTS
Text catalog with custom error ...
Now we have to modify scripts / player / default.bind.cs to add some new functions and a new bind right after our bind to spawn enemy targets.
!PLAYER directory does not exist but there is CLIENT!
#28
Now open scripts / server / player.cs, find Armor :: onDisabled () and add the following code after the call to% obj.playDeathAnimation ():
! Armor :: onDisabled () does not exist, there is a function PlayerData :: onDisabled (% this,% obj,% state)!
02/07/2014 (8:02 am)
Another typo in the end of the lesson ... Now open scripts / server / player.cs, find Armor :: onDisabled () and add the following code after the call to% obj.playDeathAnimation ():
! Armor :: onDisabled () does not exist, there is a function PlayerData :: onDisabled (% this,% obj,% state)!
#29
Technically the change from Armor to PlayerData is not a typo - that file has been changed between 3.0 and 3.5 and I haven't updated the article. Thanks for pointing it out, though - I'll have to add call-out information based on versions now....
02/07/2014 (9:30 am)
I'll update that when I get home - you're correct, it should be scripts/client....Technically the change from Armor to PlayerData is not a typo - that file has been changed between 3.0 and 3.5 and I haven't updated the article. Thanks for pointing it out, though - I'll have to add call-out information based on versions now....
#30
I am glad that helpful here. By the way, I have come to the end of the lesson, but I could not make it work as it should be. At the end of the lesson I took
ready resources and script files provided on the link at the end of the lesson and integrated it in a clean new project to check how it was to work on the
primary plan. And I should note that while this control version of the game worked, but extremely unstable and I could not find any specific points in which my work was not held. And about why at me came the question. Could this somehow be related to the fact that my version of Torque 3D is 3.0 instead of 3.5?
02/07/2014 (10:55 am)
I am glad that helpful here. By the way, I have come to the end of the lesson, but I could not make it work as it should be. At the end of the lesson I took
ready resources and script files provided on the link at the end of the lesson and integrated it in a clean new project to check how it was to work on the
primary plan. And I should note that while this control version of the game worked, but extremely unstable and I could not find any specific points in which my work was not held. And about why at me came the question. Could this somehow be related to the fact that my version of Torque 3D is 3.0 instead of 3.5?
#31
02/07/2014 (4:46 pm)
It was actually created for the commercial 1.0 release, then updated to 1.2, then again to the first MIT release - so I'm sure it's related to changes made to many of the scripts since then. It functions correctly on 3.0, I haven't really looked at 3.5 yet.
#32
02/08/2014 (11:07 am)
I tried to download a new binary version 3.5. But found that it did not is present, there is the old version 3.0, apparently the button "Download Binary" from this page ... http://www.garagegames.com/products/torque-3d is not actual?
Olexiy Kravchuk