1C Home   |   Register   |   Today Posts   |   Members   |   UserCP   |   Calendar   |   Search   |   FAQ

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

Reply
 
Thread Tools Display Modes
  #1  
Old 09-16-2011, 11:45 AM
klem's Avatar
klem klem is offline
Approved Member
 
Join Date: Nov 2007
Posts: 1,651
Default Build/Play Messages using Scripting

I was wondering if it would be possible to use the Actor voices to give audible messages to players instead of those large across the screen texts to replace messages such as:
GamePlay.gpHUDLogCenter(new Player[] {player},"Stukas in sector A B 2 3")

This example would use the following files in:
....\parts\bob\speech\gb\Actor1\Stukas.ogg
....\parts\bob\speech\gb\Actor1\In_square.ogg
....\parts\bob\speech\gb\Actor1\A.ogg
....\parts\bob\speech\gb\Actor1\B.ogg
....\parts\bob\speech\gb\Actor1\2.ogg
....\parts\bob\speech\gb\Actor1\3.ogg

but I have no idea what scripting would be used.

Could perhaps be used with a Passthrough Trigger etc.

Could it be used as a general module to detect a Group entering a Sector and use that to send the audio? I know the RDF is supposed to do that but I have never been sure that it does it for anything other than AI.
__________________
klem
56 Squadron RAF "Firebirds"
http://firebirds.2ndtaf.org.uk/



ASUS Sabertooth X58 /i7 950 @ 4GHz / 6Gb DDR3 1600 CAS8 / EVGA GTX570 GPU 1.28Gb superclocked / Crucial 128Gb SSD SATA III 6Gb/s, 355Mb-215Mb Read-Write / 850W PSU
Windows 7 64 bit Home Premium / Samsung 22" 226BW @ 1680 x 1050 / TrackIR4 with TrackIR5 software / Saitek X52 Pro & Rudders
Reply With Quote
  #2  
Old 09-16-2011, 12:33 PM
FG28_Kodiak FG28_Kodiak is offline
Senior Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

You can use SayToGroup

maddox.game.world.AiAircraft
void SayToGroup(maddox.game.world.AiAirGroup group, string msg)
msg is the filename without ogg. (blue in de folder, red in gb folder) Different Aircrafts uses different voices (Actor1..4)

In my example the 'pilot' from Aircraft 0:BoB_LW_JG26_I.000 says "one mile" "Cargo Ships" "Destroy targets left to right" "Attack" (in German) to his group (for testing after ca.10sec, you can use triggers etc. also).

Code:
using System;
using maddox.game;
using maddox.game.world;


public class Mission : AMission
{

    AiActor a1;
    AiAircraft airc1;

    public override void OnBattleStarted()
    {
        base.OnBattleStarted();
        a1 = GamePlay.gpActorByName("0:BoB_LW_JG26_I.000");


        if (a1 == null)
        {
            GamePlay.gpLogServer(null, "SCRIPT ERROR: Aircraft not found\n", new object[] {});
        }

        airc1 = (AiAircraft)a1;
    }


    public override void OnTickGame()
    {
        if (Time.tickCounter() == 300) // ca 10sec.        
        {
            double initTime = 0.0;

            airc1.SayToGroup(airc1.AirGroup(), "1_mile");

            Timeout(initTime += 5.0, () =>
            {
                airc1.SayToGroup(airc1.AirGroup(), "Cargo_Ships");
            });
            Timeout(initTime += 5.0, () =>
            {
                airc1.SayToGroup(airc1.AirGroup(), "Destroy_targets_left_to_right");
            });
            Timeout(initTime += 5.0, () =>
            {
                airc1.SayToGroup(airc1.AirGroup(), "Attack");
            });
        }
    }
}

Last edited by FG28_Kodiak; 09-16-2011 at 01:21 PM.
Reply With Quote
  #3  
Old 09-18-2011, 07:20 AM
klem's Avatar
klem klem is offline
Approved Member
 
Join Date: Nov 2007
Posts: 1,651
Default

Quote:
Originally Posted by FG28_Kodiak View Post
You can use SayToGroup

maddox.game.world.AiAircraft
void SayToGroup(maddox.game.world.AiAirGroup group, string msg)
msg is the filename without ogg. (blue in de folder, red in gb folder) Different Aircrafts uses different voices (Actor1..4)

In my example the 'pilot' from Aircraft 0:BoB_LW_JG26_I.000 says "one mile" "Cargo Ships" "Destroy targets left to right" "Attack" (in German) to his group (for testing after ca.10sec, you can use triggers etc. also).

......................
Thanks Kodiak.

I'm still struggling with scripts and I don't know all the methods, objects etc although some, like script examples, are scattered across the web. Ataros has some links in his sig but many are translated German and leave me headscratching.

Am I right in thinking that Group identifier is from a FMB Group as listed in FMB's "View Mission Objects" or is it a player ID taking the Group identifier from the Squadron or JG that the player selected in-game?

As you can see I don't know how to identify all these things. I'm currently trying to work out how to send audible messages to All, Reds or Blues and possibly other groupings.

Actually it would be nice to have a Scripting Library sub-forum with a stickied Scripting Library where modules could be posted with a brief description of what they do so that laymen like me could cut and paste/minor-edit their missions, a stickied Scripting Requests thread and unstickied threads for discussion to keep the stickies clean. I think I'll put up a post about it.
__________________
klem
56 Squadron RAF "Firebirds"
http://firebirds.2ndtaf.org.uk/



