Jump to content

[TUTORIAL] Harvestable hemp, smoking weed, pot farms.


FragZ

Recommended Posts

in mission.pbo/custom/ui_selectSlot.sqf

private ["_control","_button","_parent","_group","_pos","_item","_conf","_name","_cfgActions","_numActions","_height","_menu","_config","_type","_script","_outputOriented","_compile","_array","_outputClass","_outputType"];
disableSerialization;
_control = 	_this select 0;
_button =	_this select 1;
_parent = 	findDisplay 106;

//if ((time - dayzClickTime) < 1) exitWith {};

if (_button == 1) then {
	//dayzClickTime = time;
	_group = _parent displayCtrl 6902;
	
	_pos = 		ctrlPosition _group;
	_pos set [0,((_this select 2) + 0.48)];
	_pos set [1,((_this select 3) + 0.07)];
	
	_item = gearSlotData _control;
	
	_conf = configFile >> "cfgMagazines" >> _item;
	if (!isClass _conf) then {
		_conf = configFile >> "cfgWeapons" >> _item;
	};
	_name = getText(_conf >> "displayName");
	
	_cfgActions = _conf >> "ItemActions";
	_numActions = (count _cfgActions);
	_height = 0;
	
	//Populate Menu
	for "_i" from 0 to (_numActions - 1) do 
	{
		_menu = 	_parent displayCtrl (1600 + _i);
		_menu ctrlShow true;
		_config = 	(_cfgActions select _i);
		_type = 	getText	(_config >> "text");
		_script = 	getText	(_config >> "script");
		_outputOriented = 	getNumber	(_config >> "outputOriented") == 1;
		_height = _height + (0.025 * safezoneH);
		_compile =  format["_id = '%2' %1;",_script,_item];
		uiNamespace setVariable ['uiControl', _control];
		if (_outputOriented) then {
			/*
				This flag means that the action is output oriented
				the output class will then be transferred to the script
				and the type used for the name
			*/			
			_array = 	getArray	(_config >> "output");
			_outputClass = _array select 0;
			_outputType = _array select 1;
			_name = getText (configFile >> _outputType >> _outputClass >> "displayName");
			_compile =  format["_id = ['%2',%3] %1;",_script,_item,_array];
		};
		
		_menu ctrlSetText format[_type,_name];
		_menu ctrlSetEventHandler ["ButtonClick",_compile];
	};
	
		// Add extra context menus
	_erc_cfgActions = (missionConfigFile >> "ExtraRc" >> _item);
	_erc_numActions = (count _erc_cfgActions);
	if (isClass _erc_cfgActions) then {
		for "_j" from 0 to (_erc_numActions - 1) do 
		{
			_menu = 	_parent displayCtrl (1600 + _j + _numActions);
			_menu ctrlShow true;
			_config = 	(_erc_cfgActions select _j);
			_text = 	getText	(_config >> "text");
			_script = 	getText	(_config >> "script");
			_height = _height + (0.025 * safezoneH);
			uiNamespace setVariable ['uiControl', _control];
			_menu ctrlSetText _text;
			_menu ctrlSetEventHandler ["ButtonClick",_script];
		};
	};
	
	_pos set [3,_height];
	//hint format["Obj: %1 \nHeight: %2\nPos: %3",_item,_height,_grpPos];		

	_group ctrlShow true;
	ctrlSetFocus _group;
	_group ctrlSetPosition _pos;
	_group ctrlCommit 0;
};

and compile in mission.pbo/custom edited with the right call : player_selectSlot =            compile preprocessFileLineNumbers "custom\ui_selectSlot.sqf";

Link to comment
Share on other sites

Thanks, but the problem with the missing file still exists:

ErrorMessage: File mpmissions\__cur_mp.Napf\description.ext, line 152: /ExtraRc/: Missing '}'

 

No idea about this?

That would be in your description.ext...   check around line 152 for a missing bracket!

Link to comment
Share on other sites

Hi, i v got a small problem.

 

When i try to harvest with the knife i receve the "You need to be near the weed plants in order to gather" but i'm stucked on the fiberplant

 

 

When i try to smoke it (after bought it from trader because i cannot harvest it) i dont get the option to smoke juste the option to craft the hemp kilo in a bandage.

 

<Any help?

My opinion is that you didin't put the fiberplants correctly... may you paste your building.sqf file which has fiberplant in it?

 

Should be something like this (diff position as I use chernarus)

 

