Problem with new Entitys in Maps

Get technical support about the C++ source code and about Lua scripts for maps, entities, GUIs, the console, materials, etc. Also covered are the Cafu libraries and APIs, as well as compiling, linking, and the build system.
Post Reply
TheMatrix
Posts: 20
Joined: 2004-10-19, 10:06

Problem with new Entitys in Maps

Post by TheMatrix » 2004-10-28, 19:34

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
User avatar
Carsten
Site Admin
Posts: 2160
Joined: 2004-08-19, 13:46
Location: Germany
Contact:

Post by Carsten » 2004-10-28, 20:01

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.
Best regards,
Carsten
TheMatrix
Posts: 20
Joined: 2004-10-19, 10:06

Post by TheMatrix » 2004-10-28, 22:06

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
User avatar
Carsten
Site Admin
Posts: 2160
Joined: 2004-08-19, 13:46
Location: Germany
Contact:

Post by Carsten » 2004-10-28, 22:22

:idea: Happy to hear this! :D
Best regards,
Carsten
User avatar
Shadow
Posts: 195
Joined: 2004-08-28, 06:00
Location: Minesota, USofA
Contact:

Post by Shadow » 2004-10-30, 06:56

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?
Image
PBX CONTINUES!!!
CLICK HERE!!
User avatar
Carsten
Site Admin
Posts: 2160
Joined: 2004-08-19, 13:46
Location: Germany
Contact:

Post by Carsten » 2004-10-30, 09:31

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. ;)
Best regards,
Carsten
TheMatrix
Posts: 20
Joined: 2004-10-19, 10:06

Post by TheMatrix » 2004-10-30, 10:41

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
Camille
Posts: 11
Joined: 2004-08-25, 10:03

Post by Camille » 2004-10-30, 11:55

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:
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests