piggd Smelt Scrap Metal ver 1.0

dayzpiggd

New Member
*****************************************
* Mod Name: piggd Scrap Metal Smelting *
* Author: piggd *
* Email: [email protected] *
* Version: 1.0 *
* Date: 04/22/2013 *
*****************************************

Information:
This mod will allow you to smelt tin and soda cans into scarp metal. It requires fileed canteen of water (boiled or unboiled), # (6 by default) of cans, tool box and a fire.
The number of cans required can be adjusted from 1 to 11. 11 is max based on canteen requirement and inventory space.

Required:
Camp Fire
Tool Box
Filled Water Canteen ( boiled or unboiled)
# (default 6) of empty Soda to Tin cans

Item: Producted:
Scrap Metal
Unfilled Water Canteen

Installation:

Unpack your dayz mission pbo.

***************************************
* Copy smelt.sqf into custom folder. *
***************************************

Make a copy of or modify your existing custom variable.sqf

FIND
Code:
s_player_boil =            -1;

ADD immediately after

Code:
// ------------------------------------------------------------------------Piggd Smelt Scrap Metal Start------------------------------------------------------------------------
    s_player_smelt =        -1;
// ------------------------------------------------------------------------Piggd Smelt Scrap Metal End----------------------------------------------------------------------

****************************************
* Modify your fn_self_actions.sqf file *
****************************************

FIND
Code:
    if (inflamed cursorTarget and (_hasbottleitem and _hastinitem) and _canDo) then {
        if (s_player_boil < 0) then {
            s_player_boil = player addAction [localize "str_actions_boilwater", "\z\addons\dayz_code\actions\boil.sqf",cursorTarget, 3, true, true, "", ""];
        };
    } else {
        player removeAction s_player_boil;
        s_player_boil = -1;
    };


ADD immediately after
Code:
// ------------------------------------------------------------------------Piggd Smelt Scrap Metal Start------------------------------------------------------------------------
if (inflamed cursorTarget and _hasToolbox and _canDo) then {
        if (s_player_smelt < 0) then {
            s_player_smelt = player addAction[("<t color=""    #FF9999"">" + ("Smelt Scrap Metal") +"</t>"),"custom\smelt.sqf",cursorTarget, 3 ,true, true,"", ""];
        };
    } else {
        player removeAction s_player_smelt;
        s_player_smelt = -1;
    };
// ------------------------------------------------------------------------Piggd Smelt Scrap Metal Start------------------------------------------------------------------------
smelt.sqf
Code:
// Script: smelt.sql
// Author: piggd
// Revision: 1.0
// Date: 04202013
//  Smelting is based on the boil code in standard dayz.  Modified by piggd to smelt cans into scrap metal.
 
private["_hasboiledbottleitem","_hasbottleitem","_cansremoved","_hastinitem","_bottletext","_tin1text","_parttext","_tin2text","_tintext","_waterbottleqty","_metalqty","_tincanqty","_sodaemptyqty","_cansreq","_dis","_sfx"];
player removeAction s_player_smelt;
s_player_smelt = -1;
 
 
_hasbottleitem = "ItemWaterbottle" in magazines player;
_hasboiledbottleitem = "ItemWaterbottleBoiled" in magazines player;
_hastinitem = false;
_sodaemptyqty = {_x == "ItemSodaEmpty"} count magazines player;
_tincanqty = {_x == "TrashTinCan"} count magazines player;
_metalqty = _sodaemptyqty +_tincanqty;
// The required can quanity must be between 1 to 11 due to inventory constraints. 1 WB and 11 cans is max.
_cansreq = 6;
_cansremoved = 0;
if ( _hasboiledbottleitem ) then {
        _hasbottleitem = true;
};
if (_metalqty >= _cansreq) then {
    _hastinitem = true;
};
 
_bottletext = getText (configFile >> "CfgMagazines" >> "ItemWaterbottle" >> "displayName");
_tin1text = getText (configFile >> "CfgMagazines" >> "TrashTinCan" >> "displayName");
_tin2text = getText (configFile >> "CfgMagazines" >> "ItemSodaEmpty" >> "displayName");
_tintext = format["%1 of %2 %3 / %4 required",_metalqty,_cansreq,_tin1text,_tin2text];
_parttext = getText (configFile >> "CfgMagazines" >> "PartGeneric" >> "displayName");
if (!_hasbottleitem) exitWith {cutText [format[(localize "str_player_31"),_bottletext,"smelt"] , "PLAIN DOWN"]};
if (!_hastinitem) exitWith {cutText [format[(localize "str_player_31"),_tintext,"smelt"] , "PLAIN DOWN"]};
 
if (_hasbottleitem and _hastinitem) then {
        player playActionNow "Medic";
        sleep 1;
        _dis=10;
        _sfx = "cook";
        [player,_sfx,0,false,_dis] call dayz_zombieSpeak;
        [player,_dis,true,(getPosATL player)] spawn player_alertZombies;
 
        sleep 5;
        if ( _hasboiledbottleitem ) then {
            player removeMagazine "ItemWaterbottleBoiled";
        } else {
            player removeMagazine "ItemWaterbottle";
        };
        for "_x" from 1 to _cansreq do {
   
            if (_x <= _tincanqty and _cansremoved < _cansreq) then {
                player removeMagazine "TrashTinCan";
                _cansremoved = _cansremoved + 1;
            };
        }; 
        for "_x" from 1 to _cansreq do {
     
            if (_x <= _sodaemptyqty and _cansremoved < _cansreq) then {
                player removeMagazine "ItemSodaEmpty";
                _cansremoved = _cansremoved + 1;
            }; 
        }; 
        player addMagazine "ItemWaterbottleUnfilled";
        player addMagazine "PartGeneric";
        cutText [format[(localize  "str_build_01"),_parttext], "PLAIN DOWN"];
} else {
        cutText [format[(localize  "str_build_failed_01"),_parttext], "PLAIN DOWN"];
    };
};
 
I will be grateful if you make a script with the addition of:
PartGeneric 3Ñ… > PartEngine 1x
PartGeneric 3Ñ… > PartVRotor 1x
PartGeneric 2Ñ… > PartFueltank 1x
TrashJackDaniels 6Ñ… > PartGlass 1x
and debris will play a role in the game.
 
cant get mine to work..

have the 6 cans, have a camp fire, toolbox, and water. boiled. cant seem to get any sort of context menu up or scroll menu for smelting.
 
If your not getting the context menu then there something wrong with the entries in your self Action file.

Check you compiles.sqf file and it should point to your custom location for your self file.
Code:
//  fnc_usec_selfActions =        compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_selfActions.sqf";        //Checks which actions for self
    fnc_usec_selfActions =        compile preprocessFileLineNumbers "dayz_code\compile\fn_selfActions.sqf";            // fnc_usec_selfActions - adds custom actions to dayz code
 
Back
Top