Jump to content
  • 0

Remove item


lucho

Question

 

How i can add that when you use it for every use you will lose 1 ruby item like this  _unit removeMagazine "ItemRuby";

 

if (soundVolume == 1) then {
            1 fadeSound 0.25;
            cutText [format[" Earplug - 25%"], "PLAIN DOWN"];        }
            else
        {
            1 fadeSound 1;
            cutText [format["Earplug+ 25%"], "PLAIN DOWN"];
        };

 

 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

You can try this:

ruby_fnc = {
	private ["_rnd","_chance"];

	_chance 	= 25; // Chance to loose a ruby
	_rnd 		= round(random 100);

	if (_rnd < _chance) then {
		player removeMagazine "ItemRuby";
		SystemChat "You lost ruby :(";
	};
};

if (soundVolume == 1) then {
		1 fadeSound 0.25;
		cutText [format[" Earplug - 25%"], "PLAIN DOWN"];
		sleep 1;
		[] spawn ruby_fnc;
	} else {
		1 fadeSound 1;
		cutText [format["Earplug+ 25%"], "PLAIN DOWN"];
		sleep 1;
		[] spawn ruby_fnc;
    };

 

Link to comment
Share on other sites

  • 0

Linux way is a better idea, you have a % to get lost the ruby...  but if u want to check if player have item to use the script so

Spoiler

private ["_hasitemruby"];

_hasitemruby = "ItemRuby" in magazines player;

if (!_hasitemruby) exitWith {cutText [format["Needs 1xRuby to launch this script"], "PLAIN DOWN"];};

if (_hasitemruby)  then {

player removeMagazine "ItemRuby";

titleText ["You lost a ruby using earplug", "PLAIN DOWN"];titleFadeOut 5;

......your code

 };

 

Link to comment
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

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...