Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local time = GetDateTimeLocal()
- local seed = 3600*tonumber(string.sub(time,-8,-7))+60*tonumber(string.sub(time,-5,-4))+tonumber(string.sub(time,-2,-1))
- local RNG = CreateRandomNumberGenerator(seed + mthTruncF(mthRndF() * 1000))
- local rndIntRange = function(a,b)
- return (mthFloorF(RNG:RndF()*(b-a+1)) % (b-a+1) + a)
- end
- local Math = worldGlobals.Math
- local resSpawnTemplates = worldGlobals.worldInfo:LoadResource(Depfile("Content/7SmokeTennis2017_Blue/Levels/10_Tenebriaquies/Scripts/NightmareLord/Templates/Beam.rsc"))
- --Gets properties for player variable
- -- player : CPlayerPuppetEntity
- -- NightmareLord : CPuppetEntity
- -- BeamMarkerVar : CPathMarkerEntity
- -- BeamBaseVar :CParticleEffectEntity
- -- BeamVar :CParticleEffectEntity
- -- resSpawnTemplates : CTemplatePropertiesHolder
- --local variables
- local player = nil
- local NightmareLord = nil
- local playerplacement = nil
- local LordPos = nil
- local BeamMarkerVar = nil
- local BeamBaseVar = nil
- local BeamVar = nil
- --PillarDamageScriptByRyason
- local PillarDamager = --Damages players within a XZ radius of a marker for an amount of time
- function(OwnerPuppet,Marker,DamagerRadius,Damage,DamageTime,LifeTime)
- RunAsync( function()
- local Vect_Marker = Marker:GetPlacement():GetVect()
- Vect_Marker.y = 0
- local StartTime = worldInfo:SimNow()
- local LastDamageTime = worldInfo:SimNow()
- while timDifference(worldInfo:SimNow(),StartTime) <= LifeTime do
- if timDifference(worldInfo:SimNow(),LastDamageTime) >= DamageTime then
- local RealDamage = mthFloorF(timDifference(worldInfo:SimNow(),LastDamageTime)/DamageTime)*Damage
- LastDamageTime = worldInfo:SimNow()
- local AllChars = worldInfo:GetCharacters("","",Marker,100)
- for i = 1,#AllChars,1 do
- if not ((AllChars[i] == OwnerPuppet) or IsDeleted(AllChars[i])) then
- local BoundingBox = AllChars[i]:GetBoundingBoxSize()
- local CharRadius = (BoundingBox.x + BoundingBox.z) / 4
- local Vect_Puppet = AllChars[i]:GetPlacement():GetVect()
- Vect_Puppet.y = 0
- local Distance = mthLenV3f(Vect_Marker-Vect_Puppet)
- if (Distance - CharRadius) <= DamagerRadius then
- if not ((OwnerPuppet == nil) or IsDeleted(OwnerPuppet)) then
- OwnerPuppet:InflictDamageToTarget(AllChars[i],RealDamage,-1,"Piercing")
- else
- AllChars[i]:InflictDamageOfType(RealDamage,"Piercing")
- end
- end
- end
- end
- end
- Wait(CustomEvent("OnStep"))
- end
- end)
- end
- worldGlobals.CreateRPC("server", "reliable", "RPCBeam", function(BeamPos)
- RunAsync(function()
- local BeamMarkerVar = resSpawnTemplates:SpawnEntityFromTemplateByName("BeamMarker", worldGlobals.worldInfo, BeamPos)
- local BeamBaseVar = resSpawnTemplates:SpawnEntityFromTemplateByName("BeamBase", worldGlobals.worldInfo, BeamPos)
- local BeamVar = resSpawnTemplates:SpawnEntityFromTemplateByName("Beam", worldGlobals.worldInfo, BeamPos)
- BeamBaseVar:SetParent(BeamMarkerVar)
- BeamVar:SetParent(BeamMarkerVar)
- BeamMarkerVar:SetPlacement(LordPos)
- Wait(Delay(1))
- if worldGlobals.netIsHost then
- PillarDamager(NightmareLord, BeamMarkerVar, 1.375, 1, 0.06, 3)
- end
- Wait(Delay(4))
- if not IsDeleted(BeamMarkerVar) then BeamMarkerVar:Delete() end
- if not IsDeleted(BeamBaseVar) then BeamBaseVar:Delete() end
- if not IsDeleted(BeamVar) then BeamVar:Delete() end
- end)
- end)
- --Sets up the Spawnee for scripting
- RunHandled(WaitForever,
- On(Event(NightmareLordSpawnee.SpawneeAvailable)),
- function(SpawnedEvent)
- NightmareLord = SpawnedEvent:GetSpawnedEntity()
- RunHandled(
- function()
- Wait(Event(NightmareLord.Died))
- end,
- --Starts script on Macro Event
- OnEvery(CustomEvent(NightmareLord, "LaserWave")),
- function()
- local LordPos = NightmareLord:GetPlacement()
- for i=1,16,1 do
- if IsDeleted(NightmareLord) then break end
- if not NightmareLord:IsAlive() then break end
- local fRadius = RNG:RndF()*30 + 5
- local fAngle = RNG:RndF()*360
- local BeamPos = mthCloneQV(LordPos)
- BeamPos.vx = BeamPos.vx + mthSinF(mthDegToRad(fAngle))*fRadius
- BeamPos.vz = BeamPos.vz + mthCosF(mthDegToRad(fAngle))*fRadius
- worldGlobals.RPCBeam(BeamPos)
- Wait(Delay(0.5*(1+RNG:RndF())))
- end
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement