View Single Post
  #33  
Old 03-21-2006, 09:26 AM
betancourtb82 betancourtb82 is offline
Member
 
Join Date: Jan 2006
Posts: 103
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.

Last edited by betancourtb82; 03-21-2006 at 09:35 AM.
Reply With Quote