Script for shells and turret particle's?

Posts 14 of 4 · Page 1 of 1
Script for shells and turret particle's?
Hello everybody! because of the new armored transport DLC we have 2 new bags called shells and turret particle so i have been thinking.. how about spawning these bags? so.. does anybody has a code for this?

-Tycho
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
if you want to throw the bag

function ServerSpawnBag(name) --spawn a bag on your position
if not alive (managers.playerlayer_unit()) then return end
local camera_ext = managers.playerlayer_unit():camera()
if Network:is_client() then
managers.network:session():send_to_host( "server_drop_carry", managers.money:get_bag_value(name), false, false, 1, camera_extosition(), camera_ext:rotation(), camera_ext:forward(), 100)
else
managers.player:server_drop_carry(name, managers.money:get_bag_value(name), false, false, 1, camera_extosition(), camera_ext:rotation(), camera_ext:forward(), 100)
end
end

ServerSpawnBag("ammo")
I tried that code to throw the bag but it didn't work. Only the one that drops the bag underneath you. Do you have to merge them some how?
Posts 14 of 4 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?