Jump to content
Sign in to follow this  
SirGoodsmoke

Updated Spawn/Give Bag Functions

Recommended Posts

SirGoodsmoke

The new updated function doesn't make other players crash when they carry a bag you spawn, also the new functions allows the bags to be attached to the zip-line secure i.e you can spawn gold FF Day 3 and secure. Hoping this can be used to fix Heisberger(Rats Auto Cooker) as that is the problem as to why it crash calling for nil value which I listed below

Main Fixes:

Players(Clients) No longer crashes when carrying

Attachable to Zipline

Calls for proper values now *bag_value no longer exists replaced by multiplier*

--SPAWN BAG FUNCTION

function ServerSpawnBag(name, zipline_unit)

	if not alive (managers.player:player_unit()) then return end

	local camera_ext = managers.player:player_unit():camera()

	local carry_data = tweak_data.carry[ name ]

	local dye_initiated = carry_data.dye_initiated

	local has_dye_pack = carry_data.has_dye_pack

	local dye_value_multiplier = carry_data.dye_value_multiplier

	if Network:is_client() then

		managers.network:session():send_to_host("server_drop_carry", name, carry_data.multiplier, carry_data.dye_initiated, carry_data.has_dye_pack, carry_data.dye_value_multiplier, camera_ext:position(), camera_ext:rotation(), camera_ext:forward(), Vector3(0, 0, 0), zipline_unit)

	else

		managers.player:server_drop_carry(name, carry_data.multiplier, carry_data.dye_initiated, carry_data.has_dye_pack, carry_data.dye_value_multiplier, camera_ext:position(), camera_ext:rotation(), camera_ext:forward(), Vector3(0, 0, 0), zipline_unit, managers.network:session():local_peer():id())

	end

end




--GIVE YOURSELF A BAG TO CARRY

function GiveBag(name, zipline_unit)

	if not alive (managers.player:player_unit()) then return end

	local carry_data = tweak_data.carry[ name ]

	local dye_initiated = carry_data.dye_initiated

	local has_dye_pack = carry_data.has_dye_pack

	local dye_value_multiplier = carry_data.dye_value_multiplier

	if Network:is_client() then

		managers.network:session():send_to_host("set_carry", name, carry_data.multiplier, carry_data.dye_initiated, carry_data.has_dye_pack, carry_data.dye_value_multiplier, zipline_unit)

	else

		managers.player:set_carry(name, carry_data.multiplier, carry_data.dye_initiated, carry_data.has_dye_pack, carry_data.dye_value_multiplier, zipline_unit, managers.network:session():local_peer():id())

	end

end

Tested thoroughly and confirmed working

Share this post


Link to post
Share on other sites
PirateCaptain

ill give it a go thank you again :D

Share this post


Link to post
Share on other sites
Baddog-11

Hmm this doesn't work for me, i get this error here.

cannot use undeclared global 'zipline_unit'

any idea on this ?

Share this post


Link to post
Share on other sites
PirateCaptain

works fine here too so far, still testing but feels stable

Share this post


Link to post
Share on other sites
PirateCaptain

Awesome great to hear, also work with the rain function just use those values

yup balwin already fixed both that one and autocooker, getting close to 15 :D

Share this post


Link to post
Share on other sites
Baddog-11

What does your full script look like because it works fine on my end

Ah nevermind me :P

I tried to fix the rainmenu myself by just overwriting the first part of its code with what you posted but i got a working version now ^^

Share this post


Link to post
Share on other sites
ITStheNELSON

where would i put this code. :)

Share this post


Link to post
Share on other sites
ITStheNELSON

Cant wait for v15 all the hard work pirate captain and his higher ups have been doing

and v14 with Feed the fish :swordfight:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Stop being a peeping tom and join the community.... we got cookies

Join the crew now

Sign in

Already part of the crew? Board right here

Sign In Now
Sign in to follow this  

×