Game Development Community

Problem with a function

by AIDan · in Torque Game Engine · 05/19/2002 (10:24 am) · 1 replies

Hi

Where is the mistake?? NPC::create is not called, instead of this, it wants to call PlayerData::create.

datablock PlayerData(DefaultArmor)
{
	class= "NPC";
	category= "NPC";
	...
}

function NPC::create(%datablock)
{
	// Create the player object
	%npc= new Player()
	{
		dataBlock= %datablock;
	};
	
	//%obj.setControlObject(%player); //   <- AI here
	
	return %npc;
}

#1
05/19/2002 (2:36 pm)
Ok, it has to be className and the create function requires to be PlayerData::create(). After this, you can use NPC:: for all other functions.