HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: getElement beyond end of list  (Read 1036 times)

craigbe

  • Developers
  • *
  • Posts: 69
    • View Profile
getElement beyond end of list
« on: Feb 15, 13, 01:38:05 PM »

Hi All,

I'm seeing this error in my chat window and am unsure of what to look at.  I searched around but am coming up empty.. hopefully someone else has seen this and fixed it :)

Thanks for any ideas!

Craig

[hsl_error] 9223372056223021578,1: [CityStreetMain] SCRIPT ERROR: Exception ArrayBoundsException: HeroList::getElement beyond end of list
02/15/2013 19:39:52 UTC
Call trace:
  Script _AiAgentClassMethods line 74 me[id=9223372062040109444 class=E_nonPlayerCharacter,E_AiAgent]
  Script E_AiStatePursueClassMethods line 21 me[id=9223372062040114637 class=E_AiStatePursue]
  Script E_PathingHelperClassMethods line 151 me[9223372062040114637]
  Script LightweightEventsClassMethods line 157 me[id=9223372062040021854 class=LightweightEvents]
  Script E_CharDriverClassMethods line 457 me[9223372062040021835]
  Script E_CharDriverClassMethods line 411 me[9223372062040021835]
starting method/function _DRIVENCHARACTERSIMULATIONTIMER_TICK
starting me[id=9223372062040021835 class=E_CharDriver]
Logged

brainache

  • World Owner
  • ****
  • Posts: 121
    • View Profile
Re: getElement beyond end of list
« Reply #1 on: Feb 15, 13, 03:26:12 PM »

Hey Craig,

Both this one and your PostEvent thread appear to point o an issue in you AiAgent scripts..

this one from _AiAgentClassMethods line 74
and the postevent from _AiAgentClassMethods line 78 i think it was...

whats going on in that scripts on those lines?
Logged

craigbe

  • Developers
  • *
  • Posts: 69
    • View Profile
Re: getElement beyond end of list
« Reply #2 on: Feb 16, 13, 02:38:29 PM »

Weird.. I don't even have an _AiAgentClassMethods script on my server or client side.  I do have an E_AiAgentClassMethods though.   Why would it list a script I don't even have?


Here's the function in the range of those errors -



  //  Look for a player to mess up since we aren't in combat.
  //  Simple check for nearby players within a radius from our current position.
 var targets = GetTargetsInSphere( true, false, me.GetPosition(), 1.3 )

   
 
  pcTargets as List of NodeRef
  pc as NodeRef of Class E_CommonCharacter
  foreach target in targets
    //  GetTargetsInSphere hands back _playerAccount nodes, but we want the character node
    where target is kindof E_playerCharacter
      pc = target
      if pc != None //and pc.IsAttackable()
        add back pc to pcTargets
      .
    .
  .
  if pcTargets.length > 0
    //  Pick a random target and store it.
    me.E_AiTarget = pcTargets[ RandomInteger( 1, pcTargets.length ) ]
    //  Fight!
    combat as NodeRef of Class E_AiStateCombat = CreateNodeFromClass( "E_AiStateCombat" )
    me._PushAgentState( combat, "Found a target to fight: " + me.E_AiTarget )
  .
.
Logged

craigbe

  • Developers
  • *
  • Posts: 69
    • View Profile
Re: getElement beyond end of list
« Reply #3 on: Feb 16, 13, 02:57:38 PM »

Oops yes  I do, my bad duh.

This is the function where that line 74 shows up -

method _PopAgentState(reason as String)
  if HasMethod(me, "_PopAgentGoal")
    if me._PopAgentGoal(reason)
      //  goal method handled it
      return
    .
  .
  var previous = me._AiStateStack[1]
  remove me._AiStateStack at 1 keep
 
  me._AgentDebugMsg("[pop " + getPrimaryClassOnNode(previous) + "] " + reason)
  CallMethodPostEvent(me, "_DestroyPoppedState", previous)
  previous._ExitAiState()
 
  if me._AiPendingStates.length > 0
    me._PushAgentState(me._AiPendingStates[1], "[pop found a pending state]")
   
    // pop the pending state off
    previous = me._AiPendingStates[1]
    remove me._AiPendingStates at 1 keep
    DestroyNode(previous)
    return
  .
  //me._AgentDebugMsg("[pop] " + reason)
  if me._AiStateStack.length > 0 and me._AiStateStack[1] != None
    me._AiStateStack[1]._ResumeAiState(previous)
  else
    me._AgentStateNeeded()
  .
.
Logged