Advertisement
NSKuber

Untitled

Nov 3rd, 2020
711
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.94 KB | None | 0 0
  1. -- Pillars destroyed
  2. On (CustomEvent("Destroy Pillars")),
  3. function()
  4.   if Pillar01:IsDestroyed()
  5.   then
  6.     print ("Trial Beast has destroyed one of the pillars!")
  7.     if not Pillar02:IsDestroyed()
  8.     then
  9.       BridgeHolder:DestroyOnePhase(false)
  10.       TrialPit_Bridge:DestroyOnePhase(false)
  11.       Sound_BridgePhase:PlayOnce()
  12.       ForceField:Enable()
  13.       Wait(Delay(3))
  14.       ForceField:Disable()
  15.     end    
  16.   else
  17.       print ("Kill the beast!")
  18.   end
  19.  
  20.   if Pillar02:IsDestroyed()
  21.   then
  22.     print ("Trial Beast has destroyed one of the pillars!")
  23.     if not Pillar01:IsDestroyed()
  24.     then
  25.       BridgeHolder:DestroyOnePhase(false)
  26.       TrialPit_Bridge:DestroyOnePhase(false)
  27.       Sound_BridgePhase:PlayOnce()
  28.       ForceField:Enable()
  29.       Wait(Delay(3))
  30.       ForceField:Disable()
  31.     end    
  32.   else
  33.       print ("Kill the beast!")
  34.   end
  35. end,
  36.  
  37. -- Collapse the bridge when all pillars have been destroyed
  38. On (CustomEvent("Bridge Collapse")),
  39. function()
  40.   if Pillar01:IsDestroyed() and Pillar02:IsDestroyed()
  41.   then
  42.     AnimatedMover_Bridge:PlayAnimWait("Bridge_Fall")
  43.     Sound_BridgeCollapse:PlayOnce()
  44.     Sound_BridgeCollapse_2:PlayOnce()
  45.     Wait(Delay(0.1))
  46.     -- WorldInfo : CWorldInfoEntity
  47.     local WorldInfo = TrialPit_Bridge:GetWorldInfo()
  48.     local TrialBeast_Script = WorldInfo:GetEntityByName("TrialBeast_Boss")
  49.     local vMover = TrialPit_Bridge:GetPlacement():GetVect()
  50.     print ("mover", vMover.x, vMover.y, vMover.z)
  51.     for i, B in ipairs(TrialBeast_Script) do -- B : CLeggedPuppetEntity
  52.       local vP = B:GetPlacement():GetVect()
  53.       print ("Trial Beast", vP.x, vP.y, vP.z)
  54.       local v = vP-vMover
  55.       print ("delta", v.x, v.y, v.z)
  56.       if v.y<0 and mthAbsF(v.x)<6 and mthAbsF(v.z)<14.9 then
  57.       print ("   killed")
  58.       B:InflictDamageOfType(500000, "Crushing")      
  59.       end
  60.     end
  61.     Wait(Delay(0.6))
  62.     Sound_BridgeImpact:PlayOnce()  
  63.     --Shaker  
  64.   end
  65. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement