#1
|
||||
|
||||
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 |
#2
|
|||
|
|||
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 02:21 PM. |
#3
|
||||
|
||||
Quote:
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 |
#4
|
|||
|
|||
Quote:
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. |
#5
|
|||
|
|||
@Klem
Quote:
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 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 12:15 PM. |
#6
|
|||
|
|||
Do SayToGroup affects on the AI behavior, or only play sounds in game?
|
#7
|
|||
|
|||
No only sound.
|
#8
|
|||
|
|||
I translated a few and put them on Airwarfare... They are on triggers though.
|
#9
|
|||
|
|||
But my suggestion in Requests - about controlling AI behavior only. Useful feature, I think
|
#10
|
|||
|
|||
Maybe it is worth editing the post to emphasize this because BlackSix may not include it otherwise because of possible confusion.
|
|
|