SHARE
TWEET

Untitled

a guest Jul 17th, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --#NoSimplerr#
  2.  
  3. //////////////////////////////////////////////////////////////////////////////////////////////////////
  4. //////////////////////////////////////////////////////////////////////////////////////////////////////
  5. local Bossfight_ON = false
  6. local BossTable = {}
  7. local BossPlayers = {}
  8. local BossConfig = {}
  9. local BossAmount = 0
  10. //////////////////////////////////////////////////////////////////////////////////////////////////////
  11. // DO NOT TOUCH THE ABOVE EVERYTHING BELOW IS YOUR CONFIG
  12. //////////////////////////////////////////////////////////////////////////////////////////////////////
  13.  
  14. BossConfig.RandomEvenTimerDelay = 600 // How long in seconds for the timer to show??
  15.  
  16. BossConfig.QuestionTimerExecute = 30 // How long do players have to press "Yes/No" on the question
  17.  
  18. BossConfig.Weapons = "m9k_damascus" // Weapon to give for the battle
  19.  
  20. BossConfig.AmmoType = "m9k_ammo_ar2" // The ammo type
  21.  
  22. BossConfig.AmmoAmount = 1000 // The amount of ammo
  23.  
  24. ///////////////////////////////////////////////////
  25. // setup boss spawn
  26. ///////////////////////////////////////////////////
  27.  
  28. BossConfig.BossSpawnLocation = {
  29.  
  30.     Location = Vector( 2564.115967, -5777.277832, -139.968750 ),
  31.  
  32.     Rotation = Angle( 1.000158, 179.371475, 0.000000 ),
  33.  
  34. }
  35.  
  36. ///////////////////////////////////////////////////
  37. // setup player spawn
  38. ///////////////////////////////////////////////////
  39.  
  40. BossConfig.RandomBossLocations = {
  41.  
  42.     [1] = {
  43.         Location = Vector( 2534.586914, -6437.153809, -139.968750 ),
  44.         Rotation = Angle( 3.640159, 88.379517, 0.000000 ),
  45.     },
  46.  
  47.     [2] = {
  48.         Location = Vector( 2631.916504, -4900.906738, -139.968750 ),
  49.         Rotation = Angle( 2.760150, -91.396408, 0.000000 ),
  50.     },
  51.  
  52.     [3] = {
  53.         Location = Vector( 1928.431030, -5777.270996, -139.968750 ),
  54.         Rotation = Angle( -0.231841, 1.179271, 0.000000 ),
  55.     },
  56.  
  57. }
  58.  
  59. ///////////////////////////////////////////////////
  60. // boss setup
  61. ///////////////////////////////////////////////////
  62.  
  63. BossConfig.BossFights = {
  64.  
  65.     [1] = {
  66.         Name = "Soul Of Cinder", // The boss name to print into chat
  67.         BossEntity = "npc_vj_ds3_cinder", // The boss Entity(number entityIndex)
  68.         Health = 20000, // Their HP
  69.         XP_Gain = 2000, // XP Gain
  70.         RP_Cash = 30000, // Kill Ammount
  71.         NumberOfBoss = 1, // How many do we spawn
  72.     },
  73.  
  74.     [2] = {
  75.         Name = "Slave Knight Gael",
  76.         BossEntity = "npc_vj_ds3_slaveknight",
  77.         Health = 30000,
  78.         XP_Gain = 3000,
  79.         RP_Cash = 40000,
  80.         NumberOfBoss = 1,
  81.     },
  82.  
  83.     [3] = {
  84.         Name = "Champion Gundyr",
  85.         BossEntity = "npc_vj_ds3_gundyr",
  86.         Health = 35000,
  87.         XP_Gain = 3000,
  88.         RP_Cash = 40000,
  89.         NumberOfBoss = 1,
  90.     },
  91.  
  92.     [4] = {
  93.         Name = "Abyss Watchers",
  94.         BossEntity = "npc_vj_ds3_aw",
  95.         Health = 20000,
  96.         XP_Gain = 3000,
  97.         RP_Cash = 10000,
  98.         NumberOfBoss = 1,
  99.     }
  100.  
  101. }
  102.  
  103. ///////////////////////////////////////////////////
  104. // server code below
  105. ///////////////////////////////////////////////////
  106.  
  107. local function BossKilled( npc, killer )
  108.  
  109.     if Bossfight_ON && npc:GetClass() == BossTable.BossEntity then
  110.  
  111.         if IsValid(killer) then
  112.             killer:addMoney( BossTable.RP_Cash )
  113.             DarkRP.notify( killer, 2, 6, "You have received " .. BossTable.RP_Cash .. " XP for participating in the boss fight!" )
  114.             DarkRP.notify( killer, 2, 6, "You have received " .. DarkRP.formatMoney( BossTable.XP_Gain ) .. " for participating in the boss fight!" )
  115.         end
  116.  
  117.         // These hooks handle our event, make sure to rid of them when the boss dies
  118.         hook.Remove("OnNPCKilled", "RP.BoosFights.OnNPCKilledFight" )
  119.         hook.Remove("Think", "RP.BossFights.CheckIfAllAreGone" )
  120.         hook.Remove("PlayerSpawn", "RP.BossFight.PlayerDiedSpawn" )
  121.         timer.Remove( "RP.BossFight_DoTimerEnd" )
  122.  
  123.         for k, v in pairs( BossPlayers ) do
  124.             v:Spawn()
  125.         end
  126.  
  127.         BossTable = {} // Empty our boss selection
  128.         BossPlayers = {} // Empty our table
  129.         Bossfight_ON = false
  130.  
  131.     end
  132.  
  133. end
  134.  
  135. local function BossThink( npc, killer )
  136.  
  137.     if Bossfight_ON then
  138.  
  139.         if #BossPlayers == 0 then
  140.  
  141.             Bossfight_ON = false
  142.             DarkRP.notifyAll( 1, 5, "The boss fight has ended!" )
  143.  
  144.             // These hooks handle our event, make sure to rid of them when the boss dies
  145.             hook.Remove("OnNPCKilled", "RP.BoosFights.OnNPCKilledFight" )
  146.             hook.Remove("Think", "RP.BossFights.CheckIfAllAreGone" )
  147.             hook.Remove("PlayerSpawn", "RP.BossFight.PlayerDiedSpawn" )
  148.             timer.Remove( "RP.BossFight_DoTimerEnd" )
  149.  
  150.         end
  151.  
  152.     end
  153.  
  154. end
  155.  
  156. local function PlayerSpawnBoss( ply )
  157.     if Bossfight_ON && ply.BossFightSpawn then
  158.         timer.Simple( 0, function()
  159.             ply:SetPos( DarkRP.findEmptyPos(ply.BossFightSpawn, {ply}, 600, 30, Vector(16, 16, 64)) )
  160.             ply:Give( BossConfig.Weapons )
  161.             for i = 1, 3 do
  162.                 ply:GiveAmmo( BossConfig.AmmoAmount, BossConfig.AmmoType, false )
  163.             end
  164.         end )
  165.     end
  166. end
  167.  
  168.  
  169. local TeleportStartIndex = 1
  170. local function doBossFight()
  171.  
  172.     if #BossPlayers == 0 then
  173.         DarkRP.notifyAll( 1, 5, "No one entered the boss fight!" )
  174.         return
  175.     end
  176.  
  177.     local NPC_ENT = ents.Create( BossTable.BossEntity )
  178.     NPC_ENT:SetHealth( BossTable.Health )
  179.     NPC_ENT:SetPos( BossConfig.BossSpawnLocation.Location )
  180.     NPC_ENT:SetAngles( BossConfig.BossSpawnLocation.Rotation )
  181.     NPC_ENT:Spawn()
  182.     Bossfight_ON = true  
  183.  
  184.     TeleportStartIndex = 1 -- start a 1
  185.  
  186.     for k, v in pairs( BossPlayers ) do
  187.  
  188.         v.BossFightSpawn = BossConfig.RandomBossLocations[TeleportStartIndex].Location
  189.         v:SetPos( DarkRP.findEmptyPos(v.BossFightSpawn, {v}, 600, 30, Vector(16, 16, 64)) )
  190.         v:StripWeapons()
  191.         v:Give( BossConfig.Weapons )
  192.         for i = 1, 3 do
  193.             v:GiveAmmo( BossConfig.AmmoAmount, BossConfig.AmmoType, false )
  194.         end
  195.  
  196.         TeleportStartIndex = TeleportStartIndex + 1 // First index, then we skip to the next index
  197.  
  198.         if TeleportStartIndex > #BossConfig.RandomBossLocations then
  199.             TeleportStartIndex = 1 // Reset it back to 1 just incase errors
  200.         end
  201.  
  202.     end
  203.  
  204.     hook.Add("OnNPCKilled", "RP.BoosFights.OnNPCKilledFight", BossKilled )
  205.     hook.Add("PlayerSpawn", "RP.BossFight.PlayerDiedSpawn", PlayerSpawnBoss )
  206.     hook.Add("Think", "RP.BossFights.CheckIfAllAreGone", BossThink )
  207.  
  208.     timer.Create("RP.BossFight_DoTimerEnd", 300, 1, function ()
  209.  
  210.         if Bossfight_ON then
  211.  
  212.             // These hooks handle our event, make sure to rid of them when the boss expires
  213.             hook.Remove("OnNPCKilled", "RP.BoosFights.OnNPCKilledFight" )
  214.             hook.Remove("Think", "RP.BossFights.CheckIfAllAreGone" )
  215.             hook.Remove("PlayerSpawn", "RP.BossFight.PlayerDiedSpawn" )
  216.  
  217.             for k, v in pairs( BossPlayers ) do
  218.                 v:Spawn()
  219.             end
  220.  
  221.             BossTable = {} // Empty our boss selection
  222.             BossPlayers = {} // Empty our table
  223.             Bossfight_ON = false
  224.             DarkRP.notifyAll( 1, 5, "The timer has run out, thus ending the boss fight! (No rewards)" )
  225.  
  226.  
  227.         end
  228.  
  229.     end )
  230.  
  231. end
  232.  
  233. local function doBossFightQuestion(answer, player, initiator, target, Trigger)
  234.    
  235.     if tobool(answer) && !BossPlayers[player:EntIndex()] && ( #BossPlayers != #BossConfig.RandomBossLocations ) then
  236.      
  237.         BossPlayers[player:EntIndex()] = player
  238.         player:ChatPrint("You have entered the fight!")
  239.  
  240.     elseif answer ~= nil and !BossPlayers[player:EntIndex()] or ( #BossPlayers == #BossConfig.RandomBossLocations ) then
  241.  
  242.         BossPlayers[player:EntIndex()] = nil // Possible fall back to possible future bullshit
  243.         player:ChatPrint("You have chosen not to fight!")
  244.     end
  245.  
  246.  
  247.     if tobool( Trigger ) then
  248.        
  249.         doBossFight()
  250.  
  251.     end
  252.  
  253. end
  254.  
  255. local function questionEnterBossFight()
  256.  
  257.     BossTable = BossConfig.BossFights[math.random(#BossConfig.BossFights)]
  258.     BossAmount = BossTable.NumberOfBoss // How many are we spawning?
  259.  
  260.     for k, v in pairs( player.GetAll() ) do
  261.  
  262.         v:ChatPrint( "Boss: " .. BossTable.Name )
  263.         v:ChatPrint( "Cash Reward: " .. DarkRP.formatMoney( BossTable.RP_Cash ) )
  264.         v:ChatPrint( "XP Gain: " .. BossTable.XP_Gain )
  265.  
  266.         DarkRP.createQuestion("Enter Boss Fight?", "rp.boosfights_", v, BossConfig.QuestionTimerExecute or 15, doBossFightQuestion, nil, nil)
  267.    
  268.     end
  269.  
  270.     timer.Create("BossFights_RP", BossConfig.QuestionTimerExecute or 15, 1, function() doBossFightQuestion( nil, nil, nil, nil, true ) end)
  271.  
  272. end
  273.  
  274. timer.Create("RP.BoosFights.CheckQuestion", BossConfig.RandomEvenTimerDelay or 5, 0, function()
  275.     questionEnterBossFight()
  276. end )
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top