[ian-reeds-games] Re: script idea, can it be done?

  • From: Craig Brett <craigbrett17@xxxxxxx>
  • To: ian-reeds-games@xxxxxxxxxxxxx
  • Date: Tue, 01 Oct 2013 23:15:52 +0100

Ok, I've given it a shot. No luck I'm afraid.

I've ran up against a pletherer of problems. First off, I think the first map of C&C seems to be broken. Even with no spies, I was getting this error on the AI's turn.

---------------------------
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
   at System.ThrowHelper.ThrowArgumentOutOfRangeException()
   at System.Collections.Generic.List`1.get_Item(Int32 index)
at Game.AI.OrderByOverallStrength(List`1 units) in C:\Data\Recent\TacticalRPG\TacticalRPG\AI.cs:line 525 at Game.AI.GetBestCurseableUnit(Tile t, Unit curUnit, Skill sk, List`1 units) in C:\Data\Recent\TacticalRPG\TacticalRPG\AI.cs:line 453 at Game.AI.IsAnySkillUseable(Tile t, Unit curUnit, List`1 friends, List`1 enemies, List`1 skills) in C:\Data\Recent\TacticalRPG\TacticalRPG\AI.cs:line 385 at Game.AI.IsActionablePosition(Tile t, Unit curUnit, List`1 friends, List`1 enemies) in C:\Data\Recent\TacticalRPG\TacticalRPG\AI.cs:line 350 at Game.AI.<>c__DisplayClasse.<MoveToActionablePosition>b__7(Tile p1) in C:\Data\Recent\TacticalRPG\TacticalRPG\AI.cs:line 145 at Game.BreadthFirstSearch.InnerSearch() in C:\Data\Recent\TacticalRPG\TacticalRPG\BreadthFirstSearch.cs:line 90 at Game.BreadthFirstSearch.Search(Map map, Int32 sourceID, Func`2 isTarget, Func`2 isValid, Func`2 getAdjacentTiles, Int32 depthLimit) in C:\Data\Recent\TacticalRPG\TacticalRPG\BreadthFirstSearch.cs:line 35 at Game.AI.MoveToActionablePosition(Unit u, Skill moveSkill, List`1 friends, List`1 enemies) in C:\Data\Recent\TacticalRPG\TacticalRPG\AI.cs:line 149 at Game.AI.PerformSkills(Unit curUnit, List`1 friends, List`1 enemies) in C:\Data\Recent\TacticalRPG\TacticalRPG\AI.cs:line 273 at Game.AI.RunSimpleAI(Unit u, List`1 friends, List`1 enemies) in C:\Data\Recent\TacticalRPG\TacticalRPG\AI.cs:line 99 at Game.AI.TakeTurn(Func`1 getUnits, Func`1 getFriends, Func`1 getEnemies) in C:\Data\Recent\TacticalRPG\TacticalRPG\AI.cs:line 45 at Game.Battle.Process(Empty ent) in C:\Data\Recent\TacticalRPG\TacticalRPG\States\Battle.cs:line 77 at Game.StateMachine`1.Process() in C:\Data\Recent\TacticalRPG\TacticalRPG\StateMachine.cs:line 38 at Game.Form1.RunGameLoop(Boolean keyPressed) in C:\Data\Recent\TacticalRPG\TacticalRPG\Form1.cs:line 242 at Game.Form1.GameLoopTimer_Tick(Object sender, EventArgs e) in C:\Data\Recent\TacticalRPG\TacticalRPG\Form1.cs:line 194
   at System.Windows.Forms.Timer.OnTick(EventArgs e)
   at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
---------------------------

So I changed maps. Then I realised the new unit didn't carry over the effect. Turns out I'd forgotten that bit. I kind of fixed that (it still gave an audio error but it actually carried over effects as well).

However, when the effect fizzled and it tried to revert my disguised unit, I got a System.InvalidOperationException, where it modified the enumeration (I didn't copy the exact error I'm afraid).

All in all, I've been trying to get disguising units to work for a while now, but the game doesn't seem to be too happy about this. I have at least made an improvement to my scripts for when I release the new version of them.

Sad times.

Craig

Other related posts: