Jump to content

[Tutorial] Effects For Marijuana


IceEagle132

Recommended Posts

Difficulty: Easy

Create Original Idea : Kuchiha

Authors: AlaskaVet

Okay in core/items make a new file called "fn_weed.sqf"
/*
	Author:AlaskaVet
*/

//Close inventory
closeDialog 0;

//Little hint then wait a litle before starting drugs effects
hint "Winners don't use drugs !";
sleep 3;

//Activate ppEffects we need
"chromAberration" ppEffectEnable true;
"radialBlur" ppEffectEnable true;
enableCamShake true;
_smoke = "SmokeShellGreen" createVehicle position player;
if (vehicle player != player) then
    {
        _smoke attachTo [vehicle player, [-0.6,-1,0]];
    }
    else
    {
        _smoke attachTo [player, [0,-0.1,1.5]];
    };
    
//Let's go for 45secs of effetcs
for "_i" from 0 to 44 do
{
    "chromAberration" ppEffectAdjust [random 0.25,random 0.25,true];
    "chromAberration" ppEffectCommit 1;   
    "radialBlur" ppEffectAdjust  [random 0.02,random 0.02,0.15,0.15];
    "radialBlur" ppEffectCommit 1;
    addcamShake[random 3, 1, random 3];
    sleep 1;
};

//Stop effects
"chromAberration" ppEffectAdjust [0,0,true];
"chromAberration" ppEffectCommit 5;
"radialBlur" ppEffectAdjust  [0,0,0,0];
"radialBlur" ppEffectCommit 5;
sleep 6;

//Deactivate ppEffects
"chromAberration" ppEffectEnable false;
"radialBlur" ppEffectEnable false;
resetCamShake;

Now go Into core/pmenu & open "fn_useItem.sqf"

Add under like lock picks like so:

case (_item isEqualTo "lockpick"): {
        [] spawn life_fnc_lockpick;
        closeDialog 0;
    };
	
	case (_item isEqualTo "marijuana"): {
    if(([false,_item,1] call life_fnc_handleInv)) then
	{
        [] spawn life_fnc_weed;
		};
    };

Then Go into file "Functions.h" find "class Items" and add:

class weed {};

 

Edited by AlaskaVet
  • Like 4
Link to comment
Share on other sites

  • 3 weeks later...
  • 1 month later...
  • 1 month later...
On 17/10/2016 at 10:40 AM, JedINyte said:

Why do you not add the smoke grenade to the pelvis (spawns inside you)? It won't float behind you.

 


_smoke attachTo [player, [0,0,0],"Pelvis"];

 

Fuck, that must suck getting a smoke grenade in your pelvis. #BISFunctions2k17

Link to comment
Share on other sites

  • 2 months later...
2 hours ago, winter said:

Helllo im trying to make a custom usable item called "vape" however when i use the item it says its no usable any help would be nice!

Did you add it inside "fn_useItem.sqf"

case (_item isEqualTo "marijuana"): {
        [] spawn life_fnc_weed;
        closeDialog 0;
    };

Just change marijuana to the item you want to use then change life_fnc_weed to what file it needs to be life_fnc_vape or what ever.

Link to comment
Share on other sites

5 hours ago, AltisLifeCoder said:

Did you add it inside "fn_useItem.sqf"


case (_item isEqualTo "marijuana"): {
        [] spawn life_fnc_weed;
        closeDialog 0;
    };

Just change marijuana to the item you want to use then change life_fnc_weed to what file it needs to be life_fnc_vape or what ever.

Made a mistake and put the variable name and not the class name.

Edited by winter
  • Like 2
Link to comment
Share on other sites

  • 1 month later...

So heres what I did with this, see if you all like.

Changed where the smoke comes out, thanks to @JedINyte

Added a song when you are smoking. Really takes it over the top.

In fn_weed.sqf


/*
	Author:AlaskaVet
*/

//Close inventory
closeDialog 0;

//Little hint then wait a litle before starting drugs effects
hint "Winners don't use drugs !";
sleep 3;

//Activate ppEffects we need
"chromAberration" ppEffectEnable true;
"radialBlur" ppEffectEnable true;
playSound "bong";
enableCamShake true;
_smoke = "SmokeShellGreen" createVehicle position player;
if (vehicle player != player) then
    {
        _smoke attachTo [vehicle player, [-0.6,-1,0]];
    }
    else
    {
        _smoke attachTo [player, [0,0,0],"Pelvis"];
    };
    
//Let's go for 45secs of effetcs
for "_i" from 0 to 44 do
{
    "chromAberration" ppEffectAdjust [random 0.25,random 0.25,true];
    "chromAberration" ppEffectCommit 1;   
    "radialBlur" ppEffectAdjust  [random 0.02,random 0.02,0.15,0.15];
    "radialBlur" ppEffectCommit 1;
    addcamShake[random 3, 1, random 3];
    sleep 1;
};

//Stop effects
"chromAberration" ppEffectAdjust [0,0,true];
"chromAberration" ppEffectCommit 5;
"radialBlur" ppEffectAdjust  [0,0,0,0];
"radialBlur" ppEffectCommit 5;
sleep 6;

//Deactivate ppEffects
"chromAberration" ppEffectEnable false;
"radialBlur" ppEffectEnable false;
resetCamShake;

The playSound "bong"; tells the next step in the next file to play the .ogg file that you put in mission\sounds 

in mission\description.ext put this at the end of class CfgSounds

class bong {
        name = "bong";
        sound[] = {"\sounds\bong.ogg",2.0, 1};
        titles[] = {};
    };

Then go to your mission\sounds and place an .ogg sound file with the right name.

I pieced the sound part together from the gas station robbery script. 

Please tell me if I am on the right track. It might have worked, but maybe there is a better way. 

Link to comment
Share on other sites

  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.