View Full Version : Script play messages
I am trying use this (Bank's) script.
Script compile OK.
Aircraft (AI) is in mission (if his name are wrong the message ""SCRIPT ERROR: Aircraft not found"is displayed).
But nothing more happen... I suppose that this script is base on time (OnTickGame):
public override void OnTickGame() {
if (Time.tickCounter() == 300)
What mean this 300?
using System;
using maddox.game;
using maddox.game.world;
using maddox.GP;
public class Mission : AMission {
AiActor a1;
AiAircraft airc1;
public override void OnBattleStarted() {
base.OnBattleStarted();
a1 = GamePlay.gpActorByName("0:BoB_LW_KG54_Stab.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) {
double initTime = 0.0;
airc1.SayToGroup(airc1.AirGroup(), "1_mile");
Timeout(initTime += 5.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");
});
}
}
The OnTickGame event is called about 32 times every second. A command like if (Time.tickCounter() == 300) is testing whether there has been 300 ticks since the script started. ie the code below the IF statement will be executed after 300 ticks / 32 ticks per second = 9.37 seconds has elapsed.
Thank you. I will try this "OnTick" method.
I manage to this ting work - partially, some messages dont play - with
TPassThrough trigger, but for some reason the message is triggered
at start of mission, and not when the plane fly in some place...
:doh:
In another mission the same trigger work for messages when plane fly
in specif place, but dont spawn a secondary flight set in "Action"...
Or a trigger do only one action?
A lot of trial and (many) errors. :)
Sokol1
SoW Reddog
Dec-04-2013, 03:00
A lot of trial and (many) errors. :)
Yes. Yes indeedy! Welcome to my world! :thumbsup:
After more "99" errors: :-P
The "idea" is make a Fw.200 Condor make a emergency radio call for tower, what I get is:
using System;
using maddox.game;
using maddox.game.world;
using maddox.GP;
public class Mission : AMission
{
AiActor a1;
AiAircraft airc1;
public override void OnBattleStarted() {
base.OnBattleStarted();
a1 = GamePlay.gpActorByName("0:BoB_LW_KG54_I.100");
if (a1 == null) {
GamePlay.gpLogServer(null, "SCRIPT ERROR: Aircraft not found\n", new object[] { });
}
airc1 = (AiAircraft)a1;
}
public override void OnTrigger(int missionNumber, string shortName, bool active)
{
if ("trigger01".Equals(shortName) && active)
{
double initTime = 0.0;
Timeout(initTime += 5.0, () =>
{
airc1.SayToGroup(airc1.AirGroup(), "Condor");
});
Timeout(initTime += 2.0, () =>
{
airc1.SayToGroup(airc1.AirGroup(), "This_is_Home_base");
});
Timeout(initTime += 5.0, () =>
{
airc1.SayToGroup(airc1.AirGroup(), "This_Is_Commander");
});
Timeout(initTime += 2.0, () =>
{
airc1.SayToGroup(airc1.AirGroup(), "from_1_Flight");
});
Timeout(initTime += 5.0, () =>
{
airc1.SayToGroup(airc1.AirGroup(), "I_m_out_of_fuel");
});
Timeout(initTime += 5.0, () =>
{
airc1.SayToGroup(airc1.AirGroup(), "Damn");
});
Timeout(initTime += 1.0, () =>
{
airc1.SayToGroup(airc1.AirGroup(), "My_engine_s_dead");
});
}
}
}
For some reason callsing's (e.g. "Callsign3" = Barba Rossa are not played...
I remember that in "early" CLoD (1/2 patch) sometimes AI aircraft enter in spin and crash, now I need discover if is possible "teach" Condor pilot to do this. :D
Sokol1
now I need discover if is possible "teach" Condor pilot to do this.
well you could apply some damage to the Condor ?(using a trigger?):devilish: there's a rather nice selection of possible mischief to choose from:devilish::devilish:
public override void OnTrigger(int missionNumber, string shortName, bool active)
{
if (("trigger01".Equals(shortName) || "trigger02".Equals(shortName)) && active)
{
DoDamage();
}
GamePlay.gpGetTrigger(shortName).Enable = false;
}
private void DoDamage()
{
PlayerPlane = (AiAircraft)GamePlay.gpPlayer().Place();
PlayerPlane.hitNamed(part.NamedDamageTypes.Eng0Tot alFailure);
GamePlay.gpHUDLogCenter("Shit!!");
}
... For some reason callsing's (e.g. "Callsign3" = Barba Rossa are not played...
Many of the voice commands in the speech.txt file are broken. Several callsigns aslo don't work as voice anouncements.
Many of the voice commands in the speech.txt file are broken.
I find a easy way to "fix" Some:
http://theairtacticalassaultgroup.com/forum/showthread.php?t=7281&p=78156#post78156
Sokol1
well you could apply some damage to the Condor ?(using a trigger?):devilish: there's a rather nice selection of possible mischief to choose from:devilish::devilish:
public override void OnTrigger(int missionNumber, string shortName, bool active)
{
if (("trigger01".Equals(shortName) || "trigger02".Equals(shortName)) && active)
{
DoDamage();
}
GamePlay.gpGetTrigger(shortName).Enable = false;
}
private void DoDamage()
{
PlayerPlane = (AiAircraft)GamePlay.gpPlayer().Place();
PlayerPlane.hitNamed(part.NamedDamageTypes.Eng0Tot alFailure);
GamePlay.gpHUDLogCenter("Shit!!");
}
I try this script, but only "s*it!" part work. :D
What I missing?
Sokol1
What I missing?
probably the AI Aircraft being pointed to is wrong- need to change that to point to the FW200 you wish to damage- I just cut that bit from a campaign mission as an illustration of damage
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.