Well in vanilla is not possible to have 2 tank movers in a map for a big reason:
The tag connection between the mover and the played is carried to clients in a config string and when u leave the tank this config string still alive. If u add another tank in the map ur tag connection used in the client will be the first actived connection not the current due unremoved config strings.
After few hours of minds i found the solution that i provide to u
1 - Write a G_RemoveConfigstringindex
2 - When u leave the tank or die call G_RemoveConfigstringindex
in g_utils.c add following code
/*
================
G_FindConfigstringIndex
================
*/
void G_RemoveConfigstringIndex( const char *name, int start, int max) {
int i, j;
char s[MAX_STRING_CHARS];
if ( !name || !name[0] ) {
return;
}
for ( i = 1 ; i < max ; i++)
{
trap_GetConfigstring( start + i, s, sizeof( s ) );
if ( !s[0] ) {
break;
}
if (strcmp( s, name ) == 0) {
trap_SetConfigstring( start + i, "");
for (j = i + 1; j < max - 1; j++)
{
trap_GetConfigstring( start + j, s, sizeof( s ) );
trap_SetConfigstring( start + j, "" );
trap_SetConfigstring( start + i, s );
}
break;
}
}
}
add the declaration somewhere in g_local.h
in g_combat.c: function player_die
void player_die(gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int meansOfDeath) {
int contents = 0, i, killer = ENTITYNUM_WORLD;
char *killerName = "<world>";
qboolean nogib = qtrue;
..........
....
.......
// Reset the CS_TAG
if (self->tagParent != NULL && self->tagName[0])
G_RemoveConfigstringIndex( va("%i %i %s", self->s.number, self->tagParent->s.number, self->tagName), CS_TAGCONNECTS, MAX_TAGCONNECTS);
if (attacker == self) {
in g_cmds.c
void G_LeaveTank(gentity_t* ent, qboolean position) {
gentity_t* tank;
// found our tank (or whatever)
vec3_t axis[3];
vec3_t pos;
trace_t tr;
tank = ent->tankLink;
if (!tank) {
return;
}
// Reset the CS_TAG
G_RemoveConfigstringIndex( va("%i %i %s", ent->s.number, ent->tagParent->s.number, ent->tagName), CS_TAGCONNECTS, MAX_TAGCONNECTS );
.......
Voila
Now mappers can add more tanks, don’t forget to add clipbrushes for each tank
Regards
