PDA

View Full Version : cuestion for a scrip


melasuda
07-15-2012, 11:04 AM
Hi all.

I have one cuestion.

Can i create 3 or 4 AI groups using only one target pass army trigger ?.

If the answer is yes, can anyone send my the script?

THX

FG28_Kodiak
07-15-2012, 11:44 AM
Yes it's possible.


using System;
using System.Collections;
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("YourTriggerName"))
{

List<string> actions = new List<string>{"Action1", "Action2", "Action3", "Action4"};

actions.ForEach(item => {
AiAction action = GamePlay.gpGetAction(item);
if (action != null)
action.Do();
});
GamePlay.gpGetTrigger(shortName).Enable = false; // to avoid multible activations
}
}


}

change "YourTriggerName" and the action names in {"Action1", "Action2", "Action3", "Action4"} to your needs.

melasuda
07-15-2012, 04:46 PM
Thanks bery much:grin::grin: