Illegal Exception problem

Started by Sadistyk, Sat 08/11/2008 17:31:17

Previous topic - Next topic

Sadistyk

Hi. I've been getting this error:



Here's the dmp: CrashInfo.3.10.1050_1.dmp

I find this error odd because the line 1521 is just a character.Walk(...) line.

The game should do this:
I have a character and a timer. When the timer is expired, y run an animation (like an idle animation) and set the timer again. The extrange thing is that I use this logic in 4 characters, 2 of them causes this problem and the other 2 work fine, and the code is almost the same.

Here's one of the code's that don't work (character Barman):

in the Talk event:
Code: ags

function cBarman_Talk()
{
  player.StopMoving();
  Apagar();
  while (cBarman.Animating) Wait(1);
  SetTimer(1, 0);
  cBarman.Loop = 0;
  player.Walk(197, 133, eBlock, eWalkableAreas);  // LINE 1521
  player.FaceCharacter(cBarman, eBlock);
  cBarman.Say("{Qu< quieres, chico?");
  dBarman.Start();
}


The Room where the character is:

Code: ags

function room_Load()
{
  Aparecer_Cancion(0, 10, 5, 11);
  cBarman.Loop = 1;
  Mouse.Mode = eModeIr;
  SetTimer(1, 0);
  SetTimer(2, 0);
}
...
function room_RepExec()
{
  if (IsTimerExpired(1))
  {
    cBarman.Animate(1, 3, eOnce, eNoBlock, eForwards);
    SetTimer(1, 300);
  }
  ...
  if (GetGlobalInt(10) == 1)
  {
    SetGlobalInt(10, 0);
    cBarman.Loop = 1;
    Prender();
    Mouse.Mode = eModeIr;
    SetTimer(1, 300);
  }
}

function room_AfterFadeIn()
{
  if (player.PreviousRoom == 7)
    player.Loop = 0;
  Gui_Invisible(gNegro, 3, 10);
  SetTimer(1, 300); // TIMER FOR THE BARMAN
}


The character's dialog:
Code: ags

// Dialog script file
@S  // Dialog startup entry point
return
@1
barman: No te pareces en nada a un pirata, chico.
...
option-off-forever 1
return
@2
barman: Bueno, no hay mucho para elegir.
...
option-off-forever 2
option-on 3
option-on 4
return
@3
barman: {Tienes identificaci#n?
...
return
@4
barman: {Tienes identificaci#n?
...
return
@5
barman: Tengo una terrible comez#n en la pierna.
return
@6
barman: Hasta luego, chico.
set-globalint 10 1
stop


The character's view is the 23, loop 0 is the talking loop, and the loop 1 is the idle loop that I animate from the rep_exec of the room.

Pumaman

The crash seems to be due to the previous line:

cBarman.Loop = 0;

cBarman probably now has an invalid view state, because his Frame is now larger than what Loop 0 has. I'll put a fix into AGS for this, but try adding this underneath that line:

cBarman.Frame = 0;

so that when the Walk command runs, cBarman definitely has a valid view state.

Sadistyk

Thanks man, IT WORKED!! Jaja ;D

SMF spam blocked by CleanTalk