home *** CD-ROM | disk | FTP | other *** search
/ PC PowerPlay 56 / CDPowerplay56Disc2.iso / demos / blade / data1.cab / Program_Executable_Files / Lib / path_test.py < prev    next >
Encoding:
Text File  |  2000-10-27  |  3.0 KB  |  136 lines

  1. #
  2. #
  3. #    Path_test.py
  4. #
  5. #
  6. #
  7. #    File to test the path planning
  8. #
  9. #    Put it in any map directory and load it from the cfg.py ( at the end of the file) (or import it)
  10. #
  11. #
  12. #    KEYS :
  13. #
  14. #    1 -> Puts a traitor_knight two meters from you ( be careful to select a open area , it could crash otherwise )
  15. #
  16. #   2 -> Adds a new point to the patrol
  17. #         Use it as many times as desired
  18. #
  19. #    3 -> End the route ( that given point included ) , and launch the patrol
  20. #
  21. #    4 -> kill him!
  22. #
  23. #   Enjoy ! ;)
  24. #
  25.  
  26.  
  27.  
  28. import Bladex
  29. import EnemyTypes
  30. import Breakings 
  31.  
  32.  
  33. last_person_name=""
  34.  
  35.  
  36. def AddBay():
  37.     global last_person_name
  38.     print "AddBay In"
  39.     new_person=Bladex.GetEntity(last_person_name)
  40.     player1=Bladex.GetEntity("Player1")
  41.     pos=player1.Position
  42.     new_person.AddBayPoint=pos[0],pos[1],pos[2]
  43.     print "AddBay Out"
  44.  
  45.  
  46. def PutPerson():        
  47.     global last_person_name
  48.         
  49.     player1=Bladex.GetEntity("Player1")
  50.     last_person_name=Bladex.GenerateEntityName()    
  51.  
  52.     pos=player1.Position    
  53.     new_person=Bladex.CreateEntity(last_person_name, "Knight_Traitor",pos[0]+1750,pos[1],pos[2])
  54.     new_person.Person=1
  55.     new_person.Angle=player1.Angle
  56.     EnemyTypes.EnemyDefaultFuncs(new_person)
  57.  
  58.     o=Bladex.CreateEntity(Bladex.GenerateEntityName(),"Espadaromana",0,0,0)
  59.     o.Weapon=1
  60.     inv=new_person.GetInventory()
  61.     inv.AddWeapon(o.Name)
  62.     inv.LinkRightHand(o.Name)
  63.  
  64.     new_person.Blind=1
  65.     new_person.Deaf=1        
  66.  
  67.  
  68.  
  69. def EndBay():
  70.     global last_person_name
  71.     print "EndBay In"
  72.     AddBay()
  73.     new_person=Bladex.GetEntity(last_person_name)
  74.     en_pos=new_person.Position
  75.     new_person.AddBayPoint=en_pos[0],en_pos[1],en_pos[2]
  76.     new_person.LaunchBayRoute()
  77.     print "EndBay Out"
  78.  
  79. def ResetMe():
  80.     global last_person_name
  81.     print "Reseting..."    
  82.     new_person=Bladex.GetEntity(last_person_name)
  83.     en_pos=new_person.InitPos
  84.     new_person.Position=en_pos[0],en_pos[1],en_pos[2]    
  85.     new_person.LaunchBayRoute()
  86.     print "ResetMe Out"
  87.  
  88.  
  89. def KillMe():
  90.     global last_person_name
  91.     new_person=Bladex.GetEntity(last_person_name)
  92.     new_person.Life=0
  93.  
  94.  
  95. def PutBox():
  96.     print "PutBox In" 
  97.     player1=Bladex.GetEntity("Player1")
  98.     box_name=Bladex.GenerateEntityName()
  99.  
  100.     pos=player1.Position
  101.     new_box=Bladex.CreateEntity(box_name, "Cajon2",pos[0]+1750,pos[1],pos[2])
  102.     new_box.Static=1
  103.  
  104.     Breakings.SetBreakable(box_name, 2)
  105.  
  106.     print "PutBox Out"
  107.  
  108. Bladex.AddInputAction("PutPerson",0)
  109. Bladex.AssocKey("PutPerson","Keyboard","1", 1 )
  110. Bladex.AddBoundFunc("PutPerson",PutPerson)
  111.  
  112.  
  113. Bladex.AddInputAction("AddBay",0)
  114. Bladex.AssocKey("AddBay","Keyboard","2",1 )
  115. Bladex.AddBoundFunc("AddBay",AddBay)
  116.  
  117.  
  118. Bladex.AddInputAction("EndBay",0)
  119. Bladex.AssocKey("EndBay","Keyboard","3",1 )
  120. Bladex.AddBoundFunc("EndBay",EndBay)
  121.  
  122.  
  123. Bladex.AddInputAction("KillMe",0)
  124. Bladex.AssocKey("KillMe","Keyboard","4",1 )
  125. Bladex.AddBoundFunc("KillMe",KillMe)
  126.  
  127. Bladex.AddInputAction("ResetMe",0)
  128. Bladex.AssocKey("ResetMe","Keyboard","9",1 )
  129. Bladex.AddBoundFunc("ResetMe",ResetMe)
  130.  
  131.  
  132. Bladex.AddInputAction("PutBox",0)
  133. Bladex.AssocKey("PutBox","Keyboard","0",1 )
  134. Bladex.AddBoundFunc("PutBox",PutBox)
  135.  
  136.