Posted by: Put Put Cars
Date posted: Aug 29 2003 User Rating: 3 out of 5.0 | Number of views: 5656 Number of comments: 32 | Description: Bigguys Team Spawn Points had a couple of errors, so here is how your fix them. |
Original tut: http://hlpp.telefragged.com/tuts/teamspawn.htm First, to make these work, you must complete this tutorial on Teams: http://elife.5u.com/teamstutorialsdk22.html
First, go to subs.cpp Look for this line:
| | LINK_ENTITY_TO_CLASS(info_player_deathmatch,CBaseDMStart); |
Under that put these new entities. Each of these will act as our team and observer spawn points:
| | LINK_ENTITY_TO_CLASS(info_player_observer,CBaseDMStart); LINK_ENTITY_TO_CLASS(info_player_team1,CBaseDMStart); LINK_ENTITY_TO_CLASS(info_player_team2,CBaseDMStart); |
Now, we need to add a new function to choose our spawn location. Look for this in player.cpp:
| | extern edict_t *EntSelectSpawnPoint( CBaseEntity *pPlayer ); |
Underneath that add this:
| | extern edict_t *EntSelectTeamSpawnPoint( CBaseEntity *pPlayer ); |
Ok, that declares our new function for choosing spawn points. You need to also declare it in gamerules.cpp, so add under the includes:
| | extern edict_t *EntSelectTeamSpawnPoint( CBaseEntity *pPlayer ); |
Also in gamerules.cpp, in GetPlayerSpawnSpot():
| | edict_t *pentSpawnSpot = NULL; if (g_pGameRules->IsTeamplay()) pentSpawnSpot = EntSelectTeamSpawnPoint( pPlayer ); else
pentSpawnSpot = EntSelectSpawnPoint( pPlayer ); |
Just replace the old EntSelectSpawnPoint() with that.
Now for the big change. We need to add the body of the function to player.cpp, and at the top, add:
| | #include "teamplay_gamerules.h" |
Look for the old EntSelectSpawnPoint() and put our new function above or below it:
| | edict_t *EntSelectTeamSpawnPoint( CBaseEntity *pPlayer ) { CBaseEntity *pSpot; edict_t *player;
player = pPlayer->edict(); CBasePlayer *cbPlayer = (CBasePlayer *)pPlayer;
pSpot = g_pLastSpawn; for ( int i = RANDOM_LONG(1,5); i > 0; i-- ) { if (FStrEq(cbPlayer->m_szTeamName, TEAM1_NAME)) pSpot = UTIL_FindEntityByClassname( pSpot, "info_player_team1" ); else if (FStrEq(cbPlayer->m_szTeamName, TEAM2_NAME)) pSpot = UTIL_FindEntityByClassname( pSpot, "info_player_team2" ); else pSpot = UTIL_FindEntityByClassname( pSpot, "info_player_observer" ); }
if ( FNullEnt( pSpot ) ) {
if (FStrEq(cbPlayer->m_szTeamName, TEAM1_NAME)) pSpot = UTIL_FindEntityByClassname( pSpot, "info_player_team1" ); else if (FStrEq(cbPlayer->m_szTeamName, TEAM2_NAME)) pSpot = UTIL_FindEntityByClassname( pSpot, "info_player_team2" ); else pSpot = UTIL_FindEntityByClassname( pSpot, "info_player_observer" ); }
CBaseEntity *pFirstSpot = pSpot;
do { if ( pSpot ) { if ( IsSpawnPointValid( pPlayer, pSpot ) ) { if ( pSpot->pev->origin == Vector( 0, 0, 0 ) ) { if (FStrEq(cbPlayer->m_szTeamName, TEAM1_NAME)) pSpot = UTIL_FindEntityByClassname( pSpot, "info_player_team1" ); else if (FStrEq(cbPlayer->m_szTeamName, TEAM2_NAME)) pSpot = UTIL_FindEntityByClassname( pSpot, "info_player_team2" ); else pSpot = UTIL_FindEntityByClassname( pSpot, "info_player_observer" ); continue; }
goto ReturnSpot; } } if (FStrEq(cbPlayer->m_szTeamName, TEAM1_NAME)) pSpot = UTIL_FindEntityByClassname( pSpot, "info_player_team1" ); else if (FStrEq(cbPlayer->m_szTeamName, TEAM2_NAME)) pSpot = UTIL_FindEntityByClassname( pSpot, "info_player_team2" ); else pSpot = UTIL_FindEntityByClassname( pSpot, "info_player_observer" );
} while ( pSpot != pFirstSpot );
if ( !FNullEnt( pSpot ) ) { CBaseEntity *ent = NULL; while ( (ent = UTIL_FindEntityInSphere( ent, pSpot->pev->origin, 128 )) != NULL ) { if ( ent->IsPlayer() && !(ent->edict() == player) ) ent->TakeDamage( VARS(INDEXENT(0)), VARS(INDEXENT(0)), 300, DMG_GENERIC ); } goto ReturnSpot; }
ReturnSpot: if ( FNullEnt( pSpot ) ) { ALERT(at_error, "PutClientInServer: no spawn points on level"); return INDEXENT(0); }
g_pLastSpawn = pSpot; return pSpot->edict(); } |
That should do it, now compile a map with your team spawn points, and you observer points, and Frag away! |
|
User Comments
prev ( [1] 2 ) next
Showing comments 1-20
Be sure to check for grammatical errors and typos, I found quite a number (well, 2) of them.
First, got to subs.cpp Look for this line... (Grammatical Error)
#include "templay_gamerules.h" (That would result in an error) |
|
I recommend a few changes... For observers, have it look for
"info_player_observer", if it cant find that, make it look for
"info_player_deathmatch" and then "info_player_start" ents, for
variation. It works quite nicely, I've tried it. Also, you might want
to have the part that kills clients that are on the spawn-point, you
should have it kill monsters too, if, that is your mod supports monsters
in MP. It's just generally a good idea to not have the player spawn
inside a gargantua or something...
Other than that, it's great. |
|
Jorkapp wrote: Be sure to check for grammatical errors and typos, I found quite a number (well, 2) of them.
First, got to subs.cpp Look for this line... (Grammatical Error)
#include "templay_gamerules.h" (That would result in an error)
umm, this sorts out the idiots, probably for the better to have it in there |
|
who exactly r u calling an idiot? |
|
I took it as the people who don't read the comments... hence the plural. I don't think it was an attack on you. |
|
oh, ok, I tried to fix the error but it wont show up! |
|
Any edits you make have to be re-approved by a moderator. Won't take long. |
|
OK, apparently I've screwed this up. I attempted to correct the other
spelling error, and now the board thinks I'm the author. *sigh*
Apologies, Put Put. I'll see if rkzad can fix it. Alternatively, you
could resubmit the article and I'll delete this one. |
|
Thank YOu, lol, I fixed the error myself, then sent it in to pending, so
ther ewas no need to look for it LOL. But thanx anyways |
|
I am getting
Linking... Creating library .\Profilemp/mp.lib and object .\Profilemp/mp.exp gamerules.obj
: error LNK2001: unresolved external symbol "struct edict_s * __cdecl
EntSelectSpawnPoint(class CBaseEntity *)"
(?EntSelectSpawnPoint@@YAPAUedict_s@@PAVCBaseEntity@@@Z) player.obj :
error LNK2001: unresolved external symbol "struct edict_s * __cdecl
EntSelectSpawnPoint(class CBaseEntity *)"
(?EntSelectSpawnPoint@@YAPAUedict_s@@PAVCBaseEntity@@@Z) .\Profilemp/mp.dll : fatal error LNK1120: 1 unresolved externals Error executing link.exe.
When I try to compile it.Edited by crazycoder on Aug 31 2003, 11:33:44
|
|
In GetPlayerSpawn Spot in gamerules.cpp did u replace
pentSpawnSpot = EntSelectSpawnPoint( pPlayer );
with
edict_t *pentSpawnSpot = NULL; if (g_pGameRules->IsTeamplay()) pentSpawnSpot = EntSelectTeamSpawnPoint( pPlayer ); else
pentSpawnSpot = EntSelectSpawnPoint( pPlayer ); |
|
yes
here is the line
/========================================================= //========================================================= edict_t *CGameRules :: GetPlayerSpawnSpot( CBasePlayer *pPlayer ) { edict_t *pentSpawnSpot = NULL; if (g_pGameRules->IsTeamplay()) pentSpawnSpot = EntSelectTeamSpawnPoint( pPlayer ); else
pentSpawnSpot = EntSelectSpawnPoint( pPlayer );
pPlayer->pev->origin = VARS(pentSpawnSpot)->origin + Vector(0,0,1); pPlayer->pev->v_angle = g_vecZero; pPlayer->pev->velocity = g_vecZero; pPlayer->pev->angles = VARS(pentSpawnSpot)->angles; pPlayer->pev->punchangle = g_vecZero; pPlayer->pev->fixangle = TRUE; return pentSpawnSpot; }
same error ;\Edited by crazycoder on Aug 31 2003, 23:41:02
|
|
Redo the tut , there might be someting missing |
|
I did it 3 times. no luck ;\ |
|
Okay when you make a tut to fix a tut, you should just tell the readers
to do the tut you are fixing. Then, tell them how to fix it. I will
write a fix that works at 3rdlife.net soon... |
|
if you fixed it, you should post a comment telling the other users how to fix it. |
|
'ages ago'... what? Two weeks ago you were asking how to fix it. And
yes, you should post the fix. That's the piont of this comment system.
|
|
prev ( [1] 2 ) next You must register to post a comment. If you have already registered, you must login.
|
297 Approved Articless
6 Pending Articles
3940 Registered Members
0 People Online (5 guests)
|
|