BigTruck's Fan Page

TPTPT's page


MyTools
3D Blade Tools v1.2.1
Hi every body,

I'm working on new maps, with new staff, I have look for to generate path files (BMC files), for enemy or ally or actors, so in Led editor we can create some path but I don't find how to export it.
So I have create a new Script to generate it in your map:

1)copy the file "TPpath_test.py" in your map directory.
2)use the console to load it :import TPpath_test or in the end of the map Cfg.py file write :
execfile("TPpath_test.py")#to load the path editor
execfile("MyBayPoint.py") #to test your path
3)with the player go to the place you want start the path road and press Keyboard "1", a box and a knight appear on it near the player
4)place the player at the firt step position of the road and press Keyboard "2",it save the bay point, place the player at the next point and press again Keyboard "2", and etc
5)when you have finish the road press Keyboard "3", the knight will walk on the road way, you must wait the knight come back on the box and Keyboard "0" to stop the BMC file recorder.  
6)now you can reload the map and show the knight walking on the road, in the console write : import MyBayPoint or put in the end of the map Cfg.py file:execfile("MyBayPoint.py") #to test your path
7)to active combat when the knight see the player in MyBayPoint.py file remove # from the start of the line 43: EnemyTypes.EnemyDefaultFuncs(Entity1)
TPpath_test.py (Right-click and save as)
			import Bladex
			import EnemyTypes
			import Breakings
			import sys 
			import os

			record = 0
			victim = "Player1"

			Bladex.CreateTimer("AniMaker",0.4/24.0)
				
			def snapShotTimer(strEntName, fTime):
				new_person=Bladex.GetEntity(last_person_name)
				player1=Bladex.GetEntity("Player1")
				pos=player1.Position
				new_person.AddBayPoint=pos[0],pos[1],pos[2]
				angl=player1.Angle
				toto=pos[0],pos[1],pos[2]
				print "AddBay Out Press key 0 to finish"
				player1=Bladex.GetEntity("Player1")
				pos=player1.Position
				angl=player1.Angle
				cfgfile=open('Paths//'+new_person.Name+'.bmc','at')
				cfgfile.write ('%s %s %s %s %s\n'%((int(new_person.Position[0])),(int(new_person.Position[1])),(int(new_person.Position[2])), "-1000",float(int(new_person.Angle*100))/100))
				cfgfile.close()

			def stopSnaps():
				global victim
				global record
				if (not record) : return
				record=0
				print("stop")
				char = Bladex.GetEntity(victim)
				char.TimerFunc=""
				char.RemoveFromList("AniMaker")
				cfgfile=open('MyBayPoint.py','at')##########################################
				cfgfile.write ('"""\n')
				cfgfile.close()
				
			def startAnim(strAnimName):
				global victim
				char = Bladex.GetEntity(victim)
				char.LaunchAnimation(strAnimName)

			def startSnaps():
				global victim
				global record
				if (record) : return
				record = 1
				print("start")
				char = Bladex.GetEntity(victim)	
				char.TimerFunc=snapShotTimer;
				char.SubscribeToList("AniMaker")

			def animSnapShot( fTime , strAnimName ="", fLaunchDelay=0.0 ) :
				startSnaps()
				if (strAnimName<>"") : Bladex.AddScheduledFunc( Bladex.GetTime()+fLaunchDelay, startAnim, (strAnimName,) )
				
			def setVictim(strVictim):
				global victim
				victim=strVictim

			####################################################################################

			def pathstt():
				char=Bladex.GetEntity("Player1")
				setVictim("Player1")
				animSnapShot( 10.0 , "Kgt_wlk_no" )
			#########################################################################################


			last_person_name=""

			pos = ''
			angl = ''
			toto = 'ffffff'

			def AddBay():
				global last_person_name
				print "AddBay In"
				new_person=Bladex.GetEntity(last_person_name)
				player1=Bladex.GetEntity("Player1")
				pos=player1.Position
				new_person.AddBayPoint=pos[0],pos[1],pos[2]
				angl=player1.Angle
				toto=pos[0],pos[1],pos[2]
				print "AddBay Out",toto,angl
				#execfile("Writepathspj.py")
				player1=Bladex.GetEntity("Player1")
				pos=player1.Position
				angl=player1.Angle
				cfgfile=open('MyBayPoint.py','at')
				cfgfile.write (''+new_person.Name+'.AddBayPoint=%s, %s, %s\n'%(player1.Position[0],player1.Position[1],player1.Position[2]))
				cfgfile.close()


			def PutPerson():		
				global last_person_name
					
				player1=Bladex.GetEntity("Player1")
				last_person_name=Bladex.GenerateEntityName()	
				PutBox()

				pos=player1.Position	
				new_person=Bladex.CreateEntity(last_person_name, "Knight_Traitor",pos[0]+1750,pos[1],pos[2])
				new_person.Person=1
				new_person.Angle=player1.Angle
				EnemyTypes.EnemyDefaultFuncs(new_person)

				o=Bladex.CreateEntity(Bladex.GenerateEntityName(),"Espadaromana",0,0,0)
				o.Weapon=1
				inv=new_person.GetInventory()
				inv.AddWeapon(o.Name)
				inv.LinkRightHand(o.Name)

				new_person.Blind=1
				new_person.Deaf=1
				
				import shutil
				
				if not os.path.exists ('Paths'):
					os.mkdir("Paths")
				if os.path.exists ('Paths//'+new_person.Name+'.bmc'):
					os.remove ('Paths//'+new_person.Name+'.bmc')
				if os.path.exists ('MyBayPoint.py'):
					os.remove ('MyBayPoint.py')
				
				cfgfile=open('Paths//'+new_person.Name+'.bmc','at')
				cfgfile.write ('Rlx 0.019512 0.015625\n')
				cfgfile.write ('WLK 0.002000 0.001250\n')
				cfgfile.write ('%s %s %s %s %s\n'%((int(player1.Position[0])),(int(player1.Position[1])),(int(player1.Position[2])), "-1000",float(int(player1.Angle*100))/100))
				cfgfile.close()
				
				
				cfgfile=open('MyBayPoint.py','at')
				cfgfile.write('##############\n')
				cfgfile.write('## Enemigos ##\n')
				cfgfile.write('##############\n\n')
				cfgfile.write('##### Create with TPPath_Test #####\n\n')

				cfgfile.write('import Bladex\n')
				cfgfile.write('import AniSound\n')
				cfgfile.write('import ItemTypes\n')
				cfgfile.write('import Actions\n')
				cfgfile.write('#import NUActions\n')
				cfgfile.write('import CharStats\n')
				cfgfile.write('import darfuncs\n') 
				cfgfile.write('import Reference\n')
				cfgfile.write('import ReadGSFile\n')
				cfgfile.write('import pocimac\n')
				cfgfile.write('import GenFX\n\n')

				cfgfile.write('##### NUSTAFFTP ######\n\n')

				cfgfile.write('import EnemyTypes\n')
				cfgfile.write('#import EnemyCharTypes\n')
				cfgfile.write('#import TPAllyTypes\n')
				cfgfile.write('#import PlayerTypes\n')
				cfgfile.write('#import NUCharTypes\n')
				cfgfile.write('import Basic_Funcs\n\n')

				cfgfile.write('import darfuncs\n\n')

				cfgfile.write('#####       ######\n\n')

				cfgfile.write('import Ally_Def\n')

				cfgfile.write('import dust\n')
				cfgfile.write('import whrandom\n')
				cfgfile.write('import Sounds\n')
				cfgfile.write('import Sparks\n')

				cfgfile.write(''+new_person.Name+'=Bladex.CreateEntity("'+new_person.Name+'","Knight_Traitor",76771.7635986,-664.263925267,-51632.1235305, "Person")\n')
				cfgfile.write(''+new_person.Name+'.Scale=1.0\n')
				cfgfile.write(''+new_person.Name+'.Angle=1.56384316899\n')
				cfgfile.write(''+new_person.Name+'.Level=15\n')
				cfgfile.write(''+new_person.Name+'.Life=2400\n')
				cfgfile.write('#'+new_person.Name+'.Data=EnemyCharTypes.'+new_person.Name+'('+new_person.Name+')\n')
				cfgfile.write('#EnemyTypes.EnemyDefaultFuncs('+new_person.Name+')\n')
				cfgfile.write(''+new_person.Name+'.SetOnFloor()\n')
				
				cfgfile.write('o=Bladex.CreateEntity("'+new_person.Name+'_Weapon","Espadaromana",0,0,0)\n')
				cfgfile.write('o.Weapon=1\n')
				cfgfile.write('inv='+new_person.Name+'.GetInventory()\n')
				cfgfile.write('inv.AddWeapon(o.Name)\n')
				cfgfile.write('inv.LinkRightHand(o.Name)\n')
				
				cfgfile.write('"""\n')
				cfgfile.write (''+new_person.Name+'.AddBayPoint=%s, %s, %s\n'%(new_person.Position[0],new_person.Position[1],new_person.Position[2]))
				cfgfile.close()



			def EndBay():
				global last_person_name
				print "EndBay In"
				AddBay()
				new_person=Bladex.GetEntity(last_person_name)
				en_pos=new_person.Position
				new_person.AddBayPoint=en_pos[0],en_pos[1],en_pos[2]
				new_person.LaunchBayRoute()
				Bladex.AddScheduledFunc(Bladex.GetTime() + 1.0, pathstt,())
				print "EndBay Out",new_person.BayRoute,new_person.RouteType

			def ResetMe():
				global last_person_name
				print "Reseting..."	
				new_person=Bladex.GetEntity(last_person_name)
				en_pos=new_person.InitPos
				new_person.Position=en_pos[0],en_pos[1],en_pos[2]
				new_person.LaunchBayRoute()
				print "ResetMe Out"


			def KillMe():
				global last_person_name
				new_person=Bladex.GetEntity(last_person_name)
				new_person.Life=0


			def PutBox():
				print "PutBox In" 
				player1=Bladex.GetEntity("Player1")
				box_name=Bladex.GenerateEntityName()

				pos=player1.Position
				new_box=Bladex.CreateEntity(box_name, "Cajon2",pos[0]+1750,pos[1],pos[2])
				new_box.Static=1
				new_box.SetOnFloor
				boxpos=new_box.Position
				new_box.Position=boxpos[0],boxpos[1]+1500,boxpos[2]

				Breakings.SetBreakable(box_name, 2)

				print "PutBox Out"

			Bladex.AddInputAction("PutPerson",0)
			Bladex.AssocKey("PutPerson","Keyboard","1", 1 )
			Bladex.AddBoundFunc("PutPerson",PutPerson)

			Bladex.AddInputAction("AddBay",0)
			Bladex.AssocKey("AddBay","Keyboard","2",1 )
			Bladex.AddBoundFunc("AddBay",AddBay)

			Bladex.AddInputAction("EndBay",0)
			Bladex.AssocKey("EndBay","Keyboard","3",1 )
			Bladex.AddBoundFunc("EndBay",EndBay)

			Bladex.AddInputAction("KillMe",0)
			Bladex.AssocKey("KillMe","Keyboard","4",1 )
			Bladex.AddBoundFunc("KillMe",KillMe)

			Bladex.AddInputAction("ResetMe",0)
			Bladex.AssocKey("ResetMe","Keyboard","9",1 )
			Bladex.AddBoundFunc("ResetMe",ResetMe)

			Bladex.AddInputAction("PutBox",0)
			Bladex.AssocKey("PutBox","Keyboard","0",1 )
			Bladex.AddBoundFunc("PutBox",stopSnaps)