PDA

View Full Version : Need Help - counting kills for each pilot on server



E69_pupo
May-20-2013, 06:11
Hello gents!

i've pretty much finished a mission that i will launch the 30 of may. the only thing that is not working that would be nice to have working for this mission is giving kills to pilots. the mission can easely keep track of kills for the entire team, but everyone likes to check out how many did they got at the end of the mission.

this is what i have for that particular scenario



public override void OnActorDead(int missionNumber, string shortName, AiActor actor, List<DamagerScore> damages)
{
base.OnActorDead(missionNumber, shortName, actor, damages);
if (actor is AiAircraft)

{
foreach (DamagerScore ds in damages)

if (ds.initiator != null)
{

if (ds.initiator.Actor != null)
{

foreach (pilotstat pd in pilotlist) // pilotstat is a list, snafu created and i stole it :P,
{

string message = "ds: " + ds.initiator.Actor + "\t" + pd.Pilot + "";
writelog(message); // this is just a log creator, wich writes down each ds.initator.actor followed by the pilot who its comparing to.

if (pd.Pilot == ds.initiator.Actor)
{
pd.Kills++; // this part of the code is not reached :(
GamePlay.gpHUDLogCenter("ola!");
}
}
}
}
}



the log result of the following is



[2013_05_19_20_29_50] ds: bHrtSeS5ue7OJcbn.QNZcpr86RVM 2E76W4XSdm.CuIiei6YyY9lagOd3Tq
[2013_05_19_20_29_50] ds: bHrtSeS5ue7OJcbn.QNZcpr86RVM 2E76W4XSdm.CuIiei6YyY9lagOd3Tq


meaning there are 2 Ds.initators, both "bHrtSeS5ue7OJcbn.QNZcpr86RVM", none is actually me, who is given the name "2E76W4XSdm.CuIiei6YyY9lagOd3Tq"
Ive noticed that every time i run this test, even when the kill is AI, the DS initiator is always "bHrtSeS5ue7OJcbn.QNZcpr86RVM". I suspect this DS.initiator is the ground, since all planes eventually crash.

so, any tips how to get this working?

cheers

Osprey
May-20-2013, 11:57
Wild Willie's ClodCommander should do this for you, runs on the server and uses a database.

http://forum.1cpublishing.eu/showthread.php?t=30853

Never set it up myself though so I can't tell you how it works

E69_pupo
May-20-2013, 16:59
thats not what im looking for osprey, i want the script to the math on the inside without adding another program into it.

Tough this CLOD commander thingy might come in handy if i ever decide to set a server myself.

SG1_sandokito
May-20-2013, 17:46
I use cod comander on my server, but whit last TFpach no work.:(

E69_pupo
May-20-2013, 18:17
well solved it!

where i had

if (pd.Pilot == ds.initiator.Actor)

now i have

if (pd.Pilot == ds.initiator.Player)

Salmo
May-20-2013, 18:20
Hello gents!

i've pretty much finished a mission that i will launch the 30 of may. the only thing that is not working that would be nice to have working for this mission is giving kills to pilots. the mission can easely keep track of kills for the entire team, but everyone likes to check out how many did they got at the end of the mission.

this is what i have for that particular scenario



the log result of the following is



meaning there are 2 Ds.initators, both "bHrtSeS5ue7OJcbn.QNZcpr86RVM", none is actually me, who is given the name "2E76W4XSdm.CuIiei6YyY9lagOd3Tq"
Ive noticed that every time i run this test, even when the kill is AI, the DS initiator is always "bHrtSeS5ue7OJcbn.QNZcpr86RVM". I suspect this DS.initiator is the ground, since all planes eventually crash.

so, any tips how to get this working?

cheers

Not sure exactly what pilotlist is holding, but it looks like you might have missed placing a { after the foreach (DamagerScore ds in damages) line. You could try the revised code below & see if it works.



public override void OnActorDead(int missionNumber, string shortName, AiActor actor, List<DamagerScore> damages)
{
base.OnActorDead(missionNumber, shortName, actor, damages);

if (actor is AiAircraft)
{
foreach (DamagerScore ds in damages)
{
if (ds.initiator != null && ds.initiator.Actor != null)
{
foreach (pilotstat pd in pilotlist) // pilotstat is a list, snafu created and i stole it ,
{
string message = "ds: " + ds.initiator.Actor + "\t" + pd.Pilot + "";
writelog(message); // this is just a log creator, wich writes down each ds.initator.actor followed by the pilot who its comparing to.

if (pd.Pilot == ds.initiator.Actor)
{
pd.Kills++; // this part of the code is not reached
GamePlay.gpHUDLogCenter("ola!");
}
}
}
}
}
}

E69_pupo
May-20-2013, 18:31
thanks Salmo. it was not a sintax error i nth ecode, i simply screwed the copy paste, since the actual code has about 100+ lines for actoractordead.

the problem was i was going trough the initiator.actor, and not initiator.player. hope this is usefull for those who come searching for the same issue

Osprey
May-22-2013, 10:23
I use cod comander on my server, but whit last TFpach no work.:(


It does work, read this:

http://forum.1cpublishing.eu/showthread.php?t=28017

SG1_sandokito
May-22-2013, 14:56
THX for link osprey, But no solvend the cuestion to my.

I not a programer and they not say how to solved the problem

Osprey
May-23-2013, 09:28
I don't think it's a programming thing, I think it's because the updated TF patch changes the working directory to "<path>\<foldername> - mod" so Clod commander can't find it anymore. It's a configuration problem. I don't know for sure, I've never set it up myself.

_79_dev
May-23-2013, 19:49
Clodcommander needs to be rebuilt to make it work with latest tf mod, there is an issuse with folder name which contain "-". if any of You need a copy of it let me onow, I will send updated version to You, just send me pm.

5./JG27 Vogler