// ctf
set g_ctf 0 "Capture The Flag: take the enemy flag and bring it to yours at your base to score"
-set g_ctf_flag_returntime 15
+set g_ctf_flag_return_time 15
+set g_ctf_flag_return_dropped 100
+set g_ctf_flag_return_damage 0
+set g_ctf_flag_return_when_unreachable 1 "automatically return the flag if it falls into lava/slime/trigger hurt"
set g_ctf_flagcarrier_selfdamagefactor 1
set g_ctf_flagcarrier_selfforcefactor 1
set g_ctf_flagcarrier_damagefactor 1
set g_ctf_reverse 0 "if enabled, flags positions are switched: you have to capture the enemy's flag from your own base by bringing it to your own flag in the enemy base"
set g_ctf_flag_collect_delay 1
set g_ctf_flag_health 0
-set g_ctf_flag_take_damage 0
set g_ctf_flag_dropped_waypoint 2 "show dropped flag waypointsprite when a flag is lost. 1 = team only, 2 = for all players"
-set g_ctf_flag_pickup_verbosename 1 "show the name of the person who picked up the flag too"
-set g_ctf_flag_return_when_unreachable 1 "automatically return the flag if it falls into lava/slime/trigger hurt"
+set g_ctf_flag_pickup_verbosename 0 "show the name of the person who picked up the flag too"
set g_ctf_throw_velocity 700 "how fast or far a player can throw the flag"
set g_ctf_allow_pass 1 "allow passing of flags to nearby team mates"
set g_ctf_pass_radius 500 "maximum radius that you can pass to a team mate in"
float autocvar_g_ctf_flag_pickup_verbosename;
string autocvar_g_ctf_flag_red_model;
float autocvar_g_ctf_flag_red_skin;
-float autocvar_g_ctf_flag_returntime;
+float autocvar_g_ctf_flag_return_time;
float autocvar_g_ctf_flag_return_when_unreachable;
-float autocvar_g_ctf_flag_take_damage;
+float autocvar_g_ctf_flag_return_damage;
+float autocvar_g_ctf_flag_return_dropped;
float autocvar_g_ctf_flagcarrier_selfdamagefactor;
float autocvar_g_ctf_flagcarrier_selfforcefactor;
float autocvar_g_ctf_flagcarrier_damagefactor;
if(autocvar_g_ctf_flag_dropped_waypoint)
WaypointSprite_Spawn("flagdropped", 0, 0, flag, '0 0 64', world, ((autocvar_g_ctf_flag_dropped_waypoint == 2) ? 0 : player.team), flag, wps_flagdropped, FALSE, RADARICON_FLAG, '0 0.5 0' + ((flag.team == COLOR_TEAM1) ? '0.75 0 0' : '0 0 0.75')); // (COLOR_TEAM1 + COLOR_TEAM2 - flag.team)
- if(autocvar_g_ctf_flag_returntime || (autocvar_g_ctf_flag_take_damage && autocvar_g_ctf_flag_health))
+ if(autocvar_g_ctf_flag_return_time || (autocvar_g_ctf_flag_return_damage && autocvar_g_ctf_flag_health))
{
WaypointSprite_UpdateMaxHealth(flag.wps_flagdropped, flag.max_flag_health);
WaypointSprite_UpdateHealth(flag.wps_flagdropped, flag.health);
if(!flag) { return; }
if((droptype == DROP_PASS) && !reciever) { return; }
- //if(flag.speedrunning) { ctf_RespawnFlag(flag); return; }
+ if(flag.speedrunning) { ctf_RespawnFlag(flag); return; }
// reset the flag
setattachment(flag, world, "");
case PICKUP_DROPPED:
{
- pickup_dropped_score = (autocvar_g_ctf_flag_returntime ? bound(0, ((flag.ctf_droptime + autocvar_g_ctf_flag_returntime) - time) / autocvar_g_ctf_flag_returntime, 1) : 1);
+ pickup_dropped_score = (autocvar_g_ctf_flag_return_time ? bound(0, ((flag.ctf_droptime + autocvar_g_ctf_flag_return_time) - time) / autocvar_g_ctf_flag_return_time, 1) : 1);
pickup_dropped_score = floor((ctf_ReadScore("score_pickup_dropped_late") * (1 - pickup_dropped_score) + ctf_ReadScore("score_pickup_dropped_early") * pickup_dropped_score) + 0.5);
print("pickup_dropped_score is ", ftos(pickup_dropped_score), "\n");
PlayerTeamScore_AddScore(player, pickup_dropped_score);
{
if(flag.wps_flagdropped) { WaypointSprite_UpdateHealth(flag.wps_flagdropped, flag.health); }
- if((flag.health <= 0) || (time > flag.ctf_droptime + autocvar_g_ctf_flag_returntime))
+ if((flag.health <= 0) || (time > flag.ctf_droptime + autocvar_g_ctf_flag_return_time))
{
bprint("The ", flag.netname, " has returned to base\n");
sound(flag, CH_TRIGGER, flag.snd_flag_respawn, VOL_BASE, ATTN_NONE);
ctf_CheckFlagReturn(self);
}
- if(autocvar_g_ctf_flag_take_damage)
+ if(autocvar_g_ctf_flag_return_damage)
{
self.health = self.health - damage;
ctf_CheckFlagReturn(self);
case FLAG_DROPPED:
{
- if(autocvar_g_ctf_flag_returntime)
+ if(autocvar_g_ctf_flag_return_dropped)
{
- self.health -= ((self.max_flag_health / autocvar_g_ctf_flag_returntime) * FLAG_THINKRATE);
+ if((vlen(self.origin - self.ctf_spawnorigin) < autocvar_g_ctf_flag_return_dropped) || (autocvar_g_ctf_flag_return_dropped == -1))
+ {
+ self.health = 0;
+ ctf_CheckFlagReturn(self);
+ return;
+ }
+ }
+ if(autocvar_g_ctf_flag_return_time)
+ {
+ self.health -= ((self.max_flag_health / autocvar_g_ctf_flag_return_time) * FLAG_THINKRATE);
ctf_CheckFlagReturn(self);
+ return;
}
return;
}
flag.solid = SOLID_TRIGGER;
flag.takedamage = DAMAGE_NO;
flag.damageforcescale = autocvar_g_ctf_flag_damageforcescale;
- flag.max_flag_health = ((autocvar_g_ctf_flag_take_damage && autocvar_g_ctf_flag_health) ? autocvar_g_ctf_flag_health : 100);
+ flag.max_flag_health = ((autocvar_g_ctf_flag_return_damage && autocvar_g_ctf_flag_health) ? autocvar_g_ctf_flag_health : 100);
flag.health = flag.max_flag_health;
flag.event_damage = ctf_FlagDamage;
flag.pushable = TRUE;