Alright I put my own spin on your script and released it. Let me add you to the credits.
Revenge2K's Jackpot Scripts!
Scripts can be turned on or off
Simple Loot Drop, all cops drop loot on death (meth)
Code:
--Cop Killer loot drop by Revenge2K, original loot bag code by dougbenham
if r2khackenabled == nil or r2khackenabled == false then
r2khackenabled = true
else
r2khackenabled = false
end
function spawn_loot(type, _position, z_offset)
local position = mvector3.copy(_position)
if z_offset then mvector3.set_z(position, position.z + z_offset) end
if Network:is_client() then
managers.network:session():send_to_host( "server_drop_carry", type, managers.money:get_bag_value( type ), nil, nil, 0, position, Rotation( math.UP, math.random() * 360 ), Vector3( 0,0,0 ), 0 )
else
managers.player:server_drop_carry( type, managers.money:get_bag_value( type ), nil, nil, 0, position, Rotation( math.UP, math.random() * 360 ), Vector3( 0,0,0 ), 0 )
end
end
if not _deadCop then _deadCop = CopDamage.die end
function CopDamage:die( variant )
if r2khackenabled == false then
local result = _deadCop( self, ... )
return result
end
spawn_loot("meth", self._unit:position(), 120)
return _deadCop(self, variant)
end
The Midas Touch, spawns 2 cops once that drop gold bags
Code:
--The Midas Touch script by Revenge2K, makes cops drop that gold. Gold loot bag drop code originally by dougbenham, original spawn code by Simplity
if r2khackenabled == nil or r2khackenabled == false then
r2khackenabled = true
else
r2khackenabled = false
end
function spawn_cop_1(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_cop_1/ene_cop_1" )
local spawn_ai = { init_state = "attack" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
unit:base().made_of_gold = true
end
function spawn_cop_2(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_cop_2/ene_cop_2" )
local spawn_ai = { init_state = "attack" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:base().made_of_gold = true
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
end
function spawn_cop_3(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_cop_3/ene_cop_3" )
local spawn_ai = { init_state = "attack" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:base().made_of_gold = true
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
end
function spawn_cop_4(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_cop_4/ene_cop_4" )
local spawn_ai = { init_state = "attack" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:base().made_of_gold = true
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
end
function spawn_bulldozer(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_bulldozer_1/ene_bulldozer_1" )
local spawn_ai = { init_state = "attack" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:base().made_of_gold = true
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
end
function spawn_fbi_1(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_fbi_1/ene_fbi_1" )
local spawn_ai = { init_state = "attack" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:base().made_of_gold = true
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
end
function spawn_fbi_2(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_fbi_2/ene_fbi_2" )
local spawn_ai = { init_state = "attack" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:base().made_of_gold = true
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
end
function spawn_fbi_3(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_fbi_3/ene_fbi_3" )
local spawn_ai = { init_state = "attack" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:base().made_of_gold = true
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
end
function spawn_fbi_4(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_fbi_heavy_1/ene_fbi_heavy_1" )
local spawn_ai = { init_state = "attack" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:base().made_of_gold = true
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
end
function spawn_swat_f_1(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_fbi_swat_1/ene_fbi_swat_1" )
local spawn_ai = { init_state = "attack" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:base().made_of_gold = true
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
end
function spawn_swat_f_2(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_fbi_swat_2/ene_fbi_swat_2" )
local spawn_ai = { init_state = "attack" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:base().made_of_gold = true
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
end
function spawn_shield_1(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_shield_1/ene_shield_1" )
local spawn_ai = { init_state = "attack" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:base().made_of_gold = true
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
end
function spawn_shield_2(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_shield_2/ene_shield_2" )
local spawn_ai = { init_state = "attack" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:base().made_of_gold = true
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
end
function spawn_sniper_1(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_sniper_1/ene_sniper_1" )
local spawn_ai = { init_state = "attack" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:base().made_of_gold = true
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
end
function spawn_sniper_2(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_sniper_2/ene_sniper_2" )
local spawn_ai = { init_state = "attack" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:base().made_of_gold = true
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
end
function spawn_spook_1(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_spook_1/ene_spook_1" )
local spawn_ai = { init_state = "attack" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:base().made_of_gold = true
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
end
function spawn_swat_1(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_swat_1/ene_swat_1" )
local spawn_ai = { init_state = "attack" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:base().made_of_gold = true
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
end
function spawn_swat_2(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_swat_2/ene_swat_2" )
local spawn_ai = { init_state = "attack" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:base().made_of_gold = true
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
end
function spawn_swat_heavy_1(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_swat_heavy_1/ene_swat_heavy_1" )
local spawn_ai = { init_state = "attack" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:base().made_of_gold = true
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
end
function spawn_tazer_1(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_tazer_1/ene_tazer_1" )
local spawn_ai = { init_state = "idle" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:base().made_of_gold = true
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
end
function spawn_loot(type, _position, z_offset)
local position = mvector3.copy(_position)
if z_offset then mvector3.set_z(position, position.z + z_offset) end
if Network:is_client() then
managers.network:session():send_to_host( "server_drop_carry", type, managers.money:get_bag_value( type ), nil, nil, 0, position, Rotation( math.UP, math.random() * 360 ), Vector3( 0,0,0 ), 0 )
else
managers.player:server_drop_carry( type, managers.money:get_bag_value( type ), nil, nil, 0, position, Rotation( math.UP, math.random() * 360 ), Vector3( 0,0,0 ), 0 )
end
end
if not _deadCop then _deadCop = CopDamage.die end
function CopDamage:die( ... )
if r2khackenabled == false then
local result = _deadCop( self, ... )
return result
end
if self._unit:base().made_of_gold then
spawn_loot("gold", self._unit:position(), 120)
end
if not self._unit:base().made_of_gold and self._unit:name() == Idstring("units/payday2/characters/ene_cop_1/ene_cop_1") then
spawn_cop_1(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
spawn_cop_1(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
end
if not self._unit:base().made_of_gold and self._unit:name() == Idstring("units/payday2/characters/ene_cop_2/ene_cop_2") then
spawn_cop_2(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
spawn_cop_2(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
end
if not self._unit:base().made_of_gold and self._unit:name() == Idstring("units/payday2/characters/ene_cop_3/ene_cop_3") then
spawn_cop_3(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
spawn_cop_3(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
end
if not self._unit:base().made_of_gold and self._unit:name() == Idstring("units/payday2/characters/ene_cop_4/ene_cop_4") then
spawn_cop_4(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
spawn_cop_4(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
end
--commented out to exclude bulldozers
--if not self._unit:base().made_of_gold and self._unit:name() == Idstring("units/payday2/characters/ene_bulldozer_1/ene_bulldozer_1") then
--spawn_bulldozer(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
--spawn_bulldozer(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
--end
if not self._unit:base().made_of_gold and self._unit:name() == Idstring("units/payday2/characters/ene_fbi_1/ene_fbi_1") then
spawn_fbi_1(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
spawn_fbi_1(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
end
if not self._unit:base().made_of_gold and self._unit:name() == Idstring("units/payday2/characters/ene_fbi_2/ene_fbi_2") then
spawn_fbi_2(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
spawn_fbi_2(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
end
if not self._unit:base().made_of_gold and self._unit:name() == Idstring("units/payday2/characters/ene_fbi_3/ene_fbi_3") then
spawn_fbi_3(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
spawn_fbi_3(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
end
if not self._unit:base().made_of_gold and self._unit:name() == Idstring("units/payday2/characters/ene_fbi_heavy_1/ene_fbi_heavy_1") then
spawn_fbi_4(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
spawn_fbi_4(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
end
if not self._unit:base().made_of_gold and self._unit:name() == Idstring("units/payday2/characters/ene_fbi_swat_1/ene_fbi_swat_1") then
spawn_swat_f_1(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
spawn_swat_f_1(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
end
if not self._unit:base().made_of_gold and self._unit:name() == Idstring("units/payday2/characters/ene_fbi_swat_2/ene_fbi_swat_2") then
spawn_swat_f_2(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
spawn_swat_f_2(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
end
if not self._unit:base().made_of_gold and self._unit:name() == Idstring("units/payday2/characters/ene_shield_1/ene_shield_1") then
spawn_shield_1(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
spawn_shield_1(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
end
if not self._unit:base().made_of_gold and self._unit:name() == Idstring("units/payday2/characters/ene_shield_2/ene_shield_2") then
spawn_shield_2(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
spawn_shield_2(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
end
if not self._unit:base().made_of_gold and self._unit:name() == Idstring("units/payday2/characters/ene_sniper_1/ene_sniper_1") then
spawn_sniper_1(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
spawn_sniper_1(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
end
if not self._unit:base().made_of_gold and self._unit:name() == Idstring("units/payday2/characters/ene_sniper_2/ene_sniper_2") then
spawn_sniper_2(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
spawn_sniper_2(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
end
if not self._unit:base().made_of_gold and self._unit:name() == Idstring("units/payday2/characters/ene_spook_1/ene_spook_1") then
spawn_spook_1(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
spawn_spook_1(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
end
if not self._unit:base().made_of_gold and self._unit:name() == Idstring("units/payday2/characters/ene_swat_1/ene_swat_1") then
spawn_swat_1(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
spawn_swat_1(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
end
if not self._unit:base().made_of_gold and self._unit:name() == Idstring("units/payday2/characters/ene_swat_2/ene_swat_2") then
spawn_swat_2(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
spawn_swat_2(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
end
if not self._unit:base().made_of_gold and self._unit:name() == Idstring("units/payday2/characters/ene_swat_heavy_1/ene_swat_heavy_1") then
spawn_swat_heavy_1(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
spawn_swat_heavy_1(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
end
if not self._unit:base().made_of_gold and self._unit:name() == Idstring("units/payday2/characters/ene_tazer_1/ene_tazer_1") then
spawn_tazer_1(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
spawn_tazer_1(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
end
local result = _deadCop( self, ... )
return result
end
The Golden Plague, infinitely spawns cops who drops gold upon death. This is the most fun.
Code:
--The Golden Plague script by Revenge2K, makes cops drop that gold. Gold loot bag drop code originally by dougbenham, original spawn code by Simplity
if r2khackenabled == nil or r2khackenabled == false then
r2khackenabled = true
else
r2khackenabled = false
end
function spawn_cop_1(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_cop_1/ene_cop_1" )
local spawn_ai = { init_state = "attack" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
unit:base().made_of_gold = true
end
function spawn_cop_2(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_cop_2/ene_cop_2" )
local spawn_ai = { init_state = "attack" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:base().made_of_gold = true
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
end
function spawn_cop_3(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_cop_3/ene_cop_3" )
local spawn_ai = { init_state = "attack" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:base().made_of_gold = true
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
end
function spawn_cop_4(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_cop_4/ene_cop_4" )
local spawn_ai = { init_state = "attack" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:base().made_of_gold = true
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
end
function spawn_bulldozer(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_bulldozer_1/ene_bulldozer_1" )
local spawn_ai = { init_state = "attack" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:base().made_of_gold = true
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
end
function spawn_fbi_1(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_fbi_1/ene_fbi_1" )
local spawn_ai = { init_state = "attack" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:base().made_of_gold = true
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
end
function spawn_fbi_2(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_fbi_2/ene_fbi_2" )
local spawn_ai = { init_state = "attack" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:base().made_of_gold = true
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
end
function spawn_fbi_3(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_fbi_3/ene_fbi_3" )
local spawn_ai = { init_state = "attack" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:base().made_of_gold = true
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
end
function spawn_fbi_4(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_fbi_heavy_1/ene_fbi_heavy_1" )
local spawn_ai = { init_state = "attack" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:base().made_of_gold = true
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
end
function spawn_swat_f_1(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_fbi_swat_1/ene_fbi_swat_1" )
local spawn_ai = { init_state = "attack" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:base().made_of_gold = true
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
end
function spawn_swat_f_2(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_fbi_swat_2/ene_fbi_swat_2" )
local spawn_ai = { init_state = "attack" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:base().made_of_gold = true
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
end
function spawn_shield_1(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_shield_1/ene_shield_1" )
local spawn_ai = { init_state = "attack" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:base().made_of_gold = true
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
end
function spawn_shield_2(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_shield_2/ene_shield_2" )
local spawn_ai = { init_state = "attack" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:base().made_of_gold = true
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
end
function spawn_sniper_1(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_sniper_1/ene_sniper_1" )
local spawn_ai = { init_state = "attack" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:base().made_of_gold = true
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
end
function spawn_sniper_2(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_sniper_2/ene_sniper_2" )
local spawn_ai = { init_state = "attack" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:base().made_of_gold = true
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
end
function spawn_spook_1(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_spook_1/ene_spook_1" )
local spawn_ai = { init_state = "attack" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:base().made_of_gold = true
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
end
function spawn_swat_1(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_swat_1/ene_swat_1" )
local spawn_ai = { init_state = "attack" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:base().made_of_gold = true
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
end
function spawn_swat_2(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_swat_2/ene_swat_2" )
local spawn_ai = { init_state = "attack" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:base().made_of_gold = true
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
end
function spawn_swat_heavy_1(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_swat_heavy_1/ene_swat_heavy_1" )
local spawn_ai = { init_state = "attack" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:base().made_of_gold = true
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
end
function spawn_tazer_1(position, rotation)
local unit_name = Idstring( "units/payday2/characters/ene_tazer_1/ene_tazer_1" )
local spawn_ai = { init_state = "idle" }
local unit = World:spawn_unit( unit_name, position, rotation )
unit:base().made_of_gold = true
unit:movement():set_character_anim_variables()
unit:brain():set_spawn_ai( spawn_ai )
unit:brain():set_active( true )
end
function spawn_loot(type, _position, z_offset)
local position = mvector3.copy(_position)
if z_offset then mvector3.set_z(position, position.z + z_offset) end
if Network:is_client() then
managers.network:session():send_to_host( "server_drop_carry", type, managers.money:get_bag_value( type ), nil, nil, 0, position, Rotation( math.UP, math.random() * 360 ), Vector3( 0,0,0 ), 0 )
else
managers.player:server_drop_carry( type, managers.money:get_bag_value( type ), nil, nil, 0, position, Rotation( math.UP, math.random() * 360 ), Vector3( 0,0,0 ), 0 )
end
end
if not _deadCop then _deadCop = CopDamage.die end
function CopDamage:die( ... )
if r2khackenabled == false then
local result = _deadCop( self, ... )
return result
end
if self._unit:base().made_of_gold then
spawn_loot("gold", self._unit:position(), 120)
end
if self._unit:name() == Idstring("units/payday2/characters/ene_cop_1/ene_cop_1") then
spawn_cop_1(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
spawn_cop_1(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
end
if self._unit:name() == Idstring("units/payday2/characters/ene_cop_2/ene_cop_2") then
spawn_cop_2(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
spawn_cop_2(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
end
if self._unit:name() == Idstring("units/payday2/characters/ene_cop_3/ene_cop_3") then
spawn_cop_3(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
spawn_cop_3(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
end
if self._unit:name() == Idstring("units/payday2/characters/ene_cop_4/ene_cop_4") then
spawn_cop_4(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
spawn_cop_4(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
end
--commented out to exclude bulldozers
--if self._unit:name() == Idstring("units/payday2/characters/ene_bulldozer_1/ene_bulldozer_1") then
--spawn_bulldozer(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
--spawn_bulldozer(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
--end
if self._unit:name() == Idstring("units/payday2/characters/ene_fbi_1/ene_fbi_1") then
spawn_fbi_1(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
spawn_fbi_1(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
end
if self._unit:name() == Idstring("units/payday2/characters/ene_fbi_2/ene_fbi_2") then
spawn_fbi_2(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
spawn_fbi_2(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
end
if self._unit:name() == Idstring("units/payday2/characters/ene_fbi_3/ene_fbi_3") then
spawn_fbi_3(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
spawn_fbi_3(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
end
if self._unit:name() == Idstring("units/payday2/characters/ene_fbi_heavy_1/ene_fbi_heavy_1") then
spawn_fbi_4(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
spawn_fbi_4(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
end
if self._unit:name() == Idstring("units/payday2/characters/ene_fbi_swat_1/ene_fbi_swat_1") then
spawn_swat_f_1(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
spawn_swat_f_1(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
end
if self._unit:name() == Idstring("units/payday2/characters/ene_fbi_swat_2/ene_fbi_swat_2") then
spawn_swat_f_2(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
spawn_swat_f_2(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
end
if self._unit:name() == Idstring("units/payday2/characters/ene_shield_1/ene_shield_1") then
spawn_shield_1(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
spawn_shield_1(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
end
if self._unit:name() == Idstring("units/payday2/characters/ene_shield_2/ene_shield_2") then
spawn_shield_2(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
spawn_shield_2(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
end
if self._unit:name() == Idstring("units/payday2/characters/ene_sniper_1/ene_sniper_1") then
spawn_sniper_1(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
spawn_sniper_1(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
end
if self._unit:name() == Idstring("units/payday2/characters/ene_sniper_2/ene_sniper_2") then
spawn_sniper_2(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
spawn_sniper_2(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
end
if self._unit:name() == Idstring("units/payday2/characters/ene_spook_1/ene_spook_1") then
spawn_spook_1(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
spawn_spook_1(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
end
if self._unit:name() == Idstring("units/payday2/characters/ene_swat_1/ene_swat_1") then
spawn_swat_1(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
spawn_swat_1(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
end
if self._unit:name() == Idstring("units/payday2/characters/ene_swat_2/ene_swat_2") then
spawn_swat_2(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
spawn_swat_2(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
end
if self._unit:name() == Idstring("units/payday2/characters/ene_swat_heavy_1/ene_swat_heavy_1") then
spawn_swat_heavy_1(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
spawn_swat_heavy_1(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
end
if self._unit:name() == Idstring("units/payday2/characters/ene_tazer_1/ene_tazer_1") then
spawn_tazer_1(Vector3(self._unit:position().x + (math.random(9,10) * 5), self._unit:position().y + (math.random(9,10) * 5), self._unit:position().z), self._unit:rotation())
spawn_tazer_1(Vector3(self._unit:position().x + (math.random(3,5) * 3), self._unit:position().y + (math.random(3,5) * 3), self._unit:position().z), self._unit:rotation())
end
local result = _deadCop( self, ... )
return result
end