Jump to content
EchoTwoZero

Respawn tickets tied to items in a crate

Recommended Posts

Hopefully someone can help me, and I think this is probably quite simple, I just can't seem to figure it out tonight!

 

I was hoping that there was a way to tie the number of a team's respawn tickets to the number of items in a crate.

e.g. there are 4 medkits in a crate so they have 4 respawn tickets. If they add 2, they have 6 respawn tickets and if they remove 3 they only have 3 respawn tickets remaining.

 

Any help with this would be much appreciated!

 

Cheers!

Share this post


Link to post
Share on other sites

In crates init field...

//On sever
if ( isServer ) then {
	//Add respawn tickets at mission start of how many FAKs in the crate
	[ west, count ( itemCargo this select { _x == "FirstAidKit" } ) ] call BIS_fnc_respawnTickets;
};

//On client
if ( hasInterface ) then {
	//Add event for when the client closes this crate
	this addEventHandler [ "containerClosed" , {
		//Get current ticket count
		_tickets = [ west ] call BIS_fnc_respawnTickets;
		//Update respawn  tickets based on number of FAKs in the crate
		[ west, count ( itemCargo this select { _x == "FirstAidKit" } ) - _tickets ] call BIS_fnc_respawnTickets;
	}];
};

Just need to change the side that this particular crate will effect(west) OR use missionNamespace if it effects everyone.

Untested, not on my main PC atm.

  • Like 3

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×