Fulqrum Publishing Home   |   Register   |   Today Posts   |   Members   |   UserCP   |   Calendar   |   Search   |   FAQ

Go Back   Official Fulqrum Publishing forum > Fulqrum Publishing > IL-2 Sturmovik: Cliffs of Dover > FMB, Mission & Campaign builder Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 07-17-2012, 02:54 PM
pupo162 pupo162 is offline
Approved Member
 
Join Date: Feb 2010
Posts: 1,188
Default OnActorDead - Damage DS

SO ehre i am back to scripting after giving up to focus on studying.

im tryign to create a scrip who counts for point when a palne gets killed (for now).

to start:

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

AiAircraft aircraft = actor as AiAircraft;

//for (int i = 0; i < aircraft.Places(); i++)
//{
// if (aircraft.Player(i) != null)
// {
// // TODO: Account for more than one player in an aircraft
// player = aircraft.Player(i);
// break;
// }
//}

int value = 0;


foreach (DamagerScore ds in damages)
{

if (actor is AiPerson) break; // At moment Pilotkills are not counted

if (actor is AiGroundActor) break; // At moment Groundkills are not counted

if (actor is AiAircraft)
{
switch (aircraft.Army())
{
case 1:
if (rafa.TryGetValue((aircraft as AiAircraft).InternalTypeName(), out value))
{
bluescore = bluescore + rafv[(aircraft as AiAircraft).InternalTypeName()];
//GamePlay.gpHUDLogCenter(new Player[] { player }, "You DIED!, {0} : LOST!", new object[] { SplitName((aircraft as AiAircraft).InternalTypeName()) });
GamePlay.gpHUDLogCenter("ola");
}

break;

case 2:
if (lwa.TryGetValue((aircraft as AiAircraft).InternalTypeName(), out value))
{
redscore = redscore + lwv[(aircraft as AiAircraft).InternalTypeName()];
//GamePlay.gpHUDLogCenter(new Player[] { player }, "You DIED!, {0} : LOST!", new object[] { SplitName((aircraft as AiAircraft).InternalTypeName()) });
GamePlay.gpHUDLogCenter("ola");
}
break; ;
}

}
}
}

I really dony understand, how Damagerscore list works, so where i am requesting your aid.

