Game Development Community

Shout

by Vincent D · in Torque Game Engine · 05/02/2005 (7:48 am) · 5 replies

Hi,

does anybody has a shout/radio script like "hold position" or "follow me" ?
i would really apriciate it if u gave it to me :)

Vincent

#1
05/02/2005 (7:52 am)
You mean like this?
//This function allows a shout for help to be made which will call the closest NPC within a given radius to help.
function ShoutForHelp(%client,%targetObject,%radius){
		%searchMasks = PlayerObjectType;
		%AI = 1;
		%helper = DoRadiusSearch(%client,%radius,%searchMasks,%AI);
		if(%helper.getClassName() $="AIPlayer"){
			%helper.setSelectedObject(%targetObject);
			schedule(2000,%targetObject,ServerCmdAutoAttack,%client);
		}
}
#2
05/02/2005 (7:58 am)
No, like in multiplayer by pressing ctrl-1 u will say something like "follow me"
#3
05/02/2005 (8:20 am)
You need a server command invoked by the client (take a look at how the ctrl-k stuff is done) and the server then sends out a message by a messageAll / messageTeam call.

/client/sripts/default.bind.cs:
Add something like this:
moveMap.bindCmd(keyboard, "ctrl 1", "commandToServer('FollowMe');", "");

/server/scripts/commands.cs:
Add something like this for a team message assuming %team is your team variable.
function serverCmdFollowMe(%client)
{
   if (isObject(%client.player))
      chatMessageTeam(%client, %team, "Dudes, follow me! I also don't know where to go! ");
}

If no team exists now, send the msg to all players out by doing this instead of ChatMessageTeam:

function serverCmdFollowMe(%client)
{
   if (isObject(%client.player))
      chatMessageAll( %client, "Dudes, follow me! I also don't know where to go! ");
}

Hope this helps.

Martin
#4
05/02/2005 (8:33 am)
Or (if you want the acoustic version) create a sound
and trigger this in client/config.cs with

moveMap.bindCmd(keyboard, "f2", "", "alxPlay(sndShout);");

[edit] Psionics ComTalk Free Sound ressource
#5
05/02/2005 (10:51 am)
Thanks guys this is what i needed :) i couldnt get the sound file working