I'm still getting the same error. I'm not sure what is causing it. When a bullet "hits" or intersects an avatar, the following code is called:
Code:
if info.intersected:
if info.object in avatars:
WaitThenFreeze = vizact.sequence( vizact.waittime(info.object.getduration(7)-0.005), vizact.speed_node(0) )
info.object.execute(7)
info.object.clear(viz.ALL)
info.object.clear(viz.CURRENT_ACTION)
info.object.add(WaitThenFreeze) #Add the action to the avatar
RemoveAvatarAction = vizact.call(RemoveAvatar,info.object)
info.object.add(RemoveAvatarAction) #Add action to remove avatar
The RemoveAvatar function is:
Code:
def RemoveAvatar(avatar):
avatar.visible(0) #Hide avatar
avatar.speed(1) #Restore speed
avatars.remove(avatar) #Remove from list
dead_list.append(avatar) #Add to dead list
I tried using the len(avatars) modulus division but it still gives me the same traceback error.
I also tried:
Code:
if len(avatars) != NUM_AVATARS:
avatar = dead_list[nextAvatar]
nextAvatar = nextAvatar + 1 % len(dead_list)
else:
avatar = avatars[nextAvatar]
nextAvatar = (nextAvatar + 1) % len(avatars)
walkAvatar(avatar)
but that didn't work either.