Game Development Community

TGEA 1.0.3 & Yack Pack

by Mark Edmunds · in Torque Game Engine Advanced · 01/30/2008 (8:24 am) · 1 replies

Hi everyone,

I have come across a problem integrating the Yack Pack with my modded version of TGEA 1.0.3...

So far I have implemented Advanced Camera, Object Selection, and also Click to Move resources. I have also made some minor modifications myself to allow for the right mouse click to move the camera around the player.

Could someone please point me in the right direction? I think I know the problem, I just don't know how to fix it.

At the moment, when the game first loads the cursor is on. I am passing through the onMouseDown event through the GameTSCtrl, this then gets passed to PlayGui::onMouseDown which calls serverCmdSelectObject. This does a raycast to check if the target object is a player and if it can talk(ie use yack pack dialog). I have placed my call to YackStart, which doesn't seem to work.

function serverCmdSelectObject(%client, %mouseVec, %cameraPoint)
{
   //Determine how far should the picking ray extend into the world?
   %selectRange = 200;

   // scale mouseVec to the range the player is able to select with mouse
   %mouseScaled = VectorScale(%mouseVec, %selectRange);

   // cameraPoint = the world position of the camera
   // rangeEnd = camera point + length of selectable range
   %rangeEnd = VectorAdd(%cameraPoint, %mouseScaled);

   // Search for anything that is selectable – below are some examples
   %searchMasks =	$TypeMasks::StaticObjectType | $TypeMasks::EnvironmentObjectType | 
                  $TypeMasks::TerrainObjectType |	$TypeMasks::InteriorObjectType | 
                  $TypeMasks::WaterObjectType | $TypeMasks::TriggerObjectType |	
                  $TypeMasks::MarkerObjectType | $TypeMasks::ForceFieldObjectType | 
                  $TypeMasks::GameBaseObjectType |	$TypeMasks::ShapeBaseObjectType | 
                  $TypeMasks::CameraObjectType | $TypeMasks::StaticShapeObjectType |	
                  $TypeMasks::PlayerObjectType | $TypeMasks::ItemObjectType | 
                  $TypeMasks::VehicleObjectType |	$TypeMasks::VehicleBlockerObjectType | 
                  $TypeMasks::ProjectileObjectType | $TypeMasks::ExplosionObjectType |	
                  $TypeMasks::CorpseObjectType | $TypeMasks::DebrisObjectType | 
                  $TypeMasks::PhysicalZoneObjectType |	$TypeMasks::StaticTSObjectType | 
                  $TypeMasks::GuiControlObjectType | $TypeMasks::StaticRenderedObjectType |	
                  $TypeMasks::DamagableItemObjectType ;

   // Search for objects within the range that fit the masks above. If we are
   // in first person mode, we make sure player is not selectable by setting
   // fourth parameter (exempt  from collisions) when calling ContainerRayCast
   %player = %client.player;

   %scanTarg = ContainerRayCast (%cameraPoint, %rangeEnd, %searchMasks);

   // a target in range was found so select it
   if (%scanTarg)
   {
      %targetObject = firstWord(%scanTarg);
      
      if(%targetObject.getType() & $TypeMasks::PlayerObjectType){
         %client.setSelectedObject(%targetObject);
         clientCmdBottomPrint(%targetObject.getDataBlock().name @ "\n" @ %targetObject.getDataBlock().desc ,7,3);
      
         if(%targetObject.getDataBlock().canTalk){
            commandToServer('YackStart',%targetObject.getGhostID());            
         }
      }
      
      if(%targetObject.getType() & $TypeMasks::TerrainObjectType){
         $pos = getWords(%scanTarg,1,3);
         %player.setMoveDestination($pos);         
      }
   }
}

Is this the wrong place to put this call? and if so could you please help me work out how to integrate this Yack Pack with TGEA?

Thank you.

Regards Mark

About the author

Recent Threads

  • RTS For 1.5.2??

  • #1
    02/15/2008 (10:31 am)
    Have you stepped through the code there? This is just a guess, but you might try making sure that whatever you're actually trying to select is in fact PlayerObjectType. Temporarily, you could set it so that the test for the YackPack portion of the code does "if ( isObject( %targetObject ) && !( %targetObject.getType() & $TypeMasks::TerrainObjectType ) )".