Jump to content

[TUTORIAL] Create an item that give you norecoil

Recommended Posts


I am giving you this because i'm not using it, nothing difficult.

First go to core\items

And create a file called : fn_recoil.sqf
Then paste this into it.

#include "..\..\script_macros.hpp"
    File: fn_recoil.sqf
    Author: Nirawin

    Norecoil item

[] spawn {
    life_norecoil_effect = time;
    titleText[localize "STR_ISTR_recoilEffect","PLAIN"];
    (vehicle player) setUnitRecoilCoefficient 0.1; //Here you can set the coeff of the norecoil 1 is normal recoil.
    player setCustomAimCoef 0.1; //Here you can set the coeff of the norecoil 1 is normal recoil.
    waitUntil {!alive player || ((time - life_norecoil_effect) > (10 * 60))}; //Here you can change the time the item is effective
    (vehicle player) setUnitRecoilCoefficient 1;
    player setCustomAimCoef 1;

Then go to your stringtable and add this lines :

<Key ID="STR_ISTR_recoilEffect">
	<Original>You can now shoot without recoil for x minutes</Original>
	<French>Vous pouvez maintenant tirer sans recul pendant x minutes</French>

Then go to your Functions.hpp and add this function under class Items :

class recoil {};

After this you can go to core\pmenu\fn_userItem.sqf and add this :

case (_item isEqualTo "norecoil"): {
		if ([false,_item,1] call life_fnc_handleInv) then {
			[] spawn life_fnc_norecoil;
			closeDialog 0;

To finish you have to create your item and add it to a shop or whatever you want and put the edible variable as you want but not -1.

Have a nice day !

Hope it can help !

Edited by Nirawiin
Link to post
Share on other sites

I normally spawn the function itself and write the code normally.
Ex (taken from an old script):

[_vehicle] spawn PDT_fnc_underGlow;


params ["_vehicle"];
_light = "#lightpoint" createVehicle position _vehicle;
_light setLightAmbient [0,1,0.051];
_light setLightColor [0,1,0.051];
_light setLightIntensity 100;
_light setLightAttenuation [
	0.5,                                                // start, distance with 100% intensity
	5,                                                  // constant, brightness? lower = higher
	1                                                   // linear, appears to affect the feathering of the edge.
	0.005,                                              // quadratic, appears to affect how much ambient light there is. lower = more
	0.05,                                               // hardLimitStart, max distance hard limit start (start of fading of intensity to 0) in m
	3                                                   // hardLimitEnd, max distance hard limit end (end of fading of intensity to 0) in m
_light setLightDayLight true;                           // allow the under glow effect to show during the day
_underGlowAttatched = [] call PDT_fnc_attatchUnderGlow; // called from a scheduled environment so no need to spawn it
if (_underGlowAttatched) then {
} else {

(the formatting is off, sorry)

Edited by Fawks
  • Like 2
Link to post
Share on other sites

Join the conversation

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

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.