Jump to content
  • 0

change to canned food


S3M4J

Question

5 answers to this question

Recommended Posts

  • 0

There is a can opener in overwatch :O ? if yes i did not notice it yet, but here you go:

 

in your custom compiles.sqf search for player_eat.sqf and change the path to a custom mpmission path like: 

 

"custom\player_eat.sqf"

 

Then grap the player_eat.sqf from the dayz_code and paste it to your custom folder or any other folder depends where you want the file.

 

in player_eat.sqf search for :

if (!_hasfooditem) exitWith {cutText [format[(localize "str_player_31"),_text,"consume"] , "PLAIN DOWN"]};

And paste under it:

_itemneeded = "INSERT_ITEM_CLASSNAME_WHICH_IS_NEEDED_HERE";
_hasopener = _itemneeded in magazines player;
if ((_hasoutput) && !(_hasopener)) exitwith {cutText [format["You need a %1 to open this can!",_itemneeded], "PLAIN DOWN"];};

insert the item classname from your can opener in _itemneeded.

 

Now the script will exit with the message above if the player did not have the can opener in his inventory.

Link to comment
Share on other sites

  • 0

how would the same scriptpart look, but with, lets say, two can openers instead?

like: you need either a knife or a machete to use this with the can to open it up.

would something like this work:

 

_itemneeded = "ItemKnife";
_itemneeded2 = "ItemMachete";
_hasopener = _itemneeded or _itemneeded2 in magazines player;

Link to comment
Share on other sites

  • 0

how would the same scriptpart look, but with, lets say, two can openers instead?

like: you need either a knife or a machete to use this with the can to open it up.

would something like this work:

 

_itemneeded = "ItemKnife";

_itemneeded2 = "ItemMachete";

_hasopener = _itemneeded or _itemneeded2 in magazines player;

I would do it on this way: 

_itemlist = ["Item1","Item2","Item3","Item4","Item5"];
_gotitem = 0;
{
if (_x in magazines player) then {
_gotitem = _gotitem +1;
} forEach _itemlist;

If ((_hasoutput) && (_gotitem > 0)) exitwith {cutText [format["You need one of these %1 tools to open this can!",_itemlist], "PLAIN DOWN"];};
Link to comment
Share on other sites

  • 0

yours didn't work the way I wanted it to.

so made it a bit simpler.

works great:

_itemneeded = "ItemKnife" in items player;
_itemneeded2 = "ItemMachete" in items player;
if ((_hasoutput) && !(_itemneeded || _itemneeded2)) exitwith {cutText [format["You need a Knife or Machete to open this can."], "PLAIN DOWN"];};
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...