Page 1 of 1

Problem with new Entitys in Maps

Posted: 2004-10-28, 19:34
by TheMatrix
I wrote a class EntTeamSpawnT which should be Spawns that are only can be used by the right team

In Deatmatch.cpp CreateBaseEntityFromMapFile() i wrote
if (strcmp(MapFileName, "TeamSpawn_Red" )==0) return new EntTeamSpawnT (TYPEID_TEAMSPAWN , ID, MapFileID, Team_Red, EF, Origin);
if (strcmp(MapFileName, "TeamSpawn_Blue" )==0) return new EntTeamSpawnT (TYPEID_TEAMSPAWN , ID, MapFileID, Team_Blue, EF, Origin);
TYPEID_TEAMSPAWN is defined in enum EntityTypeIDs

In the .fdg file i wrote
//New for Team Spawn
@BaseClass size(-16 -16 -16, 16 16 16) color(0 200 255) base(Angles) = Spawn []

//My Entitiy Team Spawns
@PointClass base(Spawn) = TeamSpawn_Red : "Team Spawn Red" []
@PointClass base(Spawn) = TeamSpawn_Blue : "Team Spawn Blue" []
But when i load a map with a TeamSpawn Entity( i edided Kidney so there is just 1 InfoPlayerStart, the rest TeamSpawn Red or TeamSpawn Blue), ca3d prints as debug messages:
Client Warning: EntityManager.cpp L471: EngineEntities[EntityID] = NULL
This is for EntityID 6,13,14,15,17

What should i do

Posted: 2004-10-28, 20:01
by Carsten
Ok, first a question:
When you open the modified cmap file in a text editor, and look up your entity defs there, is the case of the name string exact/matching?
That is, are the entities that are listed in the cmap files named differently from "TeamSpawn_Red" or "TeamSpawn_Blue" (etc. "teamspawn_red") ?
Please let us know.

Posted: 2004-10-28, 22:06
by TheMatrix
i found the problem

i added
if (TypeID==TYPEID_TEAMSPAWN_BLUE ) return new EntTeamSpawnT (TypeID, ID, MapFileID, Team_Blue, EF, VectorT());
if (TypeID==TYPEID_TEAMSPAWN_RED ) return new EntTeamSpawnT (TypeID, ID, MapFileID, Team_Red, EF, VectorT());
in CreateBaseEntityFromTypeID() and know it works

Posted: 2004-10-28, 22:22
by Carsten
:idea: Happy to hear this! :D

Posted: 2004-10-30, 06:56
by Shadow
this is good to know
i need the team start points for my game. how hard would it be to have say 5 different spawn points chosen at random for you to start at? like 5 for each team?

Posted: 2004-10-30, 09:31
by Carsten
Shadow wrote:how hard would it be to have say 5 different spawn points chosen at random for you to start at? like 5 for each team?
Not hard at all, from the above posts I think TheMatrix just solved that very problem. ;)

Posted: 2004-10-30, 10:41
by TheMatrix
That a thing i want to code

With the current version, only the TeamSpawn with the lowest ID will be choosen, not a random.

Maybe you could scan all Entitys with GetAllEntitys(), write all TeamSpawns in an Array, and then chose own of them

Posted: 2004-10-30, 11:55
by Camille
I think the code forthe normal spawnpoint use random selection ?

so use copy/paste

but perhaps not, i didn't look at the code for ages :oops: