Naming Objects and Players
by Jim Klein · in Technical Issues · 04/13/2006 (7:32 am) · 4 replies
Hi, I am in a Game Design class and I am trying to code for the FFP. I can'y figure out how to declare the player's name, an A.I.'s name, or any object's name for that matter! How do I code in the scripts "Call player this" and where do I code it? Thanks
#2
//-----------------------------------------------------------------------------
// AIPlayer static functions
//-----------------------------------------------------------------------------
function AIPlayer::spawn( %name, %spawnPoint )
{
// Create the A.I. driven bot object...
%player = new AIPlayer()
{
dataBlock = MyBot;
path = "";
};
MissionCleanup.add( %player );
%player.setShapeName( %player);
%player.setTransform( %spawnPoint );
return %player;
}
But when I try to change "%player" to a name it still does not work. Help please!!!
04/17/2006 (9:02 pm)
I tried altering the code in tutorial.base/server/bot -here's what the part of the code that has that line you mentioned looks like-//-----------------------------------------------------------------------------
// AIPlayer static functions
//-----------------------------------------------------------------------------
function AIPlayer::spawn( %name, %spawnPoint )
{
// Create the A.I. driven bot object...
%player = new AIPlayer()
{
dataBlock = MyBot;
path = "";
};
MissionCleanup.add( %player );
%player.setShapeName( %player);
%player.setTransform( %spawnPoint );
return %player;
}
But when I try to change "%player" to a name it still does not work. Help please!!!
#3
%obj.mountImage( RocketLauncherImage, 0 );
%obj.setImageAmmo( 0, 1 );
In the bot's script but nothing happens. I really need help here...
04/17/2006 (9:12 pm)
Ultimately what I am trying to do is to name the A.I. player, give him a weapon, give him ammo, and code him to shoot at the player (there's more to it, but its not important). Once I get the naming thing down, how and where do I code to mount an image (weapon) and ammo? I have tried:%obj.mountImage( RocketLauncherImage, 0 );
%obj.setImageAmmo( 0, 1 );
In the bot's script but nothing happens. I really need help here...
#4
Until then to make you feel happy right before %player.setShapeName(%name);
add the line
they you should see a differance, note that is a hack you need to find where the name is originally called, use "find in files" from something like Tribal IDE or Torsion
04/18/2006 (8:29 am)
Note from the aiplayer.csfunction AIPlayer::spawn(%name,%spawnPoint)
{
// Create the demo player object
%player = new AiPlayer() {
dataBlock = DemoPlayer;
path = "";
};
MissionCleanup.add(%player);
%player.setShapeName(%name);
%player.setTransform(%spawnPoint);
return %player;
}Ideally you want to back track and find where spawn is called (which is AIplayer::spawnonPath() and where that is called, track it down until you find where name is set)Until then to make you feel happy right before %player.setShapeName(%name);
add the line
%name = "The Great Rosenbaum";
they you should see a differance, note that is a hack you need to find where the name is originally called, use "find in files" from something like Tribal IDE or Torsion
Associate Anthony Rosenbaum