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

  1. #################################################################
  2. ###                                                            ##
  3. ###  If you cast a spell from the hidden past on the darker    ##
  4. ###  site at the godess place, nevermind the doomed place of   ##
  5. ###  the damns and unholls bones.                              ##
  6. ###                                        NoSenseMan          ##
  7. #################################################################
  8.  
  9. import darfuncs
  10. import Bladex
  11. import Damage
  12. import AbreCam
  13. import Actions
  14. import EnemyTypes
  15. import PhantonFX
  16. import GenFX
  17. import ItemTypes
  18. import Reference
  19. import Auras
  20. import Blood
  21. import Menu
  22. import types
  23. import AuxFuncs
  24.  
  25.  
  26. def GetSectorIdx(pos):
  27.     if type(pos)==types.StringType:
  28.         return pos
  29.     else:
  30.         return Bladex.GetSector(pos[0],pos[1],pos[2]).Index
  31.  
  32.  
  33. ############################
  34. #                          #
  35. #  CHAOS KNIGHT GENERATOR  #
  36. #                          #
  37. ############################
  38.  
  39.  
  40. _AppearsCagazo=Bladex.CreateSound("..\\..\\Sounds\\AparicionEnric2.wav","AppearsCagazo")
  41. _AppearsCagazo.MaxDistance=200000.0
  42. _AppearsCagazo.MinDistance=20000.0
  43.  
  44. ChaosKnightActivated = 1
  45.  
  46. def MuereCaos(caosname):
  47.     chaosk1 = Bladex.GetEntity(caosname)
  48.     chaosk1.Data.PrepareDisappearance()
  49.     chaosk1.Data.Disappear(caosname)
  50.     
  51.  
  52.  
  53. def ChaosAbreCam(per):
  54.     AbreCam.PTS=[]
  55.     
  56.     AbreCam.PTS.append((per.Position[0]-3000,per.Position[1]-1000, per.Position[2]-3000),per.Position,0.01)
  57.     AbreCam.PTS.append((per.Position[0]-3000,per.Position[1]-1000, per.Position[2]+3000),per.Position,3.5)
  58.     AbreCam.PTS.append((per.Position[0]+3000,per.Position[1]-1000, per.Position[2]+3000),per.Position,3.5)
  59.     AbreCam.PTS.append((per.Position[0]+3000,per.Position[1]-1000, per.Position[2]-3000),per.Position,3.5)
  60.     AbreCam.PTS.append((per.Position[0]-3000,per.Position[1]-1000, per.Position[2]-3000),per.Position,3.5)
  61.     AbreCam.LastTime = 0.01
  62.     
  63.     AbreCam.AbreCam()
  64.  
  65.  
  66. def CreateChaosKnightBak(Position,Angle):
  67.     global CHAOS_KNIGHT_POSITION
  68.     global CHAOS_KNIGHT_ANGLE
  69.     global CHAOS_KNIGHT_ACTIVATE
  70.     global CHAOS_KNIGHT_DEACTIVATE
  71.     global CHAOS_KNIGHT_LEVEL
  72.     
  73.     chaosk1       = Bladex.CreateEntity("ChaosKnightBak", "ChaosKnight", Position[0], Position[1], Position[2],"Person")
  74.     chaosk1.ActionAreaMin=pow(2,0)
  75.     chaosk1.ActionAreaMax=pow(2,1)
  76.     chaosk1.Angle = Angle
  77.     chaosk1.Level = CHAOS_KNIGHT_LEVEL
  78.     EnemyTypes.EnemyDefaultFuncs(chaosk1)
  79.     chaosk1.ImDeadFunc = MuereCaos
  80.     
  81.     chaosk1.Data.DamageFactorNone=0.15
  82.     chaosk1.Data.DamageFactorLight=0.35
  83.     chaosk1.Data.DamageFactorHeavy=0.35
  84.     chaosk1.Data.PrepareWeapons("Espadon", "Escudon")
  85.     chaosk1.SetOnFloor()
  86.     darfuncs.HideBadGuy(chaosk1.Name)
  87.     
  88.  
  89. def ParticulateAppears(PersonName = "Player1"):
  90.     wps=Bladex.CreateEntity(PersonName+"WPS", "Entity Particle System Dperson", 0.0, 0.0, 0.0)
  91.     wps.PersonName=PersonName
  92.     wps.ParticleType="EnergyConc"
  93.     wps.Time2Live=60
  94.     wps.RandomVelocity=0
  95.     wps.Velocity=0,0,0
  96.     wps.NormalVelocity=-5.0
  97.     wps.YGravity=0
  98.     wps.DeathTime=Bladex.GetTime()+1.5    
  99.     wps.PPS=600
  100.     Bladex.GetEntity(PersonName).Alpha = 0.0
  101.     PhantonFX.Delta = 0.015
  102.     Bladex.AddScheduledFunc(Bladex.GetTime()+0.0, PhantonFX.AppearsChar,(PersonName,))
  103.     
  104. def AppearsChaosKnightBak():
  105.     global CHAOS_KNIGHT_POSITION
  106.     global CHAOS_KNIGHT_ANGLE
  107.     global CHAOS_KNIGHT_ACTIVATE
  108.     global CHAOS_KNIGHT_DEACTIVATE
  109.     global CHAOS_KNIGHT_LEVEL
  110.     global EXEC_IN_CHAOS_KNIGHT_APPEARING
  111.     global ChaosKnightActivated
  112.     
  113.     if not ChaosKnightActivated:
  114.         return
  115.  
  116.     chaosk1 = Bladex.GetEntity("ChaosKnightBak")
  117.     darfuncs.UnhideBadGuy(chaosk1.Name)
  118.     Bladex.AddScheduledFunc(Bladex.GetTime()+15.0, darfuncs.UnhideBadGuy,(chaosk1.Name,))
  119.     chaosk1.Blind=1
  120.     chaosk1.Deaf=1
  121.     chaosk1.Alpha = 0.0
  122.     chaosk1.Data.Appear()
  123.     ChaosAbreCam(chaosk1)
  124.     ParticulateAppears(chaosk1.Name)
  125.     Actions.TurnToFaceEntityNow("ChaosKnightBak","Player1")
  126.  
  127.     for pos in CHAOS_KNIGHT_DEACTIVATE:
  128.         darfuncs.EnterSecIdEvent(pos,TranslateChaos)
  129.     if EXEC_IN_CHAOS_KNIGHT_APPEARING:
  130.         EXEC_IN_CHAOS_KNIGHT_APPEARING()
  131.     
  132.  
  133. def ParticulateDisappears(PersonName = "Player1"):
  134.     wps=Bladex.CreateEntity(PersonName+"WPS", "Entity Particle System Dperson", 0.0, 0.0, 0.0)
  135.     wps.PersonName=PersonName
  136.     wps.ParticleType="EnergyDissip"
  137.     wps.Time2Live=60
  138.     wps.RandomVelocity=0
  139.     wps.Velocity=0,0,0
  140.     wps.NormalVelocity=5.0
  141.     wps.YGravity=0
  142.     wps.DeathTime=Bladex.GetTime()+1.5    
  143.     wps.PPS=600
  144.     Bladex.GetEntity(PersonName).Alpha = 1.0
  145.     PhantonFX.Delta  = 0.015
  146.     PhantonFX.SecAgo = 0
  147.     Bladex.AddScheduledFunc(Bladex.GetTime()+0.0, PhantonFX.DisappearsChar,(PersonName,BorraCaos))
  148.  
  149. def BorraCaos(ent):    
  150.     Bladex.AddScheduledFunc(Bladex.GetTime()+0.2, PrepareChaosAppears2,())
  151.     ch = Bladex.GetEntity("ChaosKnightBak")
  152.     ch.Data.InteruptActions("ChaosKnightBak")
  153.     darfuncs.HideBadGuy("ChaosKnightBak")
  154.     
  155. def TranslateChaos():
  156.     chaosk1 = Bladex.GetEntity("ChaosKnightBak")
  157.     if chaosk1:
  158.         if chaosk1.Life > 0:
  159.             chaosk1.Freeze()
  160.             ParticulateDisappears("ChaosKnightBak")
  161.  
  162. def AppearsChaosKnightBak2():
  163.     global CHAOS_KNIGHT_POSITION
  164.     global CHAOS_KNIGHT_ANGLE
  165.     global CHAOS_KNIGHT_ACTIVATE
  166.     global CHAOS_KNIGHT_DEACTIVATE
  167.     global CHAOS_KNIGHT_LEVEL
  168.     global ChaosKnightActivated
  169.     
  170.     if not ChaosKnightActivated:
  171.         return
  172.  
  173.     chaosk1 = Bladex.GetEntity("ChaosKnightBak")
  174.     darfuncs.UnhideBadGuy(chaosk1.Name)
  175.     ParticulateAppears(chaosk1.Name)
  176.     Actions.TurnToFaceEntityNow("ChaosKnightBak","Player1")
  177.     for pos in CHAOS_KNIGHT_DEACTIVATE:
  178.         darfuncs.EnterSecIdEvent(pos,TranslateChaos)
  179.  
  180.  
  181. def DeactivateChaosWeapon(EntityName, EventName):
  182.     
  183.  
  184.     if EventName=="ChkDisapR":
  185.         weapon=Bladex.GetEntity(Bladex.GetEntity(EntityName).InvRight)
  186.     else:
  187.         weapon=Bladex.GetEntity(Bladex.GetEntity(EntityName).InvLeft)
  188.  
  189.     weapon.RasterMode  ="Read"
  190.     weapon.Alpha       = 0
  191.  
  192.     wps=Bladex.CreateEntity("WPS", "Entity Particle System Dobj", 0.0, 0.0, 0.0)
  193.     wps.ObjectName=weapon.Name
  194.     wps.ParticleType="EnergyDissip"
  195.     wps.PPS=400
  196.     wps.YGravity=0.0
  197.     wps.Friction=0.0
  198.     wps.Velocity=0.0, 0.0, 0.0
  199.     wps.RandomVelocity=2.0
  200.     wps.NormalVelocity=6.0
  201.     wps.Time2Live=60
  202.     wps.DeathTime=Bladex.GetTime()+1.5
  203.  
  204. def PrepareChaosAppears2():
  205.     global CHAOS_KNIGHT_POSITION
  206.     global CHAOS_KNIGHT_ANGLE
  207.     global CHAOS_KNIGHT_ACTIVATE
  208.     global CHAOS_KNIGHT_DEACTIVATE
  209.     global CHAOS_KNIGHT_LEVEL
  210.     
  211.     pers=Bladex.CreateEntity("ChaosKnightBak","ChaosKnight",CHAOS_KNIGHT_POSITION[0],CHAOS_KNIGHT_POSITION[1],CHAOS_KNIGHT_POSITION[2],"Person")
  212.     pers.ActionAreaMin=pow(2,0)
  213.     pers.ActionAreaMax=pow(2,1)
  214.     pers.Angle    = CHAOS_KNIGHT_ANGLE
  215.     
  216.     EnemyTypes.EnemyDefaultFuncs(pers)
  217.     
  218.     pers.Data.PrepareWeapons("Espadon", "Escudon")    
  219.     Actions.TakeObject(pers.Name,"EspadonChaosKnightBak")
  220.     Actions.TakeObject(pers.Name,"EscudonChaosKnightBak")
  221.     
  222.     pers.ImDeadFunc = MuereCaos
  223.  
  224.     
  225.     
  226.     pers.AddAnmEventFunc("ChkDisapL", DeactivateChaosWeapon)
  227.     pers.AddAnmEventFunc("ChkDisapR", DeactivateChaosWeapon)
  228.  
  229.     pers.SetOnFloor()
  230.     darfuncs.HideBadGuy(pers.Name)
  231.  
  232.     for pos in CHAOS_KNIGHT_ACTIVATE:
  233.         darfuncs.EnterSecIdEvent(pos,AppearsChaosKnightBak2)
  234.     
  235. #
  236. # Interface
  237. #
  238.  
  239. CHAOS_KNIGHT_LEVEL             = 15
  240. CHAOS_KNIGHT_POSITION          = 300029.603984, 8180.76682918, -1209.8189804
  241. CHAOS_KNIGHT_ANGLE             = 0
  242. CHAOS_KNIGHT_ACTIVATE          = []
  243. CHAOS_KNIGHT_DEACTIVATE        = []
  244. TIME_BEFORE_PLAYER_APPEARING   = 1.5
  245. EXEC_IN_PLAYER_APPEARING       = ""
  246. EXEC_IN_CHAOS_KNIGHT_APPEARING = ""
  247.  
  248. def PlayerAppears():
  249.     import Scorer
  250.     global EXEC_IN_PLAYER_APPEARING
  251.  
  252.     darfuncs.UnhideBadGuy("Player1")
  253.     GenFX.PersonMagicallyAppearing()
  254.     Bladex.AddScheduledFunc(Bladex.GetTime()+2.0, Bladex.ActivateInput, ())
  255.     Bladex.AddScheduledFunc(Bladex.GetTime()+2.0, Scorer.SetVisible, (1,))
  256.     if EXEC_IN_PLAYER_APPEARING:
  257.         EXEC_IN_PLAYER_APPEARING()
  258.  
  259. def PrevPlayerAppears():
  260.     import Scorer
  261.  
  262.     global TIME_BEFORE_PLAYER_APPEARING
  263.  
  264.     darfuncs.HideBadGuy("Player1")
  265.     Scorer.SetVisible(0)
  266.     Bladex.DeactivateInput()
  267.     AuxFuncs.FadeFrom(2.0, TIME_BEFORE_PLAYER_APPEARING)    
  268.  
  269.     Bladex.AddScheduledFunc(Bladex.GetTime()+TIME_BEFORE_PLAYER_APPEARING+2.0, PlayerAppears, ())
  270.  
  271. def PrepareChaosAppears():
  272.     global CHAOS_KNIGHT_POSITION
  273.     global CHAOS_KNIGHT_ANGLE
  274.     global CHAOS_KNIGHT_ACTIVATE
  275.     global CHAOS_KNIGHT_DEACTIVATE
  276.     global CHAOS_KNIGHT_LEVEL
  277.     
  278.     CreateChaosKnightBak(CHAOS_KNIGHT_POSITION,CHAOS_KNIGHT_ANGLE)
  279.     Blood.Evaporation = 1
  280.     #Menu.BackMap()    
  281.  
  282.     Bladex.AddScheduledFunc(Bladex.GetTime(), PrevPlayerAppears, ())
  283.     
  284.     for pos in CHAOS_KNIGHT_ACTIVATE:
  285.         darfuncs.EnterSecIdEvent(pos,AppearsChaosKnightBak)
  286.  
  287. def AddChaosAppearsSector(x,y,z):
  288.     global CHAOS_KNIGHT_ACTIVATE
  289.  
  290.     CHAOS_KNIGHT_ACTIVATE.append(Bladex.GetSector(x,y,z).Index)
  291.  
  292. def AddChaosAppearsTSector(id):
  293.     global CHAOS_KNIGHT_ACTIVATE
  294.  
  295.     CHAOS_KNIGHT_ACTIVATE.append(id)
  296.  
  297. def AddChaosDisappearsSector(x,y,z):
  298.     global CHAOS_KNIGHT_DEACTIVATE
  299.  
  300.     CHAOS_KNIGHT_DEACTIVATE.append(Bladex.GetSector(x,y,z).Index)
  301.  
  302. def AddChaosDisappearsTSector(id):
  303.     global CHAOS_KNIGHT_DEACTIVATE
  304.  
  305.     CHAOS_KNIGHT_DEACTIVATE.append(id)
  306.  
  307. def DeactivateChaos():
  308.     global ChaosKnightActivated
  309.     
  310.     ChaosKnightActivated = 0
  311.  
  312. def AddChaosDeactivationTs(id):
  313.     darfuncs.EnterSecIdEvent(id,DeactivateChaos)
  314.  
  315.  
  316.  
  317. ############################
  318. #                          #
  319. #      Little demons       #
  320. #            &             #
  321. #         Vampires         #
  322. #                          #
  323. ############################
  324.  
  325.  
  326. ##### Appears FX #####
  327.  
  328. Bladex.ReadBitMap("..\\..\\Data\\SmokePrtl3.bmp","SmokePart3")
  329. Bladex.AddParticleGType("DeathCloud","SmokePart3",Reference.B_PARTICLE_GTYPE_MUL,16)
  330.  
  331.  
  332. for i in range(16):
  333.     aux=(16.0-i)/16
  334.     r=255
  335.     g=255
  336.     b=255
  337.     a=0
  338.     if aux < 0.5:
  339.         size = aux*512
  340.     else:
  341.         size = (1-aux)*512
  342.     Bladex.SetParticleGVal("DeathCloud",i,r,g,b,a,size)
  343.  
  344. def DeathAppears(PersonName = "Player1",pos=(0,0,0)):
  345.     time=Bladex.GetTime()
  346.     aura=Auras.MakeAura(PersonName,0.4,   ( 50, 1.0 , 0.0, 0, 0, 0), (), (), (2,  0.9, 0.9, 0.0, 0.9, 0.0  ,  0.9, 0.9, 0.0, 0.9, 0.8))
  347.     aura.Data.AddEvent(time+0.2,          (150, 0.5 , 0.0, 0, 0, 0), (), (), (2,  0.9, 0.9, 0.0, 0.9, 0.0  ,  0.9, 0.9, 0.0, 0.9, 0.8))
  348.     aura.Data.AddEvent(time+0.4,          (200, 0.01, 0.0, 0, 0, 0), (), (), (2,  0.9, 0.9, 0.0, 0.9, 0.0  ,  0.9, 0.9, 0.0, 0.9, 0.8))
  349.  
  350.     wps=Bladex.CreateEntity(PersonName+"WPS", "Entity Particle System Dperson", 0.0, 0.0, 0.0)
  351.     wps.PersonName=PersonName
  352.     wps.ParticleType="DeathCloud"
  353.     wps.Time2Live=16
  354.     wps.RandomVelocity=2.0
  355.     wps.Velocity=0,0,0
  356.     wps.NormalVelocity=20
  357.     wps.YGravity=0
  358.     wps.DeathTime=Bladex.GetTime()+0.25
  359.     wps.PPS=1024
  360.     per = Bladex.GetEntity(PersonName)
  361.     darfuncs.UnhideBadGuy(per.Name)
  362.     per.Alpha = 1.0
  363.     per.SetTmpAnmFlags(1,1,1,0,5,1,0)
  364.     per.Wuea=Reference.WUEA_ENDED
  365.     per.LaunchAnmType("rlx")
  366.     per.Position = pos
  367.     per.SetOnFloor()
  368.     per.SetActiveEnemy("Player1")
  369.     Actions.TurnToFaceEntityNow(per.Name,"Player1")
  370.     _AppearsCagazo.Play(per.Position[0], per.Position[1], per.Position[2], 0)
  371.     
  372. def DeathDisappears(PersonName = "Player1"):
  373.     wps=Bladex.CreateEntity(PersonName+"WPS", "Entity Particle System Dperson", 0.0, 0.0, 0.0)
  374.     wps.PersonName=PersonName
  375.     wps.ParticleType="DeathCloud"
  376.     wps.Time2Live=16
  377.     wps.RandomVelocity=2.0
  378.     wps.Velocity=0,0,0
  379.     wps.NormalVelocity=2
  380.     wps.YGravity=0
  381.     wps.DeathTime=Bladex.GetTime()+0.25
  382.     wps.PPS=1024
  383.     per = Bladex.GetEntity(PersonName)    
  384.     per.Data.InteruptActions(per.Name)
  385.     darfuncs.HideBadGuy(per.Name)
  386.     _AppearsCagazo.Play(per.Position[0], per.Position[1], per.Position[2], 0)
  387.     
  388.  
  389.             
  390. ##### Sector controllers #####
  391.  
  392. SECTOR_PROCS       = {}
  393.  
  394. LastSectorIdx      = None
  395. SECTOR_COUNT       = {}
  396.  
  397. def RemoveSector(idx):
  398.     global SECTOR_PROCS
  399.     
  400.     if SECTOR_PROCS.has_key(idx):
  401.         del  SECTOR_PROCS[idx]
  402.  
  403. def AddSectorCount(pos,Demons,Vampires):
  404.     global SECTOR_COUNT
  405.     
  406.     idx = GetSectorIdx(pos)
  407.     SECTOR_COUNT[idx] = [Demons,Vampires,[]]
  408.     return idx
  409.     
  410. def AddSectorDelete(idx,pos):
  411.     global SECTOR_COUNT
  412.     
  413.     SECTOR_COUNT[idx][2].append(GetSectorIdx(pos))
  414.  
  415. def OnEnterSectorProc(sector):
  416.     global SECTOR_PROCS
  417.     global SECTOR_COUNT
  418.     global LastSectorIdx
  419.     
  420.     if SECTOR_PROCS.has_key(sector):
  421.         if SECTOR_COUNT.has_key(sector):
  422.             LastSectorIdx = sector
  423.  
  424.         for i in SECTOR_PROCS[sector]:
  425.             apply(i[0],i[1])
  426.         
  427.         for i in SECTOR_PROCS.keys():
  428.             if i != sector:
  429.                 darfuncs.EnterSecIdEvent(i,OnEnterSectorProc)
  430.  
  431. def ActivateSectorProcs():
  432.     global SECTOR_PROCS
  433.     
  434.     for i in SECTOR_PROCS.keys():
  435.         darfuncs.EnterSecIdEvent(i,OnEnterSectorProc)
  436.     
  437. def AddSectorFunction(pos,func,param):
  438.     global SECTOR_PROCS
  439.  
  440.     idx = GetSectorIdx(pos)
  441.     if SECTOR_PROCS.has_key(idx):
  442.         SECTOR_PROCS[idx].append((func,param))
  443.     else:
  444.         SECTOR_PROCS[idx] =[(func,param)]
  445.  
  446. ##### Enemies controller #####
  447. L_Vamp             = []
  448. L_Little_Demon     = []
  449.  
  450. def AddVampires(Num,ValidPos,Level):
  451.     global L_Vamp
  452.  
  453.     for i in range(Num):
  454.         pers=Bladex.CreateEntity("VMP_"+`Level`+"_"+`i`,"Vamp",ValidPos[0],ValidPos[1],ValidPos[2],"Person")
  455.         pers.Angle=6.26312373572
  456.         pers.Level=Level
  457.         
  458.         Cimitarra1=Bladex.CreateEntity("VampWeapon"+`Level`+"_"+`i`,"VampWeapon",0,0,0,"Weapon")
  459.         VampShield=Bladex.CreateEntity("VampShield"+`Level`+"_"+`i`,"VampShield",0,0,0,"Weapon")
  460.         ItemTypes.ItemDefaultFuncs(Cimitarra1)
  461.         ItemTypes.ItemDefaultFuncs(VampShield)
  462.         Actions.TakeObject(pers.Name,Cimitarra1.Name)
  463.         Actions.TakeObject(pers.Name,VampShield.Name)
  464.         
  465.         #pers.ActionAreaMin=pow(2,2)
  466.         #pers.ActionAreaMax=pow(2,3)
  467.         EnemyTypes.EnemyDefaultFuncs(pers)
  468.         pers.SetOnFloor()
  469.         darfuncs.HideBadGuy(pers.Name)
  470.         pers.ImDeadFunc = MuerteBichoMolesto
  471.         
  472.         L_Vamp.append([pers.Name,0])
  473.  
  474. def AddDemons(Num,ValidPos,Level):
  475.     global L_Little_Demon
  476.  
  477.     for i in range(Num):
  478.         pers=Bladex.CreateEntity("Little_Demon_"+`Level`+"_"+`i`,"Little_Demon",ValidPos[0],ValidPos[1],ValidPos[2],"Person")
  479.         pers.Angle=6.26312373572
  480.         pers.Level=Level
  481.         #pers.ActionAreaMin=pow(2,2)
  482.         #pers.ActionAreaMax=pow(2,3)
  483.         EnemyTypes.EnemyDefaultFuncs(pers)
  484.         pers.SetOnFloor()
  485.         pers.ImDeadFunc = MuerteBichoMolesto
  486.         darfuncs.HideBadGuy(pers.Name)
  487.         
  488.         L_Little_Demon.append([pers.Name,0])
  489.  
  490. # Aparicion de un enemigo
  491. def EnemyAppear(List,Position,Time):
  492.     EneName = None
  493.     for i in List:
  494.         if not i[1]:
  495.             i[1]    = 1
  496.             EneName = i[0]
  497.             break
  498.     if EneName:        
  499.         Actions.TurnToFaceEntityNow(EneName,"Player1")
  500.         darfuncs.HideBadGuy(EneName)
  501.         Bladex.AddScheduledFunc(Bladex.GetTime()+Time, DeathAppears,(EneName,Position))
  502.         print "EnemyAppear ",EneName
  503.  
  504.  
  505. def HideEnemies():
  506.     print "HideEnemies"
  507.     global L_Little_Demon
  508.     global L_Vamp
  509.     
  510.     for i in L_Vamp:
  511.         if i[1]:
  512.             DeathDisappears(i[0])
  513.             i[1] = 0
  514.     for i in L_Little_Demon:
  515.         if i[1]:
  516.             DeathDisappears(i[0])
  517.             i[1] = 0
  518.  
  519.  
  520. def HideEnemiesSector(pos):
  521.     AddSectorFunction(pos,HideEnemies,())
  522.     
  523.  
  524. def AddVampireAppears(secPos,enePos,Time):
  525.     global L_Vamp
  526.     AddSectorFunction(secPos,EnemyAppear,(L_Vamp,enePos,Time))
  527.  
  528. def AddDemonAppears(secPos,enePos,Time):
  529.     global L_Little_Demon
  530.     AddSectorFunction(secPos,EnemyAppear,(L_Little_Demon,enePos,Time))
  531.  
  532. def MuerteBichoMolesto(Name):
  533.     global L_Little_Demon
  534.     global L_Vamp
  535.     global SECTOR_COUNT
  536.     global LastSectorIdx
  537.  
  538.     me = Bladex.GetEntity(Name)
  539.     if me.Kind == "Vamp":
  540.         for i in L_Vamp:
  541.             if i[0]==Name:
  542.                 L_Vamp.remove(i)
  543.                 break
  544.                 
  545.         DeathDisappears(Name)        
  546.         Bladex.AddScheduledFunc(Bladex.GetTime()+1.0, me.SubscribeToList,("Pin",))
  547.         SECTOR_COUNT[LastSectorIdx][1] = SECTOR_COUNT[LastSectorIdx][1]-1
  548.         if SECTOR_COUNT[LastSectorIdx][1] == 0:
  549.             for idsec in SECTOR_COUNT[LastSectorIdx][2]:
  550.                 RemoveSector(idsec)
  551.             ActivateSectorProcs()
  552.         
  553.     else:
  554.         for i in L_Little_Demon:
  555.             if i[0]==Name:
  556.                 L_Little_Demon.remove(i)
  557.                 break
  558.         me.Data.ImDeadFunc(Name)
  559.         SECTOR_COUNT[LastSectorIdx][0] = SECTOR_COUNT[LastSectorIdx][0]-1
  560.         if SECTOR_COUNT[LastSectorIdx][0] == 0:
  561.             for idsec in SECTOR_COUNT[LastSectorIdx][2]:
  562.                 RemoveSector(idsec)
  563.             ActivateSectorProcs()
  564.                 
  565.  
  566.  
  567.  
  568. def SaveData(filename):
  569.   import cPickle
  570.  
  571.   funcfile=open(filename,"wt")
  572.   p=cPickle.Pickler(funcfile)
  573.   d=(_AppearsCagazo,ChaosKnightActivated,CHAOS_KNIGHT_LEVEL,
  574.      CHAOS_KNIGHT_POSITION,CHAOS_KNIGHT_ANGLE,CHAOS_KNIGHT_ACTIVATE,
  575.      CHAOS_KNIGHT_DEACTIVATE,TIME_BEFORE_PLAYER_APPEARING,
  576.      EXEC_IN_PLAYER_APPEARING,EXEC_IN_CHAOS_KNIGHT_APPEARING,
  577.      SECTOR_PROCS,LastSectorIdx,SECTOR_COUNT,L_Vamp,L_Little_Demon)
  578.  
  579.   
  580.   p.dump(d)
  581.   funcfile.close()
  582.  
  583.  
  584.  
  585. def LoadData(filename):
  586.   import cPickle
  587.  
  588.   global _AppearsCagazo
  589.   global ChaosKnightActivated
  590.   global CHAOS_KNIGHT_LEVEL
  591.   global CHAOS_KNIGHT_POSITION
  592.   global CHAOS_KNIGHT_ANGLE
  593.   global CHAOS_KNIGHT_ACTIVATE
  594.   global CHAOS_KNIGHT_DEACTIVATE
  595.   global TIME_BEFORE_PLAYER_APPEARING
  596.   global EXEC_IN_PLAYER_APPEARING
  597.   global EXEC_IN_CHAOS_KNIGHT_APPEARING
  598.   global SECTOR_PROCS
  599.   global LastSectorIdx
  600.   global SECTOR_COUNT
  601.   global L_Vamp
  602.   global L_Little_Demon
  603.  
  604.   funcfile=open(filename,"rt")
  605.   p=cPickle.Unpickler(funcfile)
  606.   d=p.load()
  607.   funcfile.close()
  608.   print d
  609.  
  610.   
  611.   _AppearsCagazo                 = d[ 0]
  612.   ChaosKnightActivated           = d[ 1]
  613.   CHAOS_KNIGHT_LEVEL             = d[ 2]
  614.   CHAOS_KNIGHT_POSITION          = d[ 3]
  615.   CHAOS_KNIGHT_ANGLE             = d[ 4]
  616.   CHAOS_KNIGHT_ACTIVATE          = d[ 5]
  617.   CHAOS_KNIGHT_DEACTIVATE        = d[ 6]
  618.   TIME_BEFORE_PLAYER_APPEARING   = d[ 7]
  619.   EXEC_IN_PLAYER_APPEARING       = d[ 8]
  620.   EXEC_IN_CHAOS_KNIGHT_APPEARING = d[ 9]
  621.   SECTOR_PROCS                   = d[10]
  622.   LastSectorIdx                  = d[11]
  623.   SECTOR_COUNT                   = d[12]
  624.   L_Vamp                         = d[13]
  625.   L_Little_Demon                 = d[14]
  626.   
  627. """
  628. #
  629. # Sample of Enemies at back map
  630. #
  631.  
  632. import BackMisc
  633.  
  634. #
  635. # CHAOS KNIGHT
  636. #
  637.  
  638. BackMisc.CHAOS_KNIGHT_LEVEL       = 1
  639. BackMisc.CHAOS_KNIGHT_POSITION    = 16230.9184998, -735.695860989, 39699.5778343
  640. BackMisc.CHAOS_KNIGHT_ANGLE       = 0
  641.  
  642. BackMisc.AddChaosDisappearsSector(15239.4035073, -2747.16516658, 57256.1186163)
  643. BackMisc.AddChaosDisappearsSector(253.269773313, -2663.49693091, 39305.8229719)
  644. BackMisc.AddChaosDisappearsSector(15874.8334796, -1229.29468164, 19106.6487786)
  645. BackMisc.AddChaosDisappearsSector(29467.4856681, -2729.42212464, 39537.9079875)
  646.  
  647. BackMisc.AddChaosAppearsSector(16230.9184998, -735.695860989, 39699.5778343)
  648.  
  649. BackMisc.AddChaosDeactivationTs("ChauCaos")
  650.  
  651. BackMisc.PrepareChaosAppears()
  652.  
  653. #
  654. # Vampire and demons
  655. #
  656.  
  657. BackMisc.AddVampires(5,(15159, -1133, 1923),0)
  658. BackMisc.AddDemons(5,(15159, -1133, 1923),0)
  659.  
  660. idx = BackMisc.AddSectorCount(   (15417, -2189, 53450),1,1)
  661. BackMisc.AddSectorDelete(idx,(15417, -2189, 53450))
  662.     
  663. BackMisc.HideEnemiesSector((15417, -2189, 53450))
  664. BackMisc.AddDemonAppears  ((15417, -2189, 53450),( 9325, -2669, 59723),0.1)
  665. BackMisc.AddDemonAppears  ((15417, -2189, 53450),(25242, -2690, 59909),0.5)
  666. BackMisc.AddVampireAppears((15417, -2189, 53450),(16000, -2671, 65675),1.0)
  667.  
  668. BackMisc.HideEnemiesSector((15703, -690, 42391))
  669.  
  670. BackMisc.ActivateSectorProcs()
  671. # BackMisc.EnemyAppear(BackMisc.L_Little_Demon,( 9325, -2669, 59723),0.1)
  672. # BackMisc.HideEnemies()
  673. # BackMisc.L_Little_Demon
  674. # BackMisc.L_Vamp
  675.     
  676. def CambiaSangre(pos,c,dc):
  677.     for l in Bladex.GetEntitiesAt(pos[0],pos[1],pos[2],10000):
  678.         o = Bladex.GetEntity(l)
  679.         if o.Kind == 'Entity Pool':
  680.             print o.Color,o.DeepColor
  681.             o.DeepColor = dc
  682.             o.Color     = c
  683.  
  684. CambiaSangre(char.Position,(0,0,0),(0,0,0))
  685.  
  686.  
  687. """
  688. import GameState
  689. GameState.ModulesToBeSaved.append(__import__(__name__))
  690.