Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --#NoSimplerr#
- //////////////////////////////////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////////////////////////////////
- local Bossfight_ON = false
- local BossTable = {}
- local BossPlayers = {}
- local BossConfig = {}
- local BossAmount = 0
- //////////////////////////////////////////////////////////////////////////////////////////////////////
- // DO NOT TOUCH THE ABOVE EVERYTHING BELOW IS YOUR CONFIG
- //////////////////////////////////////////////////////////////////////////////////////////////////////
- BossConfig.RandomEvenTimerDelay = 600 // How long in seconds for the timer to show??
- BossConfig.QuestionTimerExecute = 30 // How long do players have to press "Yes/No" on the question
- BossConfig.Weapons = "m9k_damascus" // Weapon to give for the battle
- BossConfig.AmmoType = "m9k_ammo_ar2" // The ammo type
- BossConfig.AmmoAmount = 1000 // The amount of ammo
- ///////////////////////////////////////////////////
- // setup boss spawn
- ///////////////////////////////////////////////////
- BossConfig.BossSpawnLocation = {
- Location = Vector( 2564.115967, -5777.277832, -139.968750 ),
- Rotation = Angle( 1.000158, 179.371475, 0.000000 ),
- }
- ///////////////////////////////////////////////////
- // setup player spawn
- ///////////////////////////////////////////////////
- BossConfig.RandomBossLocations = {
- [1] = {
- Location = Vector( 2534.586914, -6437.153809, -139.968750 ),
- Rotation = Angle( 3.640159, 88.379517, 0.000000 ),
- },
- [2] = {
- Location = Vector( 2631.916504, -4900.906738, -139.968750 ),
- Rotation = Angle( 2.760150, -91.396408, 0.000000 ),
- },
- [3] = {
- Location = Vector( 1928.431030, -5777.270996, -139.968750 ),
- Rotation = Angle( -0.231841, 1.179271, 0.000000 ),
- },
- }
- ///////////////////////////////////////////////////
- // boss setup
- ///////////////////////////////////////////////////
- BossConfig.BossFights = {
- [1] = {
- Name = "Soul Of Cinder", // The boss name to print into chat
- BossEntity = "npc_vj_ds3_cinder", // The boss Entity(number entityIndex)
- Health = 20000, // Their HP
- XP_Gain = 2000, // XP Gain
- RP_Cash = 30000, // Kill Ammount
- NumberOfBoss = 1, // How many do we spawn
- },
- [2] = {
- Name = "Slave Knight Gael",
- BossEntity = "npc_vj_ds3_slaveknight",
- Health = 30000,
- XP_Gain = 3000,
- RP_Cash = 40000,
- NumberOfBoss = 1,
- },
- [3] = {
- Name = "Champion Gundyr",
- BossEntity = "npc_vj_ds3_gundyr",
- Health = 35000,
- XP_Gain = 3000,
- RP_Cash = 40000,
- NumberOfBoss = 1,
- },
- [4] = {
- Name = "Abyss Watchers",
- BossEntity = "npc_vj_ds3_aw",
- Health = 20000,
- XP_Gain = 3000,
- RP_Cash = 10000,
- NumberOfBoss = 1,
- }
- }
- ///////////////////////////////////////////////////
- // server code below
- ///////////////////////////////////////////////////
- local function BossKilled( npc, killer )
- if Bossfight_ON && npc:GetClass() == BossTable.BossEntity then
- if IsValid(killer) then
- killer:addMoney( BossTable.RP_Cash )
- DarkRP.notify( killer, 2, 6, "You have received " .. BossTable.RP_Cash .. " XP for participating in the boss fight!" )
- DarkRP.notify( killer, 2, 6, "You have received " .. DarkRP.formatMoney( BossTable.XP_Gain ) .. " for participating in the boss fight!" )
- end
- // These hooks handle our event, make sure to rid of them when the boss dies
- hook.Remove("OnNPCKilled", "RP.BoosFights.OnNPCKilledFight" )
- hook.Remove("Think", "RP.BossFights.CheckIfAllAreGone" )
- hook.Remove("PlayerSpawn", "RP.BossFight.PlayerDiedSpawn" )
- timer.Remove( "RP.BossFight_DoTimerEnd" )
- for k, v in pairs( BossPlayers ) do
- v:Spawn()
- end
- BossTable = {} // Empty our boss selection
- BossPlayers = {} // Empty our table
- Bossfight_ON = false
- end
- end
- local function BossThink( npc, killer )
- if Bossfight_ON then
- if #BossPlayers == 0 then
- Bossfight_ON = false
- DarkRP.notifyAll( 1, 5, "The boss fight has ended!" )
- // These hooks handle our event, make sure to rid of them when the boss dies
- hook.Remove("OnNPCKilled", "RP.BoosFights.OnNPCKilledFight" )
- hook.Remove("Think", "RP.BossFights.CheckIfAllAreGone" )
- hook.Remove("PlayerSpawn", "RP.BossFight.PlayerDiedSpawn" )
- timer.Remove( "RP.BossFight_DoTimerEnd" )
- end
- end
- end
- local function PlayerSpawnBoss( ply )
- if Bossfight_ON && ply.BossFightSpawn then
- timer.Simple( 0, function()
- ply:SetPos( DarkRP.findEmptyPos(ply.BossFightSpawn, {ply}, 600, 30, Vector(16, 16, 64)) )
- ply:Give( BossConfig.Weapons )
- for i = 1, 3 do
- ply:GiveAmmo( BossConfig.AmmoAmount, BossConfig.AmmoType, false )
- end
- end )
- end
- end
- local TeleportStartIndex = 1
- local function doBossFight()
- if #BossPlayers == 0 then
- DarkRP.notifyAll( 1, 5, "No one entered the boss fight!" )
- return
- end
- local NPC_ENT = ents.Create( BossTable.BossEntity )
- NPC_ENT:SetHealth( BossTable.Health )
- NPC_ENT:SetPos( BossConfig.BossSpawnLocation.Location )
- NPC_ENT:SetAngles( BossConfig.BossSpawnLocation.Rotation )
- NPC_ENT:Spawn()
- Bossfight_ON = true
- TeleportStartIndex = 1 -- start a 1
- for k, v in pairs( BossPlayers ) do
- v.BossFightSpawn = BossConfig.RandomBossLocations[TeleportStartIndex].Location
- v:SetPos( DarkRP.findEmptyPos(v.BossFightSpawn, {v}, 600, 30, Vector(16, 16, 64)) )
- v:StripWeapons()
- v:Give( BossConfig.Weapons )
- for i = 1, 3 do
- v:GiveAmmo( BossConfig.AmmoAmount, BossConfig.AmmoType, false )
- end
- TeleportStartIndex = TeleportStartIndex + 1 // First index, then we skip to the next index
- if TeleportStartIndex && TeleportStartIndex > #BossConfig.RandomBossLocations then
- TeleportStartIndex = 1 // Reset it back to 1 just incase errors
- end
- end
- hook.Add("OnNPCKilled", "RP.BoosFights.OnNPCKilledFight", BossKilled )
- hook.Add("PlayerSpawn", "RP.BossFight.PlayerDiedSpawn", PlayerSpawnBoss )
- hook.Add("Think", "RP.BossFights.CheckIfAllAreGone", BossThink )
- timer.Create("RP.BossFight_DoTimerEnd", 300, 1, function ()
- if Bossfight_ON then
- // These hooks handle our event, make sure to rid of them when the boss expires
- hook.Remove("OnNPCKilled", "RP.BoosFights.OnNPCKilledFight" )
- hook.Remove("Think", "RP.BossFights.CheckIfAllAreGone" )
- hook.Remove("PlayerSpawn", "RP.BossFight.PlayerDiedSpawn" )
- for k, v in pairs( BossPlayers ) do
- v:Spawn()
- end
- BossTable = {} // Empty our boss selection
- BossPlayers = {} // Empty our table
- Bossfight_ON = false
- DarkRP.notifyAll( 1, 5, "The timer has run out, thus ending the boss fight! (No rewards)" )
- end
- end )
- end
- local function doBossFightQuestion(answer, player, initiator, target, Trigger)
- if tobool(answer) && !BossPlayers[player:EntIndex()] && ( #BossPlayers != #BossConfig.RandomBossLocations ) then
- BossPlayers[player:EntIndex()] = player
- player:ChatPrint("You have entered the fight!")
- elseif answer ~= nil and !BossPlayers[player:EntIndex()] or ( #BossPlayers == #BossConfig.RandomBossLocations ) then
- BossPlayers[player:EntIndex()] = nil // Possible fall back to possible future bullshit
- player:ChatPrint("You have chosen not to fight!")
- end
- if tobool( Trigger ) then
- doBossFight()
- end
- end
- local function questionEnterBossFight()
- if Bossfight_ON then return end
- BossTable = BossConfig.BossFights[math.random(#BossConfig.BossFights)]
- BossAmount = BossTable.NumberOfBoss // How many are we spawning?
- for k, v in pairs( player.GetAll() ) do
- v:ChatPrint( "Boss: " .. BossTable.Name )
- v:ChatPrint( "Cash Reward: " .. DarkRP.formatMoney( BossTable.RP_Cash ) )
- v:ChatPrint( "XP Gain: " .. BossTable.XP_Gain )
- DarkRP.createQuestion("Enter Boss Fight?", "rp.boosfights_" .. tostring(k), v, BossConfig.QuestionTimerExecute or 15, doBossFightQuestion, nil, nil)
- end
- timer.Create("BossFights_RP", BossConfig.QuestionTimerExecute or 15, 1, function() doBossFightQuestion( nil, nil, nil, nil, true ) end)
- end
- timer.Create("RP.BoosFights.CheckQuestion", BossConfig.RandomEvenTimerDelay or 5, 0, function()
- questionEnterBossFight()
- end )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement