Adding AI abilities to the player
by John Doppler Schiff · in Torque Game Engine · 04/07/2007 (11:45 pm) · 2 replies
Hi folks,
I'm trying to integrate the AI's .setMoveDestination() functionality into the player. The ultimate goal here is to implement click-to-move navigation, as well as a follow mode, autopilots, etc.
What approach would you recommend to accomplish this?
Currently, I'm spawning the player object as an AIPlayer, as per the changes outlined in the Mouse controlled player movement resource. While this successfully implements click-to-move, it completely disabled key-based movement. (I need both.)
Is there a more elegant way of walking the player to a destination that I've overlooked?
I'm trying to integrate the AI's .setMoveDestination() functionality into the player. The ultimate goal here is to implement click-to-move navigation, as well as a follow mode, autopilots, etc.
What approach would you recommend to accomplish this?
Currently, I'm spawning the player object as an AIPlayer, as per the changes outlined in the Mouse controlled player movement resource. While this successfully implements click-to-move, it completely disabled key-based movement. (I need both.)
Is there a more elegant way of walking the player to a destination that I've overlooked?
#2
The "2 playable characters" thread doesn't quite touch on what I'm trying to do; I'm trying to enable a single player/character to use the same moveToDestination functions as the AIPlayer.
The Actors Resource mentioned within sounds absolutely perfect, though! Reading now...
Many thanks!
04/08/2007 (3:56 am)
Holy synchronicity, Batman!The "2 playable characters" thread doesn't quite touch on what I'm trying to do; I'm trying to enable a single player/character to use the same moveToDestination functions as the AIPlayer.
The Actors Resource mentioned within sounds absolutely perfect, though! Reading now...
Many thanks!
Torque Owner Stephen Lujan
//input the client and which player needs to be keyboard controlled function serverCmdToggleCharacter(%client, %player2ID) { // Give the client control of the player %client.player = %player2ID; %client.setControlObject(%client.advCamera); // set the camera system around the %player %client.advCamera.setPlayerObject(%player2ID); }You'll probably need to have a key command to switch back and forth between click-to-move and the keyboard. Otherwise you might have a hard time using the mouse to both aim your character and do the click-to-move. Alternatively go into the config.cs and map the steering buttons there to something.