PDA

View Full Version : Disconnect: Clod commands and C#



69th_Spiritus_Mortem
Sep-21-2014, 13:55
So with my wings removed and my only taste of CloD coming from the forum here, I figured I could read up more about C# to improve my scripting knowledge.

This has created my biggest disconnect when it comes to scripting for missions.

C# and its language VS CloD and the commands the game will recognize.

For example, if I wanted to do X in CloD, wouldn't I have to know what X is in CloD before being able to type it in or is X always the same for C# usage.... meaning if I type X in C# not only will CloD see it, recognize it, and execute it but any other game using C# will see it, recognize it, and execute it if I typed it in to their files.

That doesn't make any sense to me. I feel like I can read all I want about C# and still not know shit without some database of CloD recognized commands to draw from.

What am I missing? I feel like an idiot.

bolox
Sep-21-2014, 18:45
these help?



protected AMission()
public virtual void Init(maddox.game.ABattle battle, int missionNumber)
public virtual void Inited()
public virtual bool IsMissionListener(int missionNumber)
public virtual void OnActorCreated(int missionNumber, string shortName, maddox.game.world.AiActor actor)
public virtual void OnActorDamaged(int missionNumber, string shortName, maddox.game.world.AiActor actor, maddox.game.world.AiDamageInitiator initiator, part.NamedDamageTypes damageType)
public virtual void OnActorDead(int missionNumber, string shortName, maddox.game.world.AiActor actor, System.Collections.Generic.List<DamagerScore> damages)
public virtual void OnActorDestroyed(int missionNumber, string shortName, maddox.game.world.AiActor actor)
public virtual void OnActorTaskCompleted(int missionNumber, string shortName, maddox.game.world.AiActor actor)
public virtual void OnAiAirNewEnemy(maddox.game.world.AiAirEnemyElemen t element, int army)
public virtual void OnAircraftCrashLanded(int missionNumber, string shortName, maddox.game.world.AiAircraft aircraft)
public virtual void OnAircraftCutLimb(int missionNumber, string shortName, maddox.game.world.AiAircraft aircraft, maddox.game.world.AiDamageInitiator initiator, part.LimbNames limbName)
public virtual void OnAircraftDamaged(int missionNumber, string shortName, maddox.game.world.AiAircraft aircraft, maddox.game.world.AiDamageInitiator initiator, part.NamedDamageTypes damageType)
public virtual void OnAircraftKilled(int missionNumber, string shortName, maddox.game.world.AiAircraft aircraft)
public virtual void OnAircraftLanded(int missionNumber, string shortName, maddox.game.world.AiAircraft aircraft)
public virtual void OnAircraftLimbDamaged(int missionNumber, string shortName, maddox.game.world.AiAircraft aircraft, maddox.game.world.AiLimbDamage limbDamage)
public virtual void OnAircraftTookOff(int missionNumber, string shortName, maddox.game.world.AiAircraft aircraft)
public virtual void OnAutopilotOff(maddox.game.world.AiActor actor, int placeIndex)
public virtual void OnAutopilotOn(maddox.game.world.AiActor actor, int placeIndex)
public virtual void OnBattleInit()
public virtual void OnBattleStarted()
public virtual void OnBattleStoped()
public virtual void OnCarter(maddox.game.world.AiActor actor, int placeIndex)
public virtual void OnMissionLoaded(int missionNumber)
public virtual void OnPersonHealth(maddox.game.world.AiPerson person, maddox.game.world.AiDamageInitiator initiator, float deltaHealth)
public virtual void OnPersonMoved(maddox.game.world.AiPerson person, maddox.game.world.AiActor fromCart, int fromPlaceIndex)
public virtual void OnPersonParachuteFailed(maddox.game.world.AiPerson person)
public virtual void OnPersonParachuteLanded(maddox.game.world.AiPerson person)
public virtual void OnPlaceEnter(maddox.game.Player player, maddox.game.world.AiActor actor, int placeIndex)
public virtual void OnPlaceLeave(maddox.game.Player player, maddox.game.world.AiActor actor, int placeIndex)
public virtual void OnPlayerArmy(maddox.game.Player player, int army)
public virtual void OnPlayerConnected(maddox.game.Player player)
public virtual void OnPlayerDisconnected(maddox.game.Player player, string diagnostic)
public virtual void OnSingleBattleSuccess(bool success)
public virtual void OnTickGame()
public virtual void OnTickReal()
public virtual void OnTrigger(int missionNumber, string shortName, bool active)
public virtual void Timeout(double sec, maddox.game.DoTimeout doTimeout)

public maddox.game.ABattle Battle { get; }
public maddox.game.IGamePlay GamePlay { get; }
public int MissionNumber { get; }
public int MissionNumberListener { set; get; }
public maddox.game.world.ITime Time { get; }


using System;
using maddox.game;
using maddox.game.world;
using System.Collections.Generic;

public class Mission : maddox.game.AMission
{


// CLASSES


private void serverMessage(string msg)
{
Player pl = GamePlay.gpPlayer();
Player[] players = { pl };
object[] args = { msg };
GamePlay.gpLogServer(players, msg, args);
}



private void serverMessage(string msg)
{
Player pl = GamePlay.gpPlayer();
if (pl != null)
{
AiGroundGroup[] groups = GamePlay.gpGroundGroups(1);
foreach (AiGroundGroup group in groups)
{
string groupName = group.Name();
Player[] players = { pl };
object[] args = { msg };
GamePlay.gpLogServer(players, msg, args); // GamePlay.gpLogServer(players, msg, args);
}
}
}

public override void OnBattleStarted()
{
AiActor actor = GamePlay.gpActorByName("Static0");
if (actor != null)
{
serverMessage("Объект найден"); // или
serverMessage(String.Format("Новая красная группа появится через 10 секунд"));
}
else
{
serverMessage("Объект не найден");
}
}


// LISTS
// List of actions
private List<AiAction> actions = new List<AiAction>();

public override void OnBattleStarted()
{
AiAction action = GamePlay.gpGetAction("startGroup2");
if (action != null) actions.Add(action);
action = GamePlay.gpGetAction("startGroup3");
if (action != null) actions.Add(action);
GamePlay.gpHUDLogCenter(String.Format("Раунд {0}", round));
}

private void startNewRound()
{
GamePlay.gpHUDLogCenter(String.Format("Раунд {0}", round));
if (actions.Count > 0)
{
actions[0].Do();
actions.RemoveAt(0);
}
}




// METHODS

// On actor dead method

bool next = (actor as AiAircraft).AirGroup().DiedAircrafts >= (actor as AiAircraft).AirGroup().InitNOfAirc;
if (next)
{
if (round == 3)
{
completed = true;
GamePlay.gpHUDLogCenter("Поздравляем, миссия пройдена!");
}
else
{
round++;
startNewRound();
}
}

public override void Init(maddox.game.ABattle battle, int missionNumber)
{
base.Init(battle, missionNumber);


}


public override void OnBattleStarted()
{
AiActor actor = GamePlay.gpActorByName("Static0");
if (actor != null)
{
serverMessage("Объект найден");
}
else
{
serverMessage("Объект не найден");
}

}




public override void OnActorDead(int missionNumber, string shortName, AiActor actor, System.Collections.Generic.List<DamagerScore> damages)
{
base.OnActorDead(missionNumber, shortName, actor, damages);
if (!(actor is AiAircraft))
return; // Не самолет

int army = (actor as AiAircraft).Group().Army(); // берем армию группы
}
public override void OnActorDead(int missionNumber, string shortName, AiActor actor, List<DamagerScore> damages)
{
base.OnActorDead(missionNumber, shortName, actor, damages);
GamePlay.gpHUDLogCenter("Dead :" + shortName);
}


bool fail = (actor as AiAircraft).AirGroup().DiedAircrafts >= (actor as AiAircraft).AirGroup().InitNOfAirc;

GamePlay.gpHUDLogCenter(String.Format("Раунд {0}", round));

public override void OnPlaceLeave(Player player, AiActor actor, int placeIndex)
{
base.OnPlaceLeave(player, actor, placeIndex);
Timeout(1, () =>
{
AiAircraft CurAircraft = player.Place() as AiAircraft;
AiAircraft PrevAircraft = actor as AiAircraft;
if (CurAircraft != PrevAircraft)
{ (actor as AiAircraft).Destroy(); }
});
}

public override void OnTrigger(int missionNumber, string shortName, bool active)
{
//call base classes OnTrigger method.
base.OnTrigger(missionNumber, shortName, active);

//if the trigger that was called is the trigger that we're looking for
//"triggerName" and "actionName" are the names that you gave the trigger and action in the FMB.
if (shortName.Equals("triggerName") && active)
{
AiAction action = GamePlay.gpGetAction("actionName"));
if (action != null)
action.Do();

}
public override void OnTrigger(int missionNumber, string shortName, bool active)
{
base.OnTrigger(missionNumber, shortName, active);
if ("trigger".Equals(shortName))
// if ("trigger".Equals(shortName) && active)
{
GamePlay.gpPostMissionLoad("path to your mission files");
GamePlay.gpGetTrigger(shortName).Enable = true;
}

}



//Listens to events of every mission
public override void Init(maddox.game.ABattle battle, int missionNumber)
{
base.Init(battle, missionNumber);
MissionNumberListener = -1; //Listen to events of every mission
}



}

69th_Spiritus_Mortem
Sep-21-2014, 19:16
these help?


Haha... yes and no!

Thanks!