_vehicle_114 = objNull;
if (true) then
{
  _this = createVehicle ["fiberplant", [9898.959, 6710.436, 0.014818626], [], 0, "CAN_COLLIDE"];
  _vehicle_114 = _this;
  _this setPos [9898.959, 6710.436, 0.014818626];
};
Link to comment
Share on other sites

if (isServer) then {

_vehicle_1202 = objNull;
if (true) then
{
  _this = createVehicle ["fiberplant", [1146.7228, 4540.5806], [], 0, "CAN_COLLIDE"];
  _vehicle_1202 = _this;
  _this setPos [1146.7228, 4540.5806];
};

_vehicle_1204 = objNull;
if (true) then
{
  _this = createVehicle ["fiberplant", [1151.2712, 4540.7715, 0], [], 0, "CAN_COLLIDE"];
  _vehicle_1204 = _this;
  _this setPos [1151.2712, 4540.7715, 0];
};

_vehicle_1206 = objNull;
if (true) then
{
  _this = createVehicle ["fiberplant", [1155.9838, 4540.7412], [], 0, "CAN_COLLIDE"];
  _vehicle_1206 = _this;
  _this setPos [1155.9838, 4540.7412];
};

_vehicle_1208 = objNull;
if (true) then
{
  _this = createVehicle ["fiberplant", [1160.6831, 4540.9092], [], 0, "CAN_COLLIDE"];
  _vehicle_1208 = _this;
  _this setPos [1160.6831, 4540.9092];
};

_vehicle_1210 = objNull;
if (true) then
{
  _this = createVehicle ["fiberplant", [1165.0355, 4540.8765], [], 0, "CAN_COLLIDE"];
  _vehicle_1210 = _this;
  _this setPos [1165.0355, 4540.8765];
};
};

Installed in server side and called from server_fonctions.sqf

Link to comment
Share on other sites

For a more "mellow" high. lol. Use this....

    /*
    by: ZeroK00L
    */
    [] spawn {
    hint "You roll a fatty and smoke it! Damn! That shit is the chronic!";
    player removeMagazine 'ItemKiloHemp';
    Remove_Drug_effects =
    {
    {
    ppEffectDestroy _x;
    } forEach (_this select 0);
    ppEffectDestroy ppe2;
    ppEffectDestroy ppe3;
    setaperture 0;
    };
    _time = time;
    _effects = [];
	player playMoveNow "ActsPercMstpSnonWpstDnon_sceneBardak01";
    while {true} do
    {
    ppe2 = ppEffectCreate ["chromAberration", 1555];
    _effects = _effects + [ppe2];
    ppe2 ppEffectAdjust [random 0.25,random 0.25,true];
    ppe2 ppEffectCommit 1;
    ppe2 ppEffectEnable true;
    ppe3 = ppEffectCreate ["radialBlur", 1555];
    _effects = _effects + [ppe3];
    ppe3 ppEffectEnable true;
    ppe3 ppEffectAdjust [random 0.02,random 0.02,0.15,0.15];
    ppe3 ppEffectCommit 1;
    sleep random(1);
    if (_time + 60 < time) exitWith {[_effects] call Remove_Drug_effects;};
    };
    };

Plus using this, hopefully your players wont go into epileptic seizures like the posted smokeshit.sqf. lol. This is the one I use on my Altis Life Server. Enjoy!

 

Zero

Link to comment
Share on other sites

Plus using this, hopefully your players wont go into epileptic seizures like the posted smokeshit.sqf. lol. This is the one I use on my Altis Life Server. Enjoy!

Haha, thanks, this is what i needed. The original one was too exadurated

Link to comment
Share on other sites

Ok so,

 

When i add fiberlpant trought the editor i cannot harverst it.

If i try to harvest the fiberplant that are already on the NAPFIsland map i can harvest them.

 

Anyway, i cannot smoke the kilo hemp harvested.

I can only sell it.

