davidoss 552 Posted November 16, 2018 HI. Maybe someone can find this usable. This script allow players to create one fire place at time in proper world places. The action is shown only if you put character ass on the ground. If you have one created already somebody need to remove it before you would be able to create another one. /* file: fireplace.sqf by DaVidoSS adds ability to create fireplace parameters none return VOID usage: //initPlayerLocal.sqf [] execVM "fireplace.sqf"; player addEventHandler ["Respawn", { deleteVehicle ((_this select 1) getVariable ['mycampfire',objNull]); [] execVM "fireplace.sqf"; }]; */ if !(hasInterface) exitWith {}; player addAction [ "<t>Set Up Fireplace</t><img size='1' image='\a3\ui_f\data\IGUI\Cfg\Actions\Obsolete\ui_action_fire_in_flame_ca'/>", { params [["_target",objNull,[objNull]],["_unit",objNull,[objNull]]]; (AGLToASL (_unit modelToWorldVisual [0,1.5,0])) params ["_vx","_vy","_vz"]; if !(isNull (objectParent _unit)) exitWith {hint "Really? While driving?"}; if (surfaceIsWater (position _unit)) exitWith {hint "Oh come on, you cant be that stupid!"}; if !(isTouchingGround _unit) exitWith {hint "Ok, but hit the ground first!"}; if !(count (lineIntersectsObjs [(AGLToASL (_unit modelToWorldVisual [0,1.5,0])), [_vx,_vy,(_vz + 20)]]) == 0) exitWith {hint "Open your eyes, you wanna burn something?"}; _unit playMove "AinvPknlMstpSnonWnonDnon_medicUp3"; sleep 7; private _campFire = createVehicle ["FirePlace_burning_F", (_unit modelToWorldVisual [0,1.5,0]), [], 0, "CAN_COLLIDE"]; _unit setVariable ["mycampfire",_campFire,false]; 0 = [_campFire, [ "<t>Remove Fireplace</t><img size='1' image='\a3\ui_f\data\IGUI\Cfg\Actions\Obsolete\ui_action_fire_put_down_ca'/>", { params [["_target",objNull,[objNull]],["_unit",objNull,[objNull]]]; _unit playMove "AinvPknlMstpSnonWnonDnon_medicUp3"; sleep 7; deleteVehicle _target; },nil,0,true,true,"","true",3,false,"","" ] ] remoteExec ["addAction", [0,-2] select isDedicated,_campFire]; },nil,0,false,true,"", "isNull (_this getVariable ['mycampfire',objNull]) && {((animationState _this) in ['amovpsitmstpsnonwpstdnon_ground','amovpsitmstpslowwrfldnon','amovpsitmstpsnonwnondnon_ground'])}", -1, false, "", ""]; and version where you can restrict it according to some 2 items and its count, in player inventory. /* file: fireplace.sqf by DaVidoSS adds ability to create fireplace parameters: 0 ARRAY return VOID usage: //initPlayerLocal.sqf 0 = [[["zk_wood",2],["zk_matches",1]]] execVM "fireplace.sqf"; player addEventHandler ["Respawn", { deleteVehicle ((_this select 1) getVariable ['mycampfire',objNull]); 0 = [[["zk_wood",2],["zk_matches",1]]] execVM "fireplace.sqf"; }]; version where you can restrict it according to some 2 items and its count, in player inventory. */ if !(hasInterface) exitWith {}; private _checkparam = params [["_required_items",[],[[]],2]]; if !(_checkparam) exitWith {diag_log "**************** script fireplace.sqf exited - wrong params given**********************"}; player addAction [ "<t>Set Up Fireplace</t><img size='1' image='\a3\ui_f\data\IGUI\Cfg\Actions\Obsolete\ui_action_fire_in_flame_ca'/>", { params [["_target",objNull,[objNull]],["_unit",objNull,[objNull]],["_actionID",-1,[0]],["_required_items",[],[[]],2]]; (AGLToASL (_unit modelToWorldVisual [0,1.5,0])) params ["_vx","_vy","_vz"]; if !(isNull (objectParent _unit)) exitWith {hint "Really? While driving?"}; if (surfaceIsWater (position _unit)) exitWith {hint "Oh come on, you cant be that stupid!"}; if !(isTouchingGround _unit) exitWith {hint "Ok, but hit the ground first!"}; if !(count (lineIntersectsObjs [(AGLToASL (_unit modelToWorldVisual [0,1.5,0])), [_vx,_vy,(_vz + 20)]]) == 0) exitWith {hint "Open your eyes, you wanna burn something?"}; private _fnc_itemsCheck = { private _return = false; private _checkparam = _required_items params [["_woods_array",[],[[]],2],["_matches_array",[],[[]],2]]; if !(_checkparam) exitWith { hint "Script fireplace.sqf exited - wrong params given"; _unit removeAction _actionID; (_return) }; _woods_array params [["_woods","",[""]],["_woods_cnt",1,[0]]]; _matches_array params [["_matches","",[""]],["_matches_cnt",1,[0]]]; private _item1_count = {_x == _woods} count items _unit; private _item2_count = {_x == _matches} count items _unit; if (_item1_count >= _woods_cnt && {_item2_count >= _matches_cnt}) then { for "_i" from 1 to _woods_cnt do { _unit removeItem _woods; }; for "_i" from 1 to _matches_cnt do { _unit removeItem _matches; }; _return = true; } else { hint format [ "You need %1 %2 and %3 %4 to make fire", _woods_cnt,(getText (configfile >> "CfgWeapons" >> _woods >> "displayName")), _matches_cnt,(getText (configfile >> "CfgWeapons" >> _matches >> "displayName")) ]; }; (_return) }; if ([] call _fnc_itemsCheck) then { _unit playMove "AinvPknlMstpSnonWnonDnon_medicUp3"; sleep 7; private _campFire = createVehicle ["FirePlace_burning_F", (_unit modelToWorldVisual [0,1.5,0]), [], 0, "CAN_COLLIDE"]; _unit setVariable ["mycampfire",_campFire,false]; 0 = [_campFire, [ "<t>Remove Fireplace</t><img size='1' image='\a3\ui_f\data\IGUI\Cfg\Actions\Obsolete\ui_action_fire_put_down_ca'/>", { params [["_target",objNull,[objNull]],["_unit",objNull,[objNull]]]; _unit playMove "AinvPknlMstpSnonWnonDnon_medicUp3"; sleep 7; deleteVehicle _target; },nil,0,true,true,"","true",3,false,"","" ] ] remoteExec ["addAction", [0,-2] select isDedicated,_campFire]; }; },_required_items,0,false,true,"", "isNull (_this getVariable ['mycampfire',objNull]) && {((animationState _this) in ['amovpsitmstpsnonwpstdnon_ground','amovpsitmstpslowwrfldnon','amovpsitmstpsnonwnondnon_ground'])}", -1, false, "", ""]; 2 1 Share this post Link to post Share on other sites
bombajack 11 Posted November 18, 2018 Hi...nice script. Have question. 1.Is possible implement some items what you need for place fire? Ex.: If you have matches and wood then you can place fire. 2.is it MP compatible? Thank you. Share this post Link to post Share on other sites
davidoss 552 Posted November 18, 2018 1.No problem you need to give me classname of item and decide if item should be removed after usage 2.Its very MP compatible Share this post Link to post Share on other sites
bombajack 11 Posted November 18, 2018 (edited) Just now, davidoss said: 1.No problem you need to give me classname of item and decide if item should be removed after usage 2.Its very MP compatible Items are : zk_matches , zk_wood And yes,remove it from inv. Thx! Edited November 18, 2018 by bombajack Bad text Share this post Link to post Share on other sites
davidoss 552 Posted November 18, 2018 moved to first post 1 Share this post Link to post Share on other sites
bombajack 11 Posted November 18, 2018 Just now, davidoss said: /* file: fireplace.sqf by DaVidoSS adds ability to create fireplace parameters none return VOID usage: [] execVM "fireplace.sqf"; version with items required to make fire "zk_wood" and "zk_matches" */ if !(hasInterface) exitWith {}; player addAction [ "<t>Set Up Fireplace</t><img size='1' image='\a3\ui_f\data\IGUI\Cfg\Actions\Obsolete\ui_action_fire_in_flame_ca'/>", { params [["_target",objNull,[objNull]],["_unit",objNull,[objNull]]]; (AGLToASL (_unit modelToWorldVisual [0,1.5,0])) params ["_vx","_vy","_vz"]; if !(isNull (objectParent _unit)) exitWith {hint "Really? While driving?"}; if (surfaceIsWater (position _unit)) exitWith {hint "Oh come on, you cant be that stupid!"}; if !(isTouchingGround _unit) exitWith {hint "Ok, but hit the ground first!"}; if !(count (lineIntersectsObjs [(AGLToASL (_unit modelToWorldVisual [0,1.5,0])), [_vx,_vy,(_vz + 20)]]) == 0) exitWith {hint "Open your eyes, you wanna burn something?"}; private _required_items = ["zk_wood","zk_matches"]; _required_items params [["_wood","",[""]],["_matches","",[""]]]; if (_wood in (items _unit) && {_matches in (items _unit)}) then { _unit playMove "AinvPknlMstpSnonWnonDnon_medicUp3"; sleep 7; private _campFire = createVehicle ["FirePlace_burning_F", (_unit modelToWorldVisual [0,1.5,0]), [], 0, "CAN_COLLIDE"]; _unit setVariable ["mycampfire",_campFire,false]; 0 = [_campFire, [ "<t>Remove Fireplace</t><img size='1' image='\a3\ui_f\data\IGUI\Cfg\Actions\Obsolete\ui_action_fire_put_down_ca'/>", { params [["_target",objNull,[objNull]],["_unit",objNull,[objNull]]]; _unit playMove "AinvPknlMstpSnonWnonDnon_medicUp3"; sleep 7; deleteVehicle _target; },nil,0,true,true,"","true",3,false,"","" ] ] remoteExec ["addAction", [0,-2] select isDedicated,_campFire]; } else { hint "You need wood and matches to make fire"; }; },nil,0,false,true,"", "isNull (_this getVariable ['mycampfire',objNull]) && {((animationState _this) in ['amovpsitmstpsnonwpstdnon_ground','amovpsitmstpslowwrfldnon','amovpsitmstpsnonwnondnon_ground'])}", -1, false, "", ""]; Nice!Thx!Ill try tomorrow on server Share this post Link to post Share on other sites
bombajack 11 Posted November 19, 2018 Hello. This is better called from init or initServer? [] execVM "fireplace.sqf"; player addEventHandler ["Respawn", { deleteVehicle ((_this select 1) getVariable ['mycampfire',objNull]); [] execVM "fireplace.sqf"; }]; Share this post Link to post Share on other sites
davidoss 552 Posted November 19, 2018 initPlayerLocal.sqf only Share this post Link to post Share on other sites
bombajack 11 Posted November 19, 2018 Just now, davidoss said: initPlayerLocal.sqf only And will be visible my fire for others players? Share this post Link to post Share on other sites
genesis92x 810 Posted November 19, 2018 This is awesome, thanks davidoss Share this post Link to post Share on other sites
bombajack 11 Posted November 23, 2018 On 18. 11. 2018 at 7:58 AM, bombajack said: Nice!Thx!Ill try tomorrow on server So i try it today...fire cant be placed..still write "You need matches and wood..." but i have it in inventory...any idea whats wrong? Share this post Link to post Share on other sites
davidoss 552 Posted November 23, 2018 Do you use the latest code? I've tested the code at creation time and found no problem at all Share this post Link to post Share on other sites
bombajack 11 Posted November 24, 2018 12 hours ago, davidoss said: Do you use the latest code? I've tested the code at creation time and found no problem at all I use your code what you represent here.. Share this post Link to post Share on other sites
bombajack 11 Posted November 25, 2018 Ok..i tried lots of combination where put code in initPlayerLocal.....still not working menu on roll mouse. Any idea why? :) Damnn... Here is my initPlayerLocal.sqf: //Executed locally when player joins mission (includes both mission start and JIP). See initialization order for details about when the script is exactly executed. //[player:Object, didJIP:Boolean] //FirePlace [] execVM "fire.sqf"; player addEventHandler ["Respawn", { deleteVehicle ((_this select 1) getVariable ['mycampfire',objNull]); [] execVM "fire.sqf"; }]; waitUntil { !isNil {player} }; waitUntil { player == player }; params ["_player","_jip"]; _name = name _player; if (_name == "headlessclient") exitwith {}; if (_name == "HCSlot") exitwith {}; #include "Code\Shared_Arrays.hpp" swing = false; titleText[format ["%1 ","-= " + missionName + " =-\n\nBY\n-=Bombajack=-"], "BLACK FADED" , 100]; sleep 1; //------------------------------------------------------------------------------------------------- _player addeventhandler ["HandleDamage",{ params ["_man","_hitSelection","_damage","_shooter","_projectile","_hitPartIndex","_instigator","_hitPoint"]; _my_grp = group _man; _his_grp = group _instigator; _newdamage = ((getAllHitPointsDamage _man) select 2); if (_my_grp == _his_grp) then { //_man setDamage [0, false]; _man setDamage 0; _lastdamage = _man getVariable ["MY_DAMAGE",[0,0,0,0,0,0,0,0,0,0,0,0]]; _z = 0; {_man setHitIndex [_z, _x];_z = _z + 1} foreach _lastdamage; _newdamage = ((getAllHitPointsDamage _man) select 2); }; _man setVariable ["MY_DAMAGE",_newdamage,false]; } ]; [_player] execVM "IniDBi\Player_Start.sqf"; keyDown_EHId = ["",0,false,false,false]; [] execVM "briefing.sqf"; waituntil {!isnull (finddisplay 46)}; //--------------------------------------------------------------- (findDisplay 46) displayAddEventHandler ["KeyDown",{ keyDown_EHId = _this; if (vehicle player == player) then { if ((_this select 1) == 59) then { if (((player distance cursorTarget) < 5) && (leader cursorTarget == player)) then {player action ["Gear", cursorTarget]}; }; }; }]; //----------------------------------------------- (findDisplay 46) displayAddEventHandler ["KeyUp", "keyDown_EHId = [(keyDown_EHId select 0),(keyDown_EHId select 1),false,false,false]"]; //----------------------------------------------- (findDisplay 46)displayAddEventHandler["MouseButtonDown",{ _anim = ["AwopPercMstpSgthWnonDnon_start","AwopPercMstpSgthWnonDnon_throw","AwopPercMstpSgthWnonDnon_end"]; if((animationState player in _anim) or (stance player == "PRONE") or (currentWeapon player != "")) exitWith {}; MouseDown_EHId = _this; if (!(dialog) && !(swing)) then { if (str(MouseDown_EHId) == "[Display #46,0,0.5,0.5,false,false,false]") then { _wep = if !(isnil {player getVariable "MELEE"}) then [{player getVariable "MELEE"},{""}]; _delay = 2.5; switch (_wep) do { case "zk_axe": { [player] spawn chopfAxe; }; case "zk_shovel": { [player] spawn chopSvl; }; case "zk_hammer": { [player] spawn chopHam; }; case "zk_knife": { [player] spawn stabKnf;_delay = 1; }; case "zk_wrench": { [player] spawn chopWrn; }; default { swing = false; }; }; _delay spawn {swing = true;sleep _this;swing = false;}; }; }; }]; //--------------------------------------------------------------------------- //[hud, info, radar, compass, direction, menu, group, cursors, squadRadar] showHUD [true,true,true,true,true,true,true,true,false]; //--------------------------------------------------------------------------- player addEventHandler ["InventoryOpened", { _islocked = 0; _tents = nearestObjects [player,["Land_TentA_F","NMIB_Plot_Workbench"], 4]; if (count _tents > 0) then { _uid = getPlayerUID player; _tent = (_tents select 0); _tent_uid = if !(isnil {_tent getVariable "OWNER"}) then [{_tent getVariable "OWNER"},{[]}]; if (_uid != _tent_uid) then {_islocked = 1}; if (_islocked == 1) then { {if ((_x select 0) == _tent_uid) exitwith {_islocked = 0}} foreach (player getvariable "FRIENDS"); }; }; if (locked (_this select 1) == 2) then { _islocked = 1; }; if (locked (_this select 1) == 3) then { _islocked = 0; }; if (_islocked == 1) then { _inv = (nearestObjects [player, ["GroundWeaponHolder","WeaponHolderSimulated","WeaponHolder"], 3]); if (count _inv > 0) then {deletevehicle (_inv select 0)}; _VEH = (_this select 1); _vehname = if (!isnil {(_VEH getVariable "WHOSVEH")}) then [{(_VEH getVariable "WHOSVEH")},{""}]; if ((name player) != _vehname) then { vehicleorders_PD = [_VEH,"alarm",[]]; if !(isserver) then {publicVariableServer "vehicleorders_PD";}; }; }; }]; //-------------------------------------------------------------------------------------------- [] execVM "Code\Missions_Arrays\No_Fuel.sqf"; //////////////////////////////////////////////////// ///////////////////////////////////////////////////// //////////////////////////////////////////////////////// //Color waitUntil {alive player}; [] execVM "GF_ColorCorrections\GF_ColorCorrections.sqf"; //Breath [] execVM "GF_Breath\GF_Breath.sqf"; #include "AL_strigoi\functions.hpp" /////////////////////////////////////////////////////////////////////////// //////////////////////// Blowout /////////////////////////////////////////////////////////////////////////// _bul = [] execVM "Addons\Blowout\module\blowout_client.sqf"; Share this post Link to post Share on other sites
davidoss 552 Posted November 25, 2018 You need to post mission and info about mods (private) for elaborate what,s wrong with. Share this post Link to post Share on other sites
davidoss 552 Posted November 26, 2018 moved to first post 1 Share this post Link to post Share on other sites