View Single Post
  #7  
Old 05-04-2006, 10:25 AM
betancourtb82 betancourtb82 is offline
Member
 
Join Date: Jan 2006
Posts: 103
Thanks that helped a lot. I have the program functioning as I wanted it to. My next step is to "tag each avatar". When I call the avatars using:
Code:
#Create all the avatars and add them to the waiting list
for x in range(0,3):
 if x == 0:
  male = viz.add(people[0]) 
  male.scale(.1,.1,.1)
  link = viz.add(viz.GROUP) 
  myphone = link.add(objects[0])
  myphone.scale(.0005,.0005,.0005)
  male.linkbone(link,'skel_HandR')
 elif x == 1:
  male = viz.add(people[1])
  link = viz.add(viz.GROUP) 
  myphone = link.add(objects[1])
  myphone.scale(.0005,.0005,.0005)
  myphone.translate(0,-.25,.17)
  myphone.rotate(180)
  male.linkbone(link,'skel_Neck')
 elif x ==2:
  male = viz.add(people[2])
  link = viz.add(viz.GROUP) 
  myphone = link.add(objects[2])
  myphone.scale(.0008,.0008,.0008)
  myphone.rotate(66.51,151.49,86.01)
  myphone.translate(-0.02,0.04,0.02)
  male.linkbone(link,'skel_HandRF')
 male.translate(3*x,-10,10)
 male.rotate(180)
 #Add the avatar to the waiting and lemming list
 waitlist.append(male)
 characters.append(male)
Once they get shot they go through a RemoveAvatar function and a RestoreAvatar function as shown below:

Code:
def RestoreAvatar():
 global keyindex
 if len(dead_list):
  print "avatar restored"
  avatar = waitlist.pop() #Ressurrect dead avatar
  avatar.visible(1) #Make it visible
  characters.append(avatar) #Add it to avatar list
 # walkAvatar(avatar)
 print 'avatar restored'
def RemoveAvatar(avatar):
 avatar.visible(0) #Hide avatar
 #avatar._face_.visible(0) #Hide face
 avatar.speed(1) #Restore speed
 characters.remove(avatar) #Remove from list
 dead_list.append(avatar) #Add to dead list
There are a couple things I have to do that I'm not sure how to do. First of all, I have to say which avatar (e.g. avatar 1 with object 1, avatar 1 w/object 2...etc.) I was thinking of having a variable that increments whenever each avatar gets shot, however the problem I'm having is I don't know how to have the program tell which avatar got shot. Once they get shot, I have to unlink their object and link them back to another object for the next time they appear. FYI here is the code for what happens when they get shot:

Code:
 if info.intersected:
  autospawn = not autospawn
  print 'intersect point is',info.intersectPoint
  if info.object in waitlist:
   print "in waitlist"
  if info.object in dead_list:
   print "in dead_list"
  if info.object in characters:
   print "in characters"
   avatarsHit = avatarsHit + 1
   viz.playsound('arrgh.wav')
   print 'Avatars hit: ', avatarsHit
   WaitThenFreeze = vizact.sequence( vizact.waittime(info.object.getduration(7)+.001), 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
Please help
Reply With Quote