:(

Link to comment
Share on other sites

Ok so,

 

When i add fiberlpant trought the editor i cannot harverst it.

If i try to harvest the fiberplant that are already on the NAPFIsland map i can harvest them.

 

Anyway, i cannot smoke the kilo hemp harvested.

I can only sell it.

:(

Harvesting of Hemp is already allowed on the NAPF map. The proper classname for Fiberplant on the NAPF map is p_fiberplant_ep1.p3d

 

For some reason it was removed from certain maps like Chernarus, that is why someone created this Script. So essentially, all you need is the smoke script. Make sure you are right clicking on the Hemp too, Its not a scroll wheel option. Hope this helps.

Link to comment
Share on other sites

Thx mate i ll try with this classanme.

 

About the smoke srcipt yes i trying it with right click on kilo hemp and i'm only able to craft bandage with it

 

If your going to go through and make a hemp farm in the editor, use or find this classname p_fiberplant_ep1. Omit the .p3d part. It should be in the editor for you for NAPF. Look under Map_Plants or something like that. If not, use a different plant and replace as this tutorial instructs.

 

As far as your smoke Script, if you Right Click and nothing happens. That means there is an issue with your UISelectSlot or ExtraRC. Not sure if this was asked but did you do the custom call to your UISelectSlot? For instance..

 

player_selectSlot =            compile preprocessFileLineNumbers "fixes\ui_selectSlot.sqf";

 

If you did not do this part, then there is your problem. Go back through Maca's Right Click Tutorial linked at the beginning of this Tutorial. If you have trouble with it let me know and I will walk you through it :)

 

Zero

Link to comment
Share on other sites

Ok it's working now....

 

But it get always 1 problem.

 

The fiberplant i add trought the editor and harvestable will still reain after been harvested.

That' means they can be harvested infinitly.

How can i modify this to delete plant harvested?

/*
put together for DayZ Epoch
Credits to Shogun338 from Insurrection gaming
modified for separate "gather weed" script
*/
 
private ["_gearmenu","_playerPos","_nearWeed","_weed","_objectID","_objectUID"];
_playerPos = getPosATL player;
_hempqty = {_x == "ItemKiloHemp"} count magazines player;
_nearWeed = count nearestObjects [_playerPos, ["fiberplant"], 4] > 0;
_weed = nearestObject [player, "fiberplant"];
 
if !(_nearWeed) exitWith {
	cutText [format["Vos devez être à proximité des plantes pour les récolter."], "PLAIN DOWN"];
};
if (_hempqty > 2) exitWith { 
    cutText [format["Attention: %1, Vous avez atteint la capacité maximum de ganja.", name player], "PLAIN DOWN"];
};
if (dayz_combat == 1) then { 
    cutText [format["Vous êtes en combat, vous devez attendre pour récolter."], "PLAIN DOWN"];
} else {
	disableSerialization;
	_gearmenu = FindDisplay 106;
	_gearmenu CloseDisplay 106;
	player playActionNow "Medic";
	r_interrupt = false;
	sleep 6;
	_objectID = _weed getVariable["ObjectID","0"];
	_objectUID = _weed getVariable["ObjectUID","0"];
	deleteVehicle _weed;
	[_objectID,_objectUID] call server_deleteObj;
	_weed setDamage 1;
	player addMagazine "ItemKiloHemp";
	sleep 2;
	cutText [format["Vous avez récoltez de la ganja, fumez là ou vendez là!"], "PLAIN DOWN"];	
};

Thx anyway

Link to comment
Share on other sites

Ok it's working now....

 

But it get always 1 problem.

 

The fiberplant i add trought the editor and harvestable will still reain after been harvested.

That' means they can be harvested infinitly.

How can i modify this to delete plant harvested?

/*
put together for DayZ Epoch
Credits to Shogun338 from Insurrection gaming
modified for separate "gather weed" script
*/
 
private ["_gearmenu","_playerPos","_nearWeed","_weed","_objectID","_objectUID"];
_playerPos = getPosATL player;
_hempqty = {_x == "ItemKiloHemp"} count magazines player;
_nearWeed = count nearestObjects [_playerPos, ["fiberplant"], 4] > 0;
_weed = nearestObject [player, "fiberplant"];
 
if !(_nearWeed) exitWith {
	cutText [format["Vos devez être à proximité des plantes pour les récolter."], "PLAIN DOWN"];
};
if (_hempqty > 2) exitWith { 
    cutText [format["Attention: %1, Vous avez atteint la capacité maximum de ganja.", name player], "PLAIN DOWN"];
};
if (dayz_combat == 1) then { 
    cutText [format["Vous êtes en combat, vous devez attendre pour récolter."], "PLAIN DOWN"];
} else {
	disableSerialization;
	_gearmenu = FindDisplay 106;
	_gearmenu CloseDisplay 106;
	player playActionNow "Medic";
	r_interrupt = false;
	sleep 6;
	_objectID = _weed getVariable["ObjectID","0"];
	_objectUID = _weed getVariable["ObjectUID","0"];
	deleteVehicle _weed;
	[_objectID,_objectUID] call server_deleteObj;
	_weed setDamage 1;
	player addMagazine "ItemKiloHemp";
	sleep 2;
	cutText [format["Vous avez récoltez de la ganja, fumez là ou vendez là!"], "PLAIN DOWN"];	
};

Thx anyway

 

Change this

 

_nearWeed = count nearestObjects [_playerPos, ["fiberplant"], 4] > 0;
_weed = nearestObject [player, "fiberplant"];

To this


_nearWeed = count nearestObjects [_playerPos, ["p_fiberplant_ep1"], 4] > 0;
_weed = nearestObject [player, "p_fiberplant_ep1"];

:D

Link to comment
Share on other sites

Nope it will not work.

 

On NAPF Island you cannot add fiberplant by adding this classname "p_fiberplant_ep1" because itsnt recognised and will be not showing the plant under this classname.

I added the fiberplant by adding the classname fiberplant or it doesnt work on the mapping...

Link to comment
Share on other sites

I use this script on napf, it works perfectly

 

My Files:

Plants.sqf   Fiber plant farm at 046 038 on napf

Smokeshit.sqf  

hemp.sqf

extra_rc.hpp Has all the extra stuff that i have too for other scripts, you can remove it if you want

That setup is similar in mine. The only thing different about Napf is that fiberplant is already in it :P

Ty for liinking your files so people struggling can take a look at it!

Link to comment
Share on other sites

How would i add it to the hiedisql .  i put it in like ["ItemKilohemp",1]   also added Drugs to the blackmarket trader.  i went to the blackmarket and see drugs but nothing pops in it.    also, it only allows me to harvest 3 plants and then say's, can't harvest anymore or the police will arrest me, lol. how to fix both problems, thx guys.  [ everything else works ] 

Link to comment
Share on other sites

How would i add it to the hiedisql .  i put it in like ["ItemKilohemp",1]   also added Drugs to the blackmarket trader.  i went to the blackmarket and see drugs but nothing pops in it.    also, it only allows me to harvest 3 plants and then say's, can't harvest anymore or the police will arrest me, lol. how to fix both problems, thx guys.  [ everything else works ] 

 

Change

_hempqty > 2

 

in

if (_hempqty > 2) exitWith {
cutText [format["WARNING: %1, You have maximum amount of weed in your inventory! You could get arrested by the police ;)", name player], "PLAIN DOWN"];

To whatever number you want. Or put it in the gear.

As for the itemkilohemps, you gotta add the Itemkilohemp to the Traders data

Link to comment
Share on other sites

Change

_hempqty > 2

 

in

if (_hempqty > 2) exitWith {
cutText [format["WARNING: %1, You have maximum amount of weed in your inventory! You could get arrested by the police ;)", name player], "PLAIN DOWN"];

To whatever number you want. Or put it in the gear.

As for the itemkilohemps, you gotta add the Itemkilohemp to the Traders data

 

would proberbly be better if you changed it to check if players inventory is full instead ... tbh i think setting a limit to how many you can have in your inventory is a bit stupid, since you can just put some down and harvest more, however checking if inventory is full will make sure the player can not have more magazines than allowed in inventory.

 

also i made a little somethin-somethin here for everyone who does not know how to use the editor or if you are just tierd of the same old field in the same old spot:

 

this script will create a random amount of farms and plants each restart, plants are created "labyrinth style" so it will seem like its placed perfectly close no matter how many plants you want and where they end up, markers are automaticly set for each farm and there is an option to blacklist areas like tradecitys ... (as always in my scripts) there is a few settings you can customize a bit ...

you can set how many farms you want max/min, how many plants you want max/min, how far from roads you want it to spawn and blacklisted areas where weed will not spawn (areas for cherno and napf is preset).

 

have fun:

 
Link to comment
Share on other sites

nice, but that dose not answer my question man, lol.  i seen it on a server that i was and still playing on but cant get a hold of the scripter. he added a little piece of script to the blackmarket trader to when u go up to him, u scroll on the mouse wheel and u have the option to sell all the weed u have for 2 10oz gold and it will sell all the weed in ur inventory 1 at a time instead of going in to the trader menu and selling it 1 at a time urself.

.  

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
×
×
  • Create New...