ASUS Sabertooth X58 /i7 950 @ 4GHz / 6Gb DDR3 1600 CAS8 / EVGA GTX570 GPU 1.28Gb superclocked / Crucial 128Gb SSD SATA III 6Gb/s, 355Mb-215Mb Read-Write / 850W PSU
Windows 7 64 bit Home Premium / Samsung 22" 226BW @ 1680 x 1050 / TrackIR4 with TrackIR5 software / Saitek X52 Pro & Rudders
Reply With Quote
  #4  
Old 09-18-2011, 08:05 AM
Gamekeeper Gamekeeper is offline
Senior Member
 
Join Date: Oct 2007
Posts: 190
Default

Quote:
Originally Posted by klem View Post

Actually it would be nice to have a Scripting Library sub-forum with a stickied Scripting Library where modules could be posted with a brief description of what they do so that laymen like me could cut and paste/minor-edit their missions, a stickied Scripting Requests thread and unstickied threads for discussion to keep the stickies clean. I think I'll put up a post about it.
I have the barebones of a scripting library that forms part of our knowledge base and downloads system at airwarfare.

Using these facilities would be far more efficient than having files and info scattered across various threads and forums. The basic structure is in place and can be easily adapted to suit demand from contributors and users.
It is difficult to achieve this single handed as I am also involved in M4T so any help from experienced members here would be appreciated and indeed encourage me to spend more time building the resource.

Eventually we will have a well structured script library, where people can add their own articles/scripts and where information can be quickly retrieved, when it is available depends on the amount of assistance I can get from the community.
Reply With Quote
  #5  
Old 09-18-2011, 11:09 AM
FG28_Kodiak FG28_Kodiak is offline
Senior Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

@Klem

Quote:
Ataros has some links in his sig but many are translated German and leave me headscratching.
the germans are tutorials i made, but i think if i made them in english your head gonna to explode My english is very bad

There are three ways to get the plane Name:

In Game mouse rightclick then enable "show object names" then you can see the name of the plane in the plane list.

Or
Open the .mis file look for sections (for example):
[AirGroups]
BoB_RAF_F_141Sqn_Late.07
[BoB_RAF_F_141Sqn_Late.07]
Flight0 1 2 3 4
Flight1 11 12 13 14
Flight2 21 22 23 24

the Airgroup gets
0:BoB_RAF_F_141Sqn_Late.
and the postfix of the plane are are
Flight0: always counts from 000 to 00number of plane-1
so you can concat to:
0:BoB_RAF_F_141Sqn_Late.000
0:BoB_RAF_F_141Sqn_Late.001
0:BoB_RAF_F_141Sqn_Late.002
0:BoB_RAF_F_141Sqn_Late.003
Flight1: always counts from 010 to 01number of plane -1
0:BoB_RAF_F_141Sqn_Late.010
0:BoB_RAF_F_141Sqn_Late.011
0:BoB_RAF_F_141Sqn_Late.012
0:BoB_RAF_F_141Sqn_Late.013
Flight2: always counts from 020 to 02number of plane -1
0:BoB_RAF_F_141Sqn_Late.020
0:BoB_RAF_F_141Sqn_Late.021
0:BoB_RAF_F_141Sqn_Late.022
0:BoB_RAF_F_141Sqn_Late.023

or use a little script:
Code:
using System;
using maddox.game;
using maddox.game.world;


public class Mission : AMission
{

    public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex)
    {
        GamePlay.gpLogServer(null, "Player: {0} enter Plane: {1}\n", new object[] { player.Name(), actor.Name() });
    }
}
So select the plane you like and enter it with ALT+F1
so you get a chat message like:
Server: Player: Kodiak enter Plane: 0:BoB_RAF_F_141Sqn_Late.000
Server: Player: Kodiak enter Plane: 0:BoB_RAF_F_141Sqn_Late.003
Server: Player: Kodiak enter Plane: 0:BoB_RAF_F_141Sqn_Late.010
etc.

you can enable the log in conf.ini, also, so you can easy open the log.txt after all and copy the planename from it and paste it to your script.

Last edited by FG28_Kodiak; 09-18-2011 at 11:15 AM.
Reply With Quote
  #6  
Old 01-24-2012, 12:49 PM
Octocat Octocat is offline
Junior Member
 
Join Date: Dec 2011
Posts: 22
Default

Do SayToGroup affects on the AI behavior, or only play sounds in game?
Reply With Quote
  #7  
Old 01-24-2012, 05:08 PM
FG28_Kodiak FG28_Kodiak is offline
Senior Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

No only sound.
Reply With Quote
  #8  
Old 01-24-2012, 05:45 PM
5./JG27.Farber 5./JG27.Farber is offline
Senior Member
 
Join Date: Aug 2011
Posts: 1,958
Default

Quote:
Originally Posted by FG28_Kodiak View Post
@Klem


the germans are tutorials i made, but i think if i made them in english your head gonna to explode My english is very bad
I translated a few and put them on Airwarfare... They are on triggers though.
Reply With Quote
  #9  
Old 01-24-2012, 05:54 PM
Octocat Octocat is offline
Junior Member
 
Join Date: Dec 2011
Posts: 22
Default

Quote:
Originally Posted by FG28_Kodiak View Post
No only sound.
But my suggestion in Requests - about controlling AI behavior only. Useful feature, I think
Reply With Quote
  #10  
Old 01-24-2012, 06:32 PM
Ataros Ataros is offline
Senior Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,438
Default

Quote:
Originally Posted by Octocat View Post
But my suggestion in Requests - about controlling AI behavior only. Useful feature, I think
Maybe it is worth editing the post to emphasize this because BlackSix may not include it otherwise because of possible confusion.
Reply With Quote
Reply

Thread Tools
Display Modes

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 03:21 AM.

Based on a design by: Miner Skinz.com

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright © 2007 1C Company. All rights reserved.