PDA

View Full Version : need help pls - mapvote / iprintlnbold / assist kills



ORDI
29th January 2015, 18:55
hello everybody, i have 3 things to say
first of all: i searched since a lot of weeks to solve my errors, some errors are now solved but some where i need you :D

my first problem is about _mapvote.gsc (i took the classic mapvote here).
it does not load.
i placed the 2 threads in the gametypes:
-thread maps\mp\gametypes\_mapvote::init(); in main()
-maps\mp\gametypes\_mapvote::initialize(); in endmap()

second problem is about many iprintlnbold which appears many times and in script, i writed him only 1 time. (what is the origin of the problem)?

and the third isn't a problem, i just want to know what is called the function or script for:
when a player help the killer to kill the zombie
thank you to read
ORDI
xfire: ordi37zk

guiismiti
29th January 2015, 22:27
About mapvote - check if you have to turn scr_mapvote 1 or something like that. I used mapvote once and I had to enable it.
Also, where exactly are you placing it in endmap()?

We need to know exactly where you wrote that iprintlnbold. You gave us no information on that.

As for the third, you're basically gonna have to edit the callbackPlayerDamage and callbackPlayerKilled functions (or whatever it's called).
I have never checked that kind of script. I would create a new vector for each player. This vector will contain how much damage each one of the other players dealt to this player. You just gotta reset it or part of it in some occasions - like in map changes, when a player disconnects, when the player disconnects and when the player gets killed.

Tally
30th January 2015, 08:43
about the iprintlnbold() - you either have it in a loop, or you are threading to the function more than once, and therefore have several instances of the function running: it will produce more than 1 iprintlnbold(). Check to make sure you only have 1 function running.

kung foo man
31st January 2015, 02:37
About the assist kills, wrote that script once for zombots:

on player damage:


zombie utils\assist::ASSIST_add(iDamage, eAttacker);


on player kill:


// zombie ASSIST_do_scores();

player = zombie;
if (isDefined(player.assistKills))
{

helpingHands = player.assistKills.size - 1;

for (i=0; i<player.assistKills.size; i++)
{
// assist-killer leaved...
if (!isDefined(player.assistKills[i].causer))
continue;

partDamage = player.assistKills[i].damage;
full = player.maxhealth;
percent = partDamage/(full/100);

//moneyForKill = mod\config::CONFIG_moneyForKill();
moneyForKill = zombie.points;
coins = moneyForKill * (percent/100);

percent = int(percent);
coins = int(coins);

//player.assistKills[i].causer mod\player::addMoney(coins); // looks ugly with 1.33333, but better round it in hud-management...
player.assistKills[i].causer.score++;
player.assistKills[i].causer utils\money::addMoney(coins);

//player.assistKills[i].causer iprintlnbold("^1" + percent + " ^1P^7ercent ^1o^7f ^1" + player.maxhealth + " ^1H^7ealth ^7= ^1" + coins + "^7$");
/*
if (player.assistKills[i].causer == attacker)
{
//if (player.assistKills[i].causer isKung())
player.assistKills[i].causer iprintlnbold("^1K^7ILL ^1(^7"+percent+" ^1P^7ercent^1)^7! ^1H^7elping ^1H^7ands: "+helpingHands + " ^1C^7oins: ^1+^7"+coins);
} else {
//if (player.assistKills[i].causer isKung())
player.assistKills[i].causer iprintlnbold("^1A^7SSIST-^1K^7ILL ^1(^7"+percent+" ^1P^7ercent^1)^7! ^1H^7elping ^1H^7ands: "+helpingHands + " ^1C^7oins: ^1+^7"+coins);
}
*/
}
// clear them...
player.assistKills = undefined;
}


utils/assist.gsc


ASSIST_add(iDamage, eAttacker)
{
entity = self;

if (entity.health <= 0)
{
//iprintln("entity.health <= 0");
return;
}

// example 1:
// health of zombie = 200/400
// damage = 100
// causedDamage = 100

// example 2:
// health of zombie = 200/400
// damage = 300
// causedDamage = 200

causedDamage = iDamage;
if (causedDamage > entity.health)
causedDamage = entity.health;

//kung iprintln("causedDamage="+causedDamage + " iDamage="+iDamage + " enemyHealth="+player.health);

if (!isDefined(entity.assistKills))
entity.assistKills = [];

// caused the eAttacker already an assistKill?
causedAssistKill = -1; // -1 = no assist kill
for (i=0; i<entity.assistKills.size; i++)
{
if (!isDefined(entity.assistKills[i].causer)) // left server
continue;
if (entity.assistKills[i].causer != eAttacker)
continue;
causedAssistKill = i;
break;

}

if (causedAssistKill == -1)
{
assistKill = spawnStruct();
assistKill.causer = eAttacker;
assistKill.damage = causedDamage;
entity.assistKills[entity.assistKills.size] = assistKill;
//iprintlnbold("New Assistkill! Damage: "+causedDamage);
} else {
entity.assistKills[i].damage += causedDamage;
//iprintlnbold("Added Damage! Now: "+entity.assistKills[i].damage);
}
}