for now, my problems are: AI is not counted as destoyed, if i crash my plane is ok, but if an AI shoots me down it dobles the score ( im guessing its becosue im not specifin initiator or reciever of the damage. I based myself on the code From "Mid-july1940_v10" mission, who looks like:

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

//////////////////Penalty

if (actor is AiPerson)
{
if ((actor as AiPerson).Player() != null) // Player is Human
{
GamePlay.gpLogServer(null, "{0} - KIA", new object[] { (actor as AiPerson).Player() });
PilotsInGame.AddDeathToPlayer((actor as AiPerson).Player());
}
}

//////////////////Namen Anzeigen beim zerstören von Bodeneineihten

if ((actor as AiGroundActor) != null && damages[0].initiator.Player != null)
GamePlay.gpLogServer(null, "{0} was destroyed by {1}", new object[] { (actor as AiCart).InternalTypeName().Substring(4), (damages[0].initiator.Player.Name()) });

///////////////////////////Punkte für zerstörte Einheiten
foreach (DamagerScore ds in damages)
{
int Addpoints = 0;
int value;
bool willReportDead = false;
string TargetName = "";

if (ds.initiator != null)
{
if (ds.initiator.Actor != null)
{
if (actor is AiPerson) break; // At moment Pilotkills are not counted

if (actor is AiAircraft)
{

if (PointsforAirTargets.TryGetValue((actor as AiAircraft).Type().ToString(), out value)) // Erstetzt wegen Stukaproblem
Addpoints = PointsforAirTargets[(actor as AiAircraft).Type().ToString()];

TargetName = SplitName((actor as AiAircraft).InternalTypeName());

value = 0;

if (actor.Army() == ArmyRed)
{
BlueAirKills++;

if (RAFAvailableAirplanes.TryGetValue((actor as AiAircraft).InternalTypeName(), out value))
{
RAFAvailableAirplanes[(actor as AiAircraft).InternalTypeName()] = value - 1;
TargetName += " (" + RAFAvailableAirplanes[(actor as AiAircraft).InternalTypeName()].ToString() + " available)"; // Shows Counter for Planetype
}
}

else if (actor.Army() == ArmyBlue)
{
RedAirKills++;
if (LWAvailableAirplanes.TryGetValue((actor as AiAircraft).InternalTypeName(), out value))
{
LWAvailableAirplanes[(actor as AiAircraft).InternalTypeName()] = value - 1;
TargetName += " (" + LWAvailableAirplanes[(actor as AiAircraft).InternalTypeName()].ToString() + " available)"; // Shows Counter for Planetype
}

}
}

if (actor is AiGroundActor)
{
if (PointsforGroundTargets.TryGetValue((actor as AiGroundActor).Type(), out value))
Addpoints = PointsforGroundTargets[(actor as AiGroundActor).Type()];

TargetName = SplitName((actor as AiGroundActor).InternalTypeName());
}



willReportDead = true;

if (ds.initiator.Actor.Army() == ArmyBlue)
{
BlueGrdKills++;
ScoreBlue += Addpoints;
if (Addpoints <=0)
{ScoreBlue += 3;}
GamePlay.gpLogServer(null, "Britisch {0} destroyed - Team scores now: RAF {1}- LW {2}", new object[] { TargetName, ScoreRed, ScoreBlue });
break;
}
else if (ds.initiator.Actor.Army() == ArmyRed)
{
RedGrdKills++;
ScoreRed += Addpoints;
if (Addpoints <=0)
{ScoreRed += 3;}
GamePlay.gpLogServer(null, "German {0} destroyed - Team scores now: RAF {1}- LW {2}", new object[] { TargetName, ScoreRed, ScoreBlue });
break;

}
}
}
}
this code, had a problem when directly copy paste, it wouldnt count Friendly kills nor, if i crashed myself.

so ... help? please?
Reply With Quote
  #2  
Old 10-11-2012, 01:50 AM
salmo salmo is offline
Approved Member
 
Join Date: Mar 2011
Posts: 632
Default

Bump here. Can anyone explain damages score please?

Code removed by author
__________________
When one engine fails on a two engine bomber, you will always have enough power left to get to the scene of the crash.

Get the latest COD Team Fusion patch info HERE

Last edited by salmo; 10-18-2012 at 09:07 AM.
Reply With Quote
  #3  
Old 10-11-2012, 04:33 AM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Add all Values in the damagerlist together, then you have the 100%. Then divide
part damagerscore / 100% Value = Percent
Reply With Quote
  #4  
Old 10-11-2012, 04:57 AM
salmo salmo is offline
Approved Member
 
Join Date: Mar 2011
Posts: 632
Default

Quote:
Originally Posted by FG28_Kodiak View Post
Add all Values in the damagerlist together, then you have the 100%. Then divide
part damagerscore / 100% Value = Percent
Thanks Kodiak. I must be doing something wrong then. I have the following code which return values like "DamagerScore Total: 47.7" or "DamagerScore Total: 76.39999" or "DamagerScore Total: 53.3".Ideas?

Code removed by author
__________________
When one engine fails on a two engine bomber, you will always have enough power left to get to the scene of the crash.

Get the latest COD Team Fusion patch info HERE

Last edited by salmo; 10-18-2012 at 09:08 AM.
Reply With Quote
  #5  
Old 10-11-2012, 05:24 AM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

No nothing wrong, after this you have the 100% Value.

Example
4 damagersscores (12, 1, 16, 5)
12 + 1 + 16 + 5 = 34

to get the percentual part of a single damager
12/34 = 0,353 (35,3%)
1/34 = 0,029 (2,9%)
16/34 = 0,471 (47,1%)
5/34 = 0,147 (14,7%)
controll:
0,353 + 0,029 + 0,471 + 0,147 = 1

So Damager 1 has made 35,3% of the damage, Damager 3 has done the most with 47,1%.
Reply With Quote
  #6  
Old 10-11-2012, 05:34 AM
salmo salmo is offline
Approved Member
 
Join Date: Mar 2011
Posts: 632
Default

Agh! Got it now So does the raw sum total damages give any indication of relative "strength" between actors then. ie.

Actor 1 dies .... total damages = 10
Actor 2 dies .... total dmaages = 100

Actor1 is 1/10 as strong as actor 2?
__________________
When one engine fails on a two engine bomber, you will always have enough power left to get to the scene of the crash.

Get the latest COD Team Fusion patch info HERE
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:12 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.