float autocvar_g_ttt_warmup = 10;
bool autocvar_g_ttt_punish_teamkill = false;
bool autocvar_g_ttt_reward_innocent = true;
-//float autocvar_g_ttt_karma_points = 1000; //TODO: Karma points 21-02-2021
+float autocvar_g_ttt_max_karma_points = 1000; //LegendGuard sets Karma points 21-02-2021
+float autocvar_g_ttt_min_karma_points = 200;
+//TODO: when finished new cvars, add them to gamemodes-server.cfg 22-02-2021
//TODO: add Detective and corpse function if a player is DEAD
-//TODO: Problems: Detective is a created team, this team is added inside Innocents team
-// if there's a detective and a traitor and no innocent in the round, round ends.
+//TOFIX: Problems: Detective is a created team, this team is added inside Innocents team
+// when there's a detective and a traitor and no innocent in the round, round ends.
// detective shouldn't be attacked by innocent bots.
// detective should detect the point of the corpses (new function).
{
it.totalfrags += it.ttt_validkills;
if(it.ttt_validkills)
+ {
GameRules_scoring_add(it, SCORE, it.ttt_validkills);
+ }
+ //LOG_INFOF("^3it.karmapoints^7: ^8%f", it.karmapoints);
it.ttt_validkills = 0;
// player survived the round
if(IS_PLAYER(it) && !IS_DEAD(it)) //TODO: LegendGuard, add something for Karma if possible 21-02-2021
{
+ //TODO: Detective doesn't need scores, but if investigated a corpse maybe yes 22-02-2021
if(autocvar_g_ttt_reward_innocent && timed_out && it.ttt_status == TTT_STATUS_INNOCENT && it.ttt_status == TTT_STATUS_DETECTIVE)
+ {
GameRules_scoring_add(it, SCORE, 1); // reward innocents who make it to the end of the round time limit
+ float increasekarma = 25; //25 points lol //autocvar_g_ttt_max_karma_points * random() * ( 0.1 + random() ) );
+ PrintToChatAll(sprintf("^2REWARD ^7increasekarma: ^2%f", increasekarma));
+ GameRules_scoring_add(it, TTT_KARMA, increasekarma);
+ it.karmapoints = it.karmapoints + increasekarma;
+ PrintToChatAll(sprintf("^2REWARD ^7it.karmapoints: ^1%f", it.karmapoints));
+ if(it.karmapoints >= autocvar_g_ttt_max_karma_points)
+ {
+ //RESETS KARMAPOINTS TO MAINTAIN THE MAXIMUM
+ PrintToChatAll("^3REWARD ^1MAXIMUM RESET");
+ GameRules_scoring_add(it, TTT_KARMA, autocvar_g_ttt_max_karma_points - it.karmapoints);
+ it.karmapoints = autocvar_g_ttt_max_karma_points;
+ }
+ else if(it.karmapoints <= autocvar_g_ttt_min_karma_points)
+ PrintToChatAll("kick kick kick GET OUT!!");
+ }
if(it.ttt_status == TTT_STATUS_INNOCENT)
+ {
GameRules_scoring_add(it, TTT_RESISTS, 1);
+ float increasekarma = 50; //autocvar_g_ttt_max_karma_points * random() * ( 0.1 + random() ) );
+ PrintToChatAll(sprintf("^2INNOCENT ^7increasekarma: ^2%f", increasekarma));
+ GameRules_scoring_add(it, TTT_KARMA, increasekarma);
+ it.karmapoints = it.karmapoints + increasekarma;
+ PrintToChatAll(sprintf("^2INNOCENT ^7it.karmapoints: ^1%f", it.karmapoints));
+ if(it.karmapoints >= autocvar_g_ttt_max_karma_points)
+ {
+ //RESETS KARMAPOINTS TO MAINTAIN THE MAXIMUM
+ //PrintToChatAll("^3INNOCENT ^1MAXIMUM RESET");
+ GameRules_scoring_add(it, TTT_KARMA, autocvar_g_ttt_max_karma_points - it.karmapoints);
+ it.karmapoints = autocvar_g_ttt_max_karma_points;
+ }
+ else if(it.karmapoints <= autocvar_g_ttt_min_karma_points)
+ PrintToChatAll("kick kick kick GET OUT!!");
+ }
else if(it.ttt_status == TTT_STATUS_TRAITOR)
+ {
GameRules_scoring_add(it, TTT_HUNTS, 1);
+ float increasekarma = 50; //autocvar_g_ttt_max_karma_points * random() * ( 0.1 + random() ) );
+ PrintToChatAll(sprintf("^1TRAITOR ^7increasekarma: ^2%f", increasekarma));
+ GameRules_scoring_add(it, TTT_KARMA, increasekarma);
+ it.karmapoints = it.karmapoints + increasekarma;
+ PrintToChatAll(sprintf("^1TRAITOR ^7it.karmapoints: ^1%f", it.karmapoints));
+ if(it.karmapoints >= autocvar_g_ttt_max_karma_points)
+ {
+ //RESETS KARMAPOINTS TO MAINTAIN THE MAXIMUM
+ PrintToChatAll("^3TRAITOR ^1MAXIMUM RESET");
+ GameRules_scoring_add(it, TTT_KARMA, autocvar_g_ttt_max_karma_points - it.karmapoints);
+ it.karmapoints = autocvar_g_ttt_max_karma_points;
+ }
+ else if(it.karmapoints <= autocvar_g_ttt_min_karma_points)
+ PrintToChatAll("kick kick kick GET OUT!!");
+ }
}
});
}
FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it),
{
+ PrintToChatAll(sprintf("it.karmapoints ^5begin: ^3%f",it.karmapoints));
+ if(it.karmapoints <= 0)
+ {
+ //RESETS KARMAPOINTS WHEN MATCH STARTS
+ PrintToChatAll("^2ZERO RESET");
+ GameRules_scoring_add(it, TTT_KARMA, autocvar_g_ttt_max_karma_points - it.karmapoints);
+ it.karmapoints = autocvar_g_ttt_max_karma_points;
+ }
+ else if(it.karmapoints >= autocvar_g_ttt_max_karma_points)
+ {
+ //RESETS KARMAPOINTS TO MAINTAIN THE MAXIMUM
+ PrintToChatAll("^1MAXIMUM RESET");
+ GameRules_scoring_add(it, TTT_KARMA, autocvar_g_ttt_max_karma_points - it.karmapoints);
+ it.karmapoints = autocvar_g_ttt_max_karma_points;
+ }
+ else if(it.karmapoints <= autocvar_g_ttt_min_karma_points)
+ PrintToChatAll("kick kick kick GET OUT!!");
+ PrintToChatAll(sprintf("it.karmapoints ^6end: ^3%f",it.karmapoints));
+
if(it.ttt_status == TTT_STATUS_INNOCENT)
{
Send_Notification(NOTIF_ONE_ONLY, it, MSG_CENTER, CENTER_TTT_INNOCENT);
{
Send_Notification(NOTIF_ONE_ONLY, it, MSG_CENTER, CENTER_TTT_DETECTIVE); //Detective notification should be sent to all players to see who is
PrintToChatAll(sprintf("%s is ^4Detective^7!", it.netname));
- // Should notify in the center for everyone about who is Detective?
+ // LegendGuard asks a POLL: Should notify in the center for everyone about who is Detective?
//Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_TTT_DETECTIVE, 1);
}
GameRules_scoring(0, SFL_SORT_PRIO_PRIMARY, 0, {
field(SP_TTT_RESISTS, "resists", 0);
field(SP_TTT_HUNTS, "hunts", SFL_SORT_PRIO_SECONDARY);
- //field(SP_TTT_KARMA, "karma", autocvar_g_ttt_karma_points); //Karma points in the scoreboard
+ field(SP_TTT_KARMA, "karma", SFL_SORT_PRIO_SECONDARY); //LegendGuard adds Karma points in the scoreboard 22-02-2021
});
allowed_to_spawn = true;
MUTATOR_HOOKFUNCTION(ttt, ClientObituary)
{
+ // LegendGuard has an IDEA: To adjust the grade of severity of karma,
+ // we could add if sentence per weapons and adjust each weapon attack
+ // its own grade. Instead doing random decrease grade 22-02-2021
+
// in ttt, announcing a frag would tell everyone who the traitor is
entity frag_attacker = M_ARGV(1, entity);
entity frag_target = M_ARGV(2, entity);
- //.float karmapoints; //karma points for each player
if(IS_PLAYER(frag_attacker) && frag_attacker != frag_target)
{
float frag_deathtype = M_ARGV(3, float);
// unless the player is going to be punished for suicide, in which case just remove one
if(frag_attacker.ttt_status == frag_target.ttt_status)
{
- //PrintToChatAll("^1DEBUG^7: A ^2PLAYER^7 has fragged a ^2PLAYER OF HIS OWN TEAM^7, TOO BAD!");
+ PrintToChatAll("^1DEBUG^7: A ^2PLAYER^7 has fragged a ^2PLAYER OF HIS OWN TEAM^7, TOO BAD!");
+ float decreasekarma = -( autocvar_g_ttt_max_karma_points * random() * ( 0.1 + random() ) * 0.1 );
+ //PrintToChatAll(sprintf("decreasekarma: ^1%f", decreasekarma));
+ GameRules_scoring_add(frag_attacker, TTT_KARMA, decreasekarma);
+ frag_attacker.karmapoints = frag_attacker.karmapoints + decreasekarma;
+ //PrintToChatAll(sprintf("frag_attacker.karmapoints: ^1%f", frag_attacker.karmapoints));
GiveFrags(frag_attacker, frag_target, ((autocvar_g_ttt_punish_teamkill) ? -1 : -2), frag_deathtype, wep_ent.weaponentity_fld);
- //frag_attacker.karmapoints = frag_attacker.karmapoints - (autocvar_g_ttt_karma_points * random(0.9 * 0.1)); //karma points reduce when player attacked to other player //example: 1000 - (1000*(0.9*0.1)) = 910
+ if(frag_attacker.karmapoints <= autocvar_g_ttt_min_karma_points)
+ PrintToChatAll("kick kick kick GET OUT!!");
+ //MATH THEORY: example: 1000 * 0.3 * (0.1 + 0.4) * 0.1 // karma points reduce when player attacked to other player
}
if(frag_attacker.ttt_status == TTT_STATUS_DETECTIVE)
{
if (frag_target.ttt_status == TTT_STATUS_INNOCENT)
{
- PrintToChatAll("^7A ^4Detective^7 has fragged an ^2Innocent^7, TOO BAD!");
+ PrintToChatAll("^1DEBUG^7: A ^4Detective^7 fragged an ^2Innocent^7, TOO BAD!");
+ float decreasekarma = -( autocvar_g_ttt_max_karma_points * random() * ( 0.1 + random() ) * 0.1 );
+ //PrintToChatAll(sprintf("decreasekarma: ^1%f", decreasekarma));
+ GameRules_scoring_add(frag_attacker, TTT_KARMA, decreasekarma);
+ frag_attacker.karmapoints = frag_attacker.karmapoints + decreasekarma;
+ //PrintToChatAll(sprintf("frag_attacker.karmapoints: ^1%f", frag_attacker.karmapoints));
GiveFrags(frag_attacker, frag_target, ((autocvar_g_ttt_punish_teamkill) ? -1 : -2), frag_deathtype, wep_ent.weaponentity_fld);
+ if(frag_attacker.karmapoints <= autocvar_g_ttt_min_karma_points)
+ PrintToChatAll("kick kick kick GET OUT!!");
}
}
{
if (frag_target.ttt_status == TTT_STATUS_DETECTIVE)
{
- PrintToChatAll("^7An ^2Innocent^7 has fragged a ^4Detective^7, TOO BAD!");
+ PrintToChatAll("^1DEBUG^7: An ^2Innocent^7 fragged a ^4Detective^7, TOO BAD!");
+ float decreasekarma = -( autocvar_g_ttt_max_karma_points * random() * ( 0.1 + random() ) * 0.1 );
+ //PrintToChatAll(sprintf("decreasekarma: ^1%f", decreasekarma));
+ GameRules_scoring_add(frag_attacker, TTT_KARMA, decreasekarma);
+ frag_attacker.karmapoints = frag_attacker.karmapoints + decreasekarma;
GiveFrags(frag_attacker, frag_target, ((autocvar_g_ttt_punish_teamkill) ? -1 : -2), frag_deathtype, wep_ent.weaponentity_fld);
+ if(frag_attacker.karmapoints <= autocvar_g_ttt_min_karma_points)
+ PrintToChatAll("kick kick kick GET OUT!!");
}
}
//if ttt_status is 1, means innocent, 2 means traitor, 3 means detective, TODO: the bots: frag_attacker(1) shouldn't attack to frag_target(3)
{
if (frag_target.ttt_status == TTT_STATUS_INNOCENT)
{
- PrintToChatAll("^7^4DETECTIVE ^1DAMAGE/DEAD^7 HAS TAKEN!");
- //30 damage points deal
- Damage(frag_attacker, frag_attacker, frag_attacker, 300, DEATH_MIRRORDAMAGE.m_id, DMG_NOWEP, frag_attacker.origin, '0 0 0');
+ //PrintToChatAll("^1DEBUG^7: ^4DETECTIVE ^1DAMAGE/DEAD^7 HAS TAKEN!");
+ //50 damage points deal
+ Damage(frag_attacker, frag_attacker, frag_attacker, 50, DEATH_MIRRORDAMAGE.m_id, DMG_NOWEP, frag_attacker.origin, '0 0 0');
}
}
if (frag_attacker.ttt_status == TTT_STATUS_INNOCENT)
{
if (frag_target.ttt_status == TTT_STATUS_DETECTIVE)
{
- PrintToChatAll("^7^2INNOCENT ^1DAMAGE/DEAD^7 HAS TAKEN!");
- //30 damage points deal
- Damage(frag_attacker, frag_attacker, frag_attacker, 300, DEATH_MIRRORDAMAGE.m_id, DMG_NOWEP, frag_attacker.origin, '0 0 0');
+ //PrintToChatAll("^1DEBUG^7: ^2INNOCENT ^1DAMAGE/DEAD^7 HAS TAKEN!");
+ //50 damage points deal
+ Damage(frag_attacker, frag_attacker, frag_attacker, 50, DEATH_MIRRORDAMAGE.m_id, DMG_NOWEP, frag_attacker.origin, '0 0 0');
}
}
return true;
MUTATOR_HOOKFUNCTION(ttt, AddPlayerScore)
{
- //TODO: LegendGuard, try to add KARMA for score here if possible 21-02-2021
+ // add scorefield for scoreboard here
entity scorefield = M_ARGV(0, entity);
if(scorefield == SP_KILLS || scorefield == SP_DEATHS || scorefield == SP_SUICIDES || scorefield == SP_DMG || scorefield == SP_DMGTAKEN)
M_ARGV(1, float) = 0; // don't report that the player has killed or been killed, that would out them as a traitor!
MUTATOR_HOOKFUNCTION(ttt, BotShouldAttack)
{
- //TODO: LegendGuard, make bots attack to innocents vs traitors, detectives must be on innocents team 21-02-2021
+ //TODO: LegendGuard, try bots attack to innocents vs traitors, detectives must be on innocents team 21-02-2021
entity bot = M_ARGV(0, entity);
entity targ = M_ARGV(1, entity);