Jump to content

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


FragZ

Recommended Posts

hm, i have newest infistar installed and i am as admin inside. but i also wont geht those effects with my fresh installed "Smoke the Bong at Traders"  which is nearly the same.

 

no matter which effect script i use on both (smoke the bong and smoke the weed)  i only get black / white screen, all the animations and sounds work well.. thats all...

 

any suggestions?

 

i really want those color phase shiftings with blur and stuff, stuttering cam effects, like shown in the picture/video above...

Link to comment
Share on other sites

  • 2 weeks later...

ok, yesterday i found my client RPT for the first time.. i thought before, that it would be merged with the server  rpt, but that wasnt..

 

so here is an error about that smoking stuff

Error in expression <ayer_fillfuel = -1;
player removeAction s_player_hookahHit;
s_player_hookahHit =>
  Error position: <s_player_hookahHit;
s_player_hookahHit =>
  Error Undefined variable in expression: s_player_hookahhit
File mpmissions\__CUR_MP.Chernarus\scripts\fn_selfActions.sqf, line 942
..
.

Error in expression <"",""];
};
} else {
player removeAction s_player_hookahHit;
s_player_hookahHit =>
  Error position: <s_player_hookahHit;
s_player_hookahHit =>
  Error Undefined variable in expression: s_player_hookahhit
File mpmissions\__CUR_MP.Chernarus\scripts\fn_selfActions.sqf, line 655
Client: Object 2:677 (type Type_98) not found.
Cannot create non-ai vehicle c_grasstall,

any ideas?
Link to comment
Share on other sites

 

ok, yesterday i found my client RPT for the first time.. i thought before, that it would be merged with the server  rpt, but that wasnt..

 

so here is an error about that smoking stuff

Error in expression <ayer_fillfuel = -1;
player removeAction s_player_hookahHit;
s_player_hookahHit =>
  Error position: <s_player_hookahHit;
s_player_hookahHit =>
  Error Undefined variable in expression: s_player_hookahhit
File mpmissions\__CUR_MP.Chernarus\scripts\fn_selfActions.sqf, line 942
..
.

Error in expression <"",""];
};
} else {
player removeAction s_player_hookahHit;
s_player_hookahHit =>
  Error position: <s_player_hookahHit;
s_player_hookahHit =>
  Error Undefined variable in expression: s_player_hookahhit
File mpmissions\__CUR_MP.Chernarus\scripts\fn_selfActions.sqf, line 655
Client: Object 2:677 (type Type_98) not found.
Cannot create non-ai vehicle c_grasstall,

any ideas?

 

where did you get the variable hookahhit from? I dont remember seeing that in the script. Anyways, post your fn_selfactions.sqf, just the part where this is, not the whole thing.

Link to comment
Share on other sites

omg,

i was trying to use the same effect on the hookah bong,

wrong error msg..sorry, my bad...

here´s the correct one, there we can see why GR8´s version does not work on my server...

 

Error in expression <icle _weed;
[_objectID,_objectUID] call server_deleteObj;
_weed setDamage 1;
pla>
  Error position: <server_deleteObj;
_weed setDamage 1;
pla>
  Error Undefined variable in expression: server_deleteobj
File mpmissions\__CUR_MP.Chernarus\scripts\hemp.sqf, line 31
Error in expression <lse {Flare attachTo [player,[0,0,0.]];}
ppe2 = ppEffectCreate ["chromAberration">
  Error position: <ppe2 = ppEffectCreate ["chromAberration">
  Error Missing ;
File mpmissions\__CUR_MP.Chernarus\scripts\smokeshit.sqf, line 31
Error in expression <lse {Flare attachTo [player,[0,0,0.]];}
ppe2 = ppEffectCreate ["chromAberration">
  Error position: <ppe2 = ppEffectCreate ["chromAberration">
  Error Missing ;
File mpmissions\__CUR_MP.Chernarus\scripts\smokeshit.sqf, line 31
 

here´s the hemp.sqf  

 

/*
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["You need to be near the weed plants in order to gather."], "PLAIN DOWN"];
};
if (_hempqty > 6) 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"];
};
if (dayz_combat == 1) then {
cutText [format["You are in Combat and Cannot Gather the Weed."], "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["You've Gathered Some Weed! Smoke that shit or sell it at Drug market dealer!!"], "PLAIN DOWN"];
};

here´s the smokeshit.sqf

 [] spawn {
    hint "You just smoked a huge blunt! And you are high now as crazy fuck! (lasts 90 seconds)";
    player removeMagazine 'ItemKiloHemp';
    player setDamage 0;
    r_player_inpain = false;
    r_player_injured = false;
    dayz_hunger    = dayz_hunger + 0.4;
    dayz_thirst = dayz_thirst + 0.4;
    r_player_lowblood = 	false;
    dayz_sourceBleeding =	objNull;
    player setVariable ["USEC_injured",false,true];
   {player setVariable[_x,false,true];} forEach USEC_woundHit;
    player setVariable['medForceUpdate',true,true];
	
    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
		{
		Flare = "SmokeShellGreen" createVehicle position player;
		if (vehicle player != player) then { Flare attachTo [vehicle player,[0,0,0.]];}
		else {Flare attachTo [player,[0,0,0.]];}
		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 + 90 < time) exitWith {[_effects] call Remove_Drug_effects;};
		};
 };

Link to comment
Share on other sites

omg,

i was trying to use the same effect on the hookah bong,

wrong error msg..sorry, my bad...

here´s the correct one, there we can see why GR8´s version does not work on my server...

 

Error in expression <icle _weed;
[_objectID,_objectUID] call server_deleteObj;
_weed setDamage 1;
pla>
  Error position: <server_deleteObj;
_weed setDamage 1;
pla>
  Error Undefined variable in expression: server_deleteobj
File mpmissions\__CUR_MP.Chernarus\scripts\hemp.sqf, line 31
Error in expression <lse {Flare attachTo [player,[0,0,0.]];}
ppe2 = ppEffectCreate ["chromAberration">
  Error position: <ppe2 = ppEffectCreate ["chromAberration">
  Error Missing ;
File mpmissions\__CUR_MP.Chernarus\scripts\smokeshit.sqf, line 31
Error in expression <lse {Flare attachTo [player,[0,0,0.]];}
ppe2 = ppEffectCreate ["chromAberration">
  Error position: <ppe2 = ppEffectCreate ["chromAberration">
  Error Missing ;
File mpmissions\__CUR_MP.Chernarus\scripts\smokeshit.sqf, line 31

 

here´s the hemp.sqf  

/*
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["You need to be near the weed plants in order to gather."], "PLAIN DOWN"];
};
if (_hempqty > 6) 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"];
};
if (dayz_combat == 1) then {
cutText [format["You are in Combat and Cannot Gather the Weed."], "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["You've Gathered Some Weed! Smoke that shit or sell it at Drug market dealer!!"], "PLAIN DOWN"];
};

 

here´s the smokeshit.sqf

[] spawn {
    hint "You just smoked a huge blunt! And you are high now as crazy fuck! (lasts 90 seconds)";
    player removeMagazine 'ItemKiloHemp';
    player setDamage 0;
    r_player_inpain = false;
    r_player_injured = false;
    dayz_hunger    = dayz_hunger + 0.4;
    dayz_thirst = dayz_thirst + 0.4;
    r_player_lowblood = 	false;
    dayz_sourceBleeding =	objNull;
    player setVariable ["USEC_injured",false,true];
   {player setVariable[_x,false,true];} forEach USEC_woundHit;
    player setVariable['medForceUpdate',true,true];
	
    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
		{
		Flare = "SmokeShellGreen" createVehicle position player;
		if (vehicle player != player) then { Flare attachTo [vehicle player,[0,0,0.]];}
		else {Flare attachTo [player,[0,0,0.]];}
		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 + 90 < time) exitWith {[_effects] call Remove_Drug_effects;};
		};
 };

for future reference when you have an RPT error and you're posting here for help, it

 

Now. In the smokeshit.sqf

if (vehicle player != player) then { Flare attachTo [vehicle player,[0,0,0.]];}

There's a period after the last zero that shouldn't be there

and the same here

else {Flare attachTo [player,[0,0,0.]];}

Also the problems I mentioned with this script earlier still exist. Try copy pasting one of the fixes we tried earlier and get rid of the periods after the zeroes like I did above

Try this

 [] spawn {
    hint "You just smoked a huge blunt! Feel the high kick in! (lasts 90 seconds)";
    player removeMagazine 'ItemKiloHemp';
    player setDamage 0;
    r_player_inpain = false;
    r_player_injured = false;
    dayz_hunger    = dayz_hunger + 0.4;
    dayz_thirst = dayz_thirst + 0.4;
    r_player_lowblood = 	false;
    dayz_sourceBleeding =	objNull;
    player setVariable ["USEC_injured",false,true];
   {player setVariable[_x,false,true];} forEach USEC_woundHit;
    player setVariable['medForceUpdate',true,true];
	
    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
		{
		Flare = "SmokeShellGreen" createVehicle position player;
		if (vehicle player != player) then { Flare attachTo [vehicle player,[0,0,0]];}
		else {Flare attachTo [player,[0,0,0]];}
		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 + 90 < time) exitWith {[_effects] call Remove_Drug_effects;};
		};
 };

 

As for the hemp.sqf just use this.

    /*
    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["You need to be near the marijauna plants in order to harvest."], "PLAIN DOWN"];
    };
	/*
    if (_hempqty > 2) exitWith {
    cutText [format["WARNING: %1, You cannot legally carry anymore Marijuana", name player], "PLAIN DOWN"];
    };
	*/
    if (dayz_combat == 1) then {
    cutText [format["You are in Combat and Cannot Harvest the Marijuana."], "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["You've Harvested Some Marijuana! Right click on it to Smoke it and regain health or sell it at Medical traders!!"], "PLAIN DOWN"];	
    };

Link to comment
Share on other sites

both new files you given dont work.

now i even cant harvest with right click on plant, nor i can smoke it...

error msg directly appears when i try to right click on hemp or knife

File mpmissions\__CUR_MP.Chernarus\scripts\smokeshit.sqf, line 31
Error in expression <else {Flare attachTo [player,[0,0,0]];}
ppe2 = ppEffectCreate ["chromAberration">
  Error position: <ppe2 = ppEffectCreate ["chromAberration">
  Error Missing ;
File mpmissions\__CUR_MP.Chernarus\scripts\smokeshit.sqf, line 31 
Link to comment
Share on other sites

both new files you given dont work.

now i even cant harvest with right click on plant, nor i can smoke it...

error msg directly appears when i try to right click on hemp or knife

File mpmissions\__CUR_MP.Chernarus\scripts\smokeshit.sqf, line 31
Error in expression <else {Flare attachTo [player,[0,0,0]];}
ppe2 = ppEffectCreate ["chromAberration">
  Error position: <ppe2 = ppEffectCreate ["chromAberration">
  Error Missing ;
File mpmissions\__CUR_MP.Chernarus\scripts\smokeshit.sqf, line 31 

idk what you're doing wrong with the hemp.sqf then bud, it works perfectly fine on my server.

I dont know how to fix the smokeshit.sqf then. I dont use that script and I dont understand where it's missing the ;

Link to comment
Share on other sites

ok just for my understanding:

Are the plants stored in the database?

Are the plants spawned on server restart new and on random directions?

 

If the plant is not stored in the database, then there is no reason for this code:

hemp.sqf

[_objectID,_objectUID] call server_deleteObj;

other then that, its even missing some content and should give some errors.

 

BTW: Why there is not an option to cancel the farming process when moving? This could come in handy in some situations, just sayin' ^^

 

 

The missing ; is in line 30 after the last }

else {Flare attachTo [player,[0,0,0.]];} << here add a ;
Link to comment
Share on other sites

 

ok just for my understanding:

Are the plants stored in the database?

Are the plants spawned on server restart new and on random directions?

 

If the plant is not stored in the database, then there is no reason for this code:

hemp.sqf

[_objectID,_objectUID] call server_deleteObj;

other then that, its even missing some content and should give some errors.

 

BTW: Why there is not an option to cancel the farming process when moving? This could come in handy in some situations, just sayin' ^^

 

 

The missing ; is in line 30 after the last }

else {Flare attachTo [player,[0,0,0.]];} << here add a ;

 I think the way he's using it, they spawn as "missions" around the map. Wouldnt that line of code delete the object after you've harvested it, so you can't continue harvesting the same plant indefinitely?

Link to comment
Share on other sites

ok just for my understanding:

Are the plants stored in the database?

Are the plants spawned on server restart new and on random directions?

 

If the plant is not stored in the database, then there is no reason for this code:

hemp.sqf

[_objectID,_objectUID] call server_deleteObj;
other then that, its even missing some content and should give some errors.

 

BTW: Why there is not an option to cancel the farming process when moving? This could come in handy in some situations, just sayin' ^^

 

 

The missing ; is in line 30 after the last }

else {Flare attachTo [player,[0,0,0.]];} << here add a ;

Nice one SchwEde, congrats, the missing ; was it!

Which plants u mean, the fiberplant, or the kilohemp?

None of these seems to be in my database. i have commented the line out.

the script runs now, but the only thing i see is the smoke of a green flare.

2015_03_16_00004.jpg

also if i join as normal player, i get directly banned..why?

i really like to see those effects. would that ever be possible???

b7igk6.jpg

Link to comment
Share on other sites

well if the fiberplants are spawned from the server it could be that every player can harvest the plant once, so equal amount of hemp for everybody?! ^^

 

the right command to delete this from every client is this:

	if (isServer) then {
		PVDZE_obj_Delete call server_deleteObj;
	} else {
		PVDZE_obj_Delete = [_objectID,_objectUID,_activatingPlayer];
		publicVariableServer "PVDZE_obj_Delete";
	};

=============================

For you bans: Are you using any kind of antihack? If so check the logs or post your RPT

Link to comment
Share on other sites

there are still some errors left:

 

if (vehicle player != player) then { Flare attachTo [vehicle player,[0,0,0.]];} << 0. not a clever value
else {Flare attachTo [player,[0,0,0.]];} << missing ; at the end. same thing here with the 0.
 
why not attach the smoke to the head instead of to the gound?!
 
if (vehicle player != player) then { Flare attachTo [(vehicle player)];}
		else {Flare attachTo [player,[0,0,1.7]];}; //maybe +- 0.2 to get the right value for the head

 PS: Sry for the double post

Link to comment
Share on other sites

the script runs good, we use only random spawns, not a special mission, which i like to have next. a good fibreplant plantage next to static ai´s.

the only thing left is:

how to get those effects as shown above???

not only the green flare...

btw, how can i disable that flare?

Link to comment
Share on other sites

to get rid of the smoke just remove this part of the code:

Flare = "SmokeShellGreen" createVehicle position player;
		if (vehicle player != player) then { Flare attachTo [vehicle player,[0,0,0.]];}
		else {Flare attachTo [player,[0,0,0.]];}
The effects should be visible if you have ppeffects enabled in your Video Options

Yeah, you´re the greatest, SchwEde!

From what should i knew else that those ppe´s have to enabled first...LOL

now the effects working as i like to have em:D

for the kicks, i have to relog as normal player and check my logs..

million thanks! now the odysse is over after almost 3 weeks ;-)

2202788.jpg

Link to comment
Share on other sites

the ban / kick happens only to non admin players when using the smokegrenade in that script...

when i comment it out, all is fine...

 

12:03:35 "infiSTAR.de Log: TeeBee303 (0000000000) | BadVar 2: Flare"
2015/03/17, 12:03:35 "["PVAHR_0_hhcuyrt_299581",["TeeBee303","00000000000000000","BAN",[66,97,100,86,97,114,32,50,58,32,70,108,97,114,101]]]"
2015/03/17, 12:03:35 "infiSTAR.de Log: SERVER kicked TeeBee303(00000000000000000) @062075"
2015/03/17, 12:03:35 "infiSTAR.de PlayerDisconnected: _uid: 00000000000000000 _name: TeeBee303"
2015/03/17, 12:03:35 "TeeBee303 | PlayerUID: 00000000000000000 CharacterID: 276 | Disconnected near Storage Unit @062075 | Resync Gear to prevent duping!"
2015/03/17, 12:03:35 "get: STRING (00000000000000000), sent: STRING (00000000000000000)"
2015/03/17, 12:03:35 "DISCONNECT: TeeBee303 (00000000000000000) Object: B 1-1-C:1 (TeeBee303) REMOTE, _characterID: 276 at loc [6287.35,7811.21,0.00146484]"
2015/03/17, 12:03:35 Client: Remote object 3:7 not found
2015/03/17, 12:03:35 Warning: Cleanup player - person 3:4 not found
Seems to be an BE Filter Thing, but no clue how to fix it...

maybe i leave it disabled ;-)

or its just an insert in some infistar file?

Link to comment
Share on other sites

  • 4 weeks later...

Well, its a pretty simple instruction and you cant do much wrong. :D

And I am not using any antihack, yet.

 

but thank you for your fast answer.

 

i just love how people always assume it must be something wrong with the script if they cant get it to work ...

 

the script works perfectly fine btw ... show us your init and or rpt errors or we cant help you

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