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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 08-01-2012, 05:46 AM
salmo salmo is offline
Approved Member
 
Join Date: Mar 2011
Posts: 632
Default

Looks suspiciusly like some of my old code, ya bastard! What Kodiak said, also below I've tidied up all those 'case' statements. You can add/remove speech lines by altering the appropriate speech string array in each section without having to change the sayToGroup code.

Code:
    public override void OnAircraftDamaged(int missionNumber, string shortName, AiAircraft aircraft, AiDamageInitiator initiator, part.NamedDamageTypes damageType)
    {
        base.OnAircraftDamaged(missionNumber, shortName, aircraft, initiator, damageType);

        // speech //   GetDamageVictims()
        AiAircraft initiator_aircraft = initiator.Actor as AiAircraft;
        if (initiator_aircraft != null)
        {
            if (speechTimer.Elapsed.Milliseconds > 1 && speechTimer.Elapsed.Seconds < 20)
            {   // timer is running & less than 20 seconds since last speech
                return;   // speech no more fequently than 20 secs apart.
            }
            else
            {
                speechTimer.Restart();
            }
            if (aircraft.Army() != initiator_aircraft.Army())
            {
                // shooting at enemy aircraft
                Timeout(3, () =>      // wait 3 seconds
                {
                    // shooting at enemy aircraft speech
                    string[] HitEnemyACSpeech = 
                    {
		        "Nice_shot",
		        "Good_shot_sir",
                        "Good_shooting",
                        "Good_show",
                        "Bullseye",
                        "Good_hits",
                        "Direct_hit"
	            };
                    sayToGroup(initiator_aircraft.AirGroup(), HitEnemyACSpeech[random.Next(HitEnemyACSpeech.GetLowerBound(0), HitEnemyACSpeech.GetUpperBound(0))]);
                });
            }
            else
            {
                //  shooting at a friendly aircraft
                // first verse
                if (random.Next(1, 100 + 1) < 75) // 25% chance of first verse
                {
                    // shooting at friendly aircraft speech
                    string[] HitFriendlyACSpeech = 
                    {
		         "Friendlies",
		         "Damn_what_are_you_doing",
                         "Damn1"
	             };
                    sayToGroup(initiator_aircraft.AirGroup(), HitFriendlyACSpeech[random.Next(HitFriendlyACSpeech.GetLowerBound(0), HitEnemyACSpeech.GetUpperBound(0))]);
                }
                //second verse 
                Timeout(2, () =>      // wait 2 seconds
                {
                    // shooting at friendly aircraft speech 2
                    string[] HitFriendlyACSpeech2 = 
                    {
		        "Cease_fire_shooting_at_friendly",
		        "Return_to_base_immediately_or_you_will_be_shot_down_",
                        "Watch_it_You_re_shooting_at_one_of_ours",
                        "Stop_fire", 
                        "Oh_my_God_Stop_Please_stop_Ooooaaaaahhh"
	            };
                    sayToGroup(initiator_aircraft.AirGroup(), HitFriendlyACSpeech2[random.Next(HitFriendlyACSpeech2.GetLowerBound(0), HitFriendlyACSpeech2.GetUpperBound(0))]);
                });
                // third verse
                Timeout(4, () =>      // wait 4 seconds
                {
                    if (random.Next(1, 100 + 1) < 75) // 25% chance of third verse
                    {
                        // shooting at friendly aircraft speech 3
                        string[] HitFriendlyACSpeech3 = 
                    {
		        "That_is_without_a_doubt_the_worst_flying_I_have_ever_seen",
		        "Return_to_base_immediately_or_you_will_be_shot_down_",
                        "Cannot_do_anything_right_today_can_you"
	            };
                        sayToGroup(initiator_aircraft.AirGroup(), HitFriendlyACSpeech3[random.Next(HitFriendlyACSpeech3.GetLowerBound(0), HitFriendlyACSpeech3.GetUpperBound(0))]);
                    }
                });
            }
        }
    }
__________________
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; 08-01-2012 at 05:59 AM.
Reply With Quote
 


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 07:20 PM.


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