The label for the bags in the game code is "ammo"
Code:
local pos = managers.player:player_unit():position()
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
--gold, money, weapon, coke, meth, person, special_person, lance_bag (thermal drill), painting, circuit (fbi server), engine_XX (fusion engine 01-12), ammo, turret
spawn_loot("ammo", pos, 120)
Code:
--Bouncing Betty Cops
--goes into any multiplayer game and blows up AI upon death
--no host needed
bags_amount = 4 --amount of bags to drop per death, dont recommend above the default. game slows down
bags_label = "ammo"
function bagspawn(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,-70 ), 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,-70 ), 0 )
end
end
function CopActionHurt:on_death_drop( unit, stage )
if spill == 1 then
for i = 1, bags_amount do
bagspawn(bags_label, self._unit:position(), 120)
end
end
if self._weapon_dropped then
return
end
if self._delayed_shooting_hurt_clbk_id then
managers.enemy:remove_delayed_clbk( self._delayed_shooting_hurt_clbk_id )
self._delayed_shooting_hurt_clbk_id = nil
end
if self._shooting_hurt then
if stage == 2 then
self._weapon_unit:base():stop_autofire()
self._ext_inventory:drop_weapon()
self._weapon_dropped = true
self._shooting_hurt = false
end
elseif self._ext_inventory then
self._ext_inventory:drop_weapon()
self._weapon_dropped = true
end
return
end
if spill == 0 or spill == nil then
spill = 1
else if spill == 1 then
spill = 0
end
end