Game Development Community

Problem with a new NPC

by DejaBlue · in Torque Game Engine · 11/30/2005 (11:03 am) · 1 replies

I am trying to disect AIGUARD and learn bout the datablocks here is where i am now

datablock StaticShapeData(AIGuardMarker)
{
category = "AIMarker";
shapeFile = "~/data/shapes/player/player.dts";

};

datablock playerData (entity)
{
renderFirstPerson = false;
emap = true;
shapeFile = "~/data/shapes/player/player.dts";
name = "Entity";
};


datablock playerData (npc : entity)
{
className = NPC;
category = "NPC";
cmdCategory = "NPCs";
emap = true;
name = "NPC";
gotoline = 0;
};

function AIGuard::LoadEntities()
{
if ($AI_GUARD_ENABLED == true)
{
echo("Loading Guard entities...");
%position = "0 0 0";
%radius = 100000.0;
InitContainerRadiusSearch(%position, %radius, $TypeMasks::StaticObjectType);
%i=0;
while ((%targetObject = containerSearchNext()) != 0)
{
if(%targetobject.getclassname() $= "StaticShape")
{
if (%targetobject.getDataBlock().getName() $= "AIGuardMarker")
{
%i++;
%player = AIGuard::spawnAtMarker(%targetobject.rpgname, %targetobject);
}
}
}
}
else
{
echo("Guard entities disabled...");
}

if ($AI_GUARD_MARKER_HIDE == true)
{
echo("Hiding Guard markers...");
%position = "0 0 0";
%radius = 100000.0;
InitContainerRadiusSearch(%position, %radius, $TypeMasks::StaticObjectType);
while ((%targetObject = containerSearchNext()) != 0)
{
if(%targetobject.getclassname() $= "StaticShape")
{
if (%targetobject.getDataBlock().getName() $= "AIGuardMarker")
%targetobject.sethidden(true);
}
}
}
}

function AIGuard::spawnAtMarker(%name,%obj)
{
if (!isObject(%obj))
return;
%player = AIGuard::spawn(%name, %obj);
return %player;
}



problem i have now is

Error: cannot change namespace parent linkage for npc from PlayerData to npc.

not to sure where this is wrong i am trying to get this away from using the data from playerdata so this bot is totally independent from player

or am i in the wrong ball field here?

#1
11/30/2005 (11:45 am)
Don't name classnames and datablocks the same.