Official 1C Company forum

Official 1C Company forum (http://forum.1cpublishing.eu/index.php)
-   FMB, Mission & Campaign builder Discussions (http://forum.1cpublishing.eu/forumdisplay.php?f=203)
-   -   Build/Play Messages using Scripting (http://forum.1cpublishing.eu/showthread.php?t=26245)

klem 09-16-2011 12:45 PM

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.

FG28_Kodiak 09-16-2011 01:33 PM

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");
            });
        }
    }
}


klem 09-18-2011 08:20 AM

Quote:

Originally Posted by FG28_Kodiak (Post 336854)
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.

Gamekeeper 09-18-2011 09:05 AM

Quote:

Originally Posted by klem (Post 337611)

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.

FG28_Kodiak 09-18-2011 12:09 PM

@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 :rolleyes:

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.

Octocat 01-24-2012 01:49 PM

Do SayToGroup affects on the AI behavior, or only play sounds in game?

FG28_Kodiak 01-24-2012 06:08 PM

No only sound.

5./JG27.Farber 01-24-2012 06:45 PM

Quote:

Originally Posted by FG28_Kodiak (Post 337675)
@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 :rolleyes:

I translated a few and put them on Airwarfare... They are on triggers though.

Octocat 01-24-2012 06:54 PM

Quote:

Originally Posted by FG28_Kodiak (Post 383972)
No only sound.

But my suggestion in Requests - about controlling AI behavior only. Useful feature, I think :cool:

Ataros 01-24-2012 07:32 PM

Quote:

Originally Posted by Octocat (Post 383991)
But my suggestion in Requests - about controlling AI behavior only. Useful feature, I think :cool:

Maybe it is worth editing the post to emphasize this because BlackSix may not include it otherwise because of possible confusion.


All times are GMT. The time now is 07:50 AM.

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