![]() |
|
#1
|
|||
|
|||
|
Hi,
I need a script to flash a screen message using a trigger, TTime. I tried with onticktime but there was alot of variation in the timings of the messages between different servers. I need it spelled out for me exactly like you would a child. |
|
#2
|
|||
|
|||
|
Code:
using System;
using System.Collections.Generic;
using maddox.game;
using maddox.game.world;
public class Mission : AMission
{
public override void OnBattleStarted()
{
base.OnBattleStarted();
MissionNumberListener = -1;
}
public override void OnTrigger(int missionNumber, string shortName, bool active)
{
base.OnTrigger(missionNumber, shortName, active);
if (shortName.Equals("TimerTriggerName"))
{
GamePlay.gpHUDLogCenter("yourMessage");
}
AiAction action = GamePlay.gpGetAction(ActorName.Full(missionNumber, shortName));
if (action != null)
{
action.Do();
}
}
}
|
|
#3
|
|||
|
|||
|
Would this be the same for a pass through trigger? Also, I would want the message to be sent to one side only.
For example, I want a group of blue AI bombers that once they pass a certain point a screen message would go for red saying that bombers were inbound. Last edited by notafinger!; 11-04-2012 at 04:15 PM. |
|
#4
|
|||
|
|||
|
Kodiak,
Thanks for your help once again. If I recall there was a piece of script to make this only trigger once, was there not? |
|
#5
|
|||
|
|||
|
Code:
using System;
using System.Collections.Generic;
using maddox.game;
using maddox.game.world;
public class Mission : AMission
{
public override void OnBattleStarted()
{
base.OnBattleStarted();
MissionNumberListener = -1;
}
public List<Player> GetAllPlayer()
{
List<Player> players = new List<Player>();
if (GamePlay.gpIsServerSingle())
if (GamePlay.gpPlayer()!= null)
players.Add(GamePlay.gpPlayer());
if (GamePlay.gpRemotePlayers()!= null)
players.AddRange(GamePlay.gpRemotePlayers());
return players;
}
public Player[] BlueSide()
{
if (GetAllPlayer().Exists(item => item.Army() == 2))
return GetAllPlayer().FindAll(item => item.Army() == 2).ToArray();
return null;
}
public Player[] RedSide()
{
if (GetAllPlayer().Exists(item => item.Army() == 1))
return GetAllPlayer().FindAll(item => item.Army() == 1).ToArray();
return null;
}
public override void OnTrigger(int missionNumber, string shortName, bool active)
{
base.OnTrigger(missionNumber, shortName, active);
if (shortName.Equals("TimerTriggerName"))
{
GamePlay.gpHUDLogCenter("yourMessage");
}
if (shortName.Equals("RedTriggerName"))
{
if (RedSide()!=null)
GamePlay.gpHUDLogCenter(RedSide(), "yourMessage");
}
if (shortName.Equals("BlueTriggerName"))
{
if (BlueSide() != null)
GamePlay.gpHUDLogCenter(BlueSide(), "yourMessage");
}
if (shortName.Equals("TPassThruTriggerName"))
{
AiAction action = GamePlay.gpGetAction(ActorName.Full(missionNumber, shortName));
if (action != null)
{
action.Do();
}
//Add this for deaktivate the tpassthru trigger
GamePlay.gpGetTrigger(shortName).Enable = false;
}
}
}
|
|
#6
|
|||
|
|||
|
Hi Kodiak, in this part of script:
PHP Code:
PHP Code:
have to be inside "if (shortName.Equals("TPassThruTriggerName"))" ? does it mean that action will be done only for TPassThruTrigger? Also deactivating trigger means to disable theme for good or after they invoked? PHP Code:
__________________
![]() Asus P6T V2 Deluxe, I7 930, 3x2 GB RAM XMS3 Corsair1333 Mhz, Nvidia Leadtek GTX 470, Acer 1260p screen projector, Track IR 4 OS ver5, Saitek Pro Flight Rudder, Saitek X52, Win 7 x64 ultimate |
|
#7
|
|||
|
|||
|
the action is only activated if the trigger is triggered, you can also place it outside if you like.
Quote:
In my case above the passthru tigger must be activated once. But you can disable a trigger at any time. For example you have two condition one win and one fail. Maybe the win condition is to destroy groundtargets and you use a TGroundDestroy trigger and the fail condition you must make it before the time is over. To avoid the activation of the second trigger you can disable it. Example: Code:
public override void OnTrigger(int missionNumber, string shortName, bool active)
{
base.OnTrigger(missionNumber, shortName, active);
if (shortName.Equals("TimerTriggerName"))
{
GamePlay.gpHUDLogCenter("You failed Time is over");
GamePlay.gpGetTrigger("GroundDestroyed").Enable = false;
}
if (shortName.Equals("GroundDestroyed"))
{
GamePlay.gpHUDLogCenter("You win you destroyed the Groundtargets");
GamePlay.gpGetTrigger("TimerTriggerName").Enable = false;
}
}
Last edited by FG28_Kodiak; 11-07-2012 at 03:00 PM. |
|
#8
|
||||
|
||||
|
Gruber, the script that I emailed you had pass through events triggering successfully. Did this not work?
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|