[page=Introduction]
Weapons, weapons, weapons. What's with all the ultraviolence? Let's look forward and try something that might be useful for cooperative play.
If I had to guess, I would think Quake2 co-op play will be a lot like Quake.. Darn it, it's just not cool. This time you're in a platoon and you will exit as such!
Here's what we'll do. When a player attempts to trigger the exit, we'll only allow it when all the players are near the exit. We're going to add a new console variable (cvar) called coopexit to control this behavior, sort of like a deathmatch flag.
[page=Cvar]
Here we go!
Find these in g_local.h:
extern cvar_t *sv_cheats;
extern cvar_t *maxclients;
Let's add these:
// Paril - New console variable
extern cvar_t *coopexit;
Now, to g_main.c, near the beginning, find:
cvar_t *sv_cheats;
Add:
// Paril - Added this
cvar_t *coopexit;
Now, in g_save.c, find
bob_pitch = gi.cvar ("bob_pitch", "0.002", 0);
bob_roll = gi.cvar ("bob_roll", "0.002", 0);
Add this:
//Paril: New console variable
coopexit = gi.cvar("coopexit", "0", CVAR_SERVERINFO|CVAR_LATCH);
To g_targets.c!
[page=The Target]
Find:
void use_target_changelevel (edict_t *self, edict_t *other, edict_t *activator)
{
We're changing the beginning to this:
void use_target_changelevel (edict_t *self, edict_t *other, edict_t *activator)
{
// Paril: A few local variables for coopexit
float radius;
edict_t *ent = NULL;
int i;
vec3_t v;
if (level.intermissiontime)
return; // allready activated
// Paril: If coopexit is on, only exit when all players are at exit
if (coopexit->value)
{
radius = level.players * 100;
for (i=0; ivalue; i++)
{
ent = g_edicts + 1 + i;
if (!ent->inuse || !ent->client)
continue;
VectorSubtract(activator->s.origin, ent->s.origin, v);
if (VectorLength(v) > radius)
return;
}
}
If coopexit is set, we determine an 'exit radius' according to the number of players and then run through the players with the for loop. For the active players, we check their distance from the exit activator and, if we find one that's outside the radius, we return without letting them exit!
Nice tutorial.
Thank you :)
n1 tut! thX
AH HEE HEE! xD
Hi to you all!
i would like to know how can i make my hl2mp server work fine with coop maps like js_coop, and coop_??????, my maps do not show fastzombie and crash always, is there anything i must put in the server or is there any tutorial i can get and fix my server?
thanks a lot for your support, and excuse for the question, may be it is not the right place to ask.
preciate any help...
thanks alot this really helped im new to the site and well i didnt know how to create mods i knew what they were but i didnt know enough to create one so basically anyone can create a mod by his or her self without a team? or did i get it wrong?