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 = 300 // How long in seconds for the timer to show??
- BossConfig.QuestionTimerExecute = 60 // How long do players have to press "Yes/No" on the question
- BossConfig.Weapons = "m9k_acr" // Weapon to give for the battle
- BossConfig.AmmoType = "ar" // The ammo type
- BossConfig.AmmoAmount = 500 // The amount of ammo
- ///////////////////////////////////////////////////
- // setup boss spawn
- ///////////////////////////////////////////////////
- BossConfig.BossSpawnLocation = {
- Location = Vector( -6003.359375, -8062.643555, 128.025848 ),
- Rotation = Angle( 0, -90, 0 ),
- }
- ///////////////////////////////////////////////////
- // setup player spawn
- ///////////////////////////////////////////////////
- BossConfig.RandomBossLocations = {
- [1] = {
- Location = Vector( -6198.959473, -8925.958984, 128.031250 ),
- Rotation = Angle( 0, 90, 0 ),
- },
- [2] = {
- Location = Vector( -6055.904297, -8931.146484, 128.031250 ),
- Rotation = Angle( 0, 90, 0 ),
- },
- [3] = {
- Location = Vector( -5933.400391, -8935.567383, 128.031250 ),
- Rotation = Angle( 0, 90, 0 ),
- },
- }
- ///////////////////////////////////////////////////
- // boss setup
- ///////////////////////////////////////////////////
- BossConfig.BossFights = {
- [1] = {
- Name = "Gwyn", // The boss name to print into chat
- BossEntity = "npc_vj_ds_gwyn", // The boss Entity(number entityIndex)
- Health = 10000, // Their HP
- XP_Gain = 2000, // XP Gain
- RP_Cash = 10000, // Kill Ammount
- NumberOfBoss = 1, // How many do we spawn
- },
- [2] = {
- Name = "Ornstein",
- BossEntity = "npc_vj_ds_ornstein",
- Health = 10000,
- XP_Gain = 3000,
- RP_Cash = 10000,
- NumberOfBoss = 2,
- }
- }
- ///////////////////////////////////////////////////
- // 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" )
- 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" )
- end
- end
- end
- local function PlayerSpawnBoss( ply )
- if Bossfight_ON && ply.BossFightSpawn then
- timer.Simple( 0, function()
- ply:SetPos( ply.BossFightSpawn )
- end )
- end
- end
- 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
- for k, v in pairs( BossPlayers ) do
- v:ChatPrint( tostring(v) )
- v.BossFightSpawn = BossConfig.RandomBossLocations[v:EntIndex()].Location
- v:SetPos( v.BossFightSpawn )
- v:StripWeapons()
- v:Give( BossConfig.Weapons )
- for i = 1, 3 do
- v:GiveAmmo( BossConfig.AmmoAmount, BossConfig.AmmoType, false )
- end
- end
- hook.Add("OnNPCKilled", "RP.BoosFights.OnNPCKilledFight", BossKilled )
- hook.Add("PlayerSpawn", "RP.BossFight.PlayerDiedSpawn", PlayerSpawnBoss )
- hook.Add("Think", "RP.BossFights.CheckIfAllAreGone", BossThink )
- 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()
- 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_", 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, 1, function()
- questionEnterBossFight()
- end )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement