Page 1 of 1

Can't get my edited scenario to work

Posted: Fri Jul 24, 2015 4:51 am
by ThomasB31768
I can't get my scenario to work when I load it in tools or load a scenario. The map is set up. It just has problems with scripting but I'm not sure where it's wrong at. here my files. Also, attachment won't accept cs file so here's mine.


using System;
using RomeScriptInterfaces;
using Scripts;

namespace Scripts
{

[Serializable]
public class }{Organia ; ScriptServer.IScript
{

private StandardWageManager mWageManagerPlebe = null;


private StandardWageManager mWageManagerEquite = null;


private TMilitaryAI mMilitaryAI = null;
private InvasionSetup[] mInvasions;




public void Run(object gameInterface)
{
IGameQueryInterface gameQueryInterface =
(IGameQueryInterface)gameInterface;
switch (gameQueryInterface.RunReason)
{
case RunReason.kTick:
OnTick(gameQueryInterface);
break;

case RunReason.kOnBeginScenario:
OnBeginScenario(gameQueryInterface);
break;

case RunReason.kOnInvasionArrival:
OnInvasionArrival(gameQueryInterface);
break;

case RunReason.kOnCohortTargetDestroyed:
OnCohortTargetDestroyed(gameQueryInterface);
break;

case RunReason.kOnLoadScenario:
OnLoadScenario(gameQueryInterface);
break;

}
}

void OnInvasionArrival(IGameQueryInterface game)
{
// let's find out which invasion we are...
foreach (InvasionSetup inv in mInvasions)
{
if (game.RunInvasion == inv.GetInvasionName())
{
//hook in to military AI
eInvasionType invType = inv.GetInvasionType();
mMilitaryAI.InvasionBegin(invType, game);
break;
}
}
}

void OnLoadScenario(IGameQueryInterface game)
{
game.ScriptDone = true;
}

void OnCohortTargetDestroyed(IGameQueryInterface game)
{

String nextOrders =
mMilitaryAI.InvasionTargetDestroyed(game.RunCohortID, game);
game.SetCohortOrders(game.RunCohortID, ref nextOrders);
}

void OnBeginScenario(IGameQueryInterface game)
{




mWageManagerPlebe = new StandardWageManager(game, eWageTypes.kPleb, 20);
mWageManagerPlebe.AddWageStep(17, 25);
mWageManagerPlebe.AddWageStep(20, 50);
mWageManagerPlebe.AddWageStep(23, 25);


mWageManagerPlebe.SetGameWage(game); 20

mWageManagerEquite = new StandardWageManager(game, eWageTypes.kEques, 25);
mWageManagerEquite.AddWageStep(26, 50);
mWageManagerEquite.AddWageStep(30, 50);

mWageManagerEquite.SetGameWage(game); 25

// Invasions
mMilitaryAI = new TMilitaryAI(game);
mInvasions = new Invasion Setup[10];

mInvasions[0] = new InvasionSetup("conquest1", sInvasionFactions.kGermanian, eInvasionType.kInvasion, 0, 200, 0);
mInvasions[0].AddCohort(sCohortDbIDs.kGerm_Catapult, 1, 3, 3);
mInvasions[0].CreateInvasion(game, 0, 0);

mInvasions[1] = new InvasionSetup("conquest2", sInvasionFactions.kGermanian, eInvasionType.kInvasion, 0, 250, 0);
mInvasions[1].AddCohort(sCohortDbIDs.kGerm_Ram, 1, 3, 3);
mInvasions[1].CreateInvasion(game, 1, 0);

mInvasions[2] = new InvasionSetup("conquest3", sInvasionFactions.kGermanian, eInvasionType.kInvasion, 0, 270, 0);
mInvasions[2].AddCohort(sCohortDbIDs.kGerm_Lt, 30, 3, 3);
mInvasions[2].CreateInvasion(game, 2, 0);

mInvasions[3] = new InvasionSetup("conquest4", sInvasionFactions.kGermanian, eInvasionType.kInvasion, 0, 290, 0);
mInvasions[3].AddCohort(sCohortDbIDs.kGerm_Hvy, 20, 3, 3);
mInvasions[3].CreateInvasion(game, 3, 0);

mInvasions[4] = new InvasionSetup("conquest5", sInvasionFactions.kGermanian, eInvasionType.kInvasion, 0, 330, 0);
mInvasions[4].AddCohort(sCohortDbIDs.kGerm_Cav, 15, 3, 3);
mInvasions[4].CreateInvasion(game, 4, 0);

mInvasions[5] = new InvasionSetup("conquest6", sInvasionFactions.kGermanian, eInvasionType.kInvasion, 0, 360, 0);
mInvasions[5].AddCohort(sCohortDbIDs.kGerm_Aux, 30, 3, 3);
mInvasions[5].CreateInvasion(game, 5, 0);

mInvasions[6] = new InvasionSetup("conquest7", sInvasionFactions.kGermanian, eInvasionType.kInvasion, 0, 390, 0);
mInvasions[6].AddCohort(sCohortDbIDs.kGerm_Catapult, 5, 3, 3);
mInvasions[6].CreateInvasion(game, 6, 0);

mInvasions[7] = new InvasionSetup("conquest8", sInvasionFactions.kGermanian, eInvasionType.kInvasion, 0, 420, 0);
mInvasions[7].AddCohort(sCohortDbIDs.kGerm_Lt, 40, 3, 3);
mInvasions[7].AddCohort(sCohortDbIDs.kGerm_Aux, 10, 3, 3);
mInvasions[7].CreateInvasion(game, 7, 0);

mInvasions[8] = new InvasionSetup("conquest9", sInvasionFactions.kGermanian, eInvasionType.kInvasion, 0, 470, 0);
mInvasions[8].AddCohort(sCohortDbIDs.kGerm_Hvy, 40, 3, 3);
mInvasions[8].AddCohort(sCohortDbIDs.kGerm_Cav, 30, 3, 3);
mInvasions[8].CreateInvasion(game, 8, 0);

mInvasions[9] = new InvasionSetup("conquest10", sInvasionFactions.kGermanian, eInvasionType.kInvasion, 0, 520, 0);
mInvasions[9].AddCohort(sCohortDbIDs.kGerm_Ram, 15, 3, 3);
mInvasions[9].AddCohort(sCohortDbIDs.kGerm_Catapult, 10, 3, 3);
mInvasions[9].CreateInvasion(game, 9, 0);



// End of OnBeginScenario() method
}

void OnTick(IGameQueryInterface game)
{

mWageManagerPlebe.DoTick(game);


mWageManagerEquite.DoTick(game);


mMilitaryAI.Update(game, 0.0001);


// End of OnTick() method
}
}
}