Jump to content
joew

[TUTORIAL] Speed Bomb [4.4R4 100%]

Recommended Posts

This tutorial add one terrorist item: Speed Bomb.

What it do?
- It do terrorims lol
- You plant the bomb on one vehicle.
- When the vehicle goes up 70 Km/h the bomb is activated.
- It blows up if the vehicle goes down 50 Km/h MUHUA MUHUA MUHUA (evil laughs)
- It tells you when the bomb is activated
- It tells the victim that he have a bomb and he can't goes down 50 km/h
- It tells you when the bomb explodes ;)

It can't be defused.
It kills.
It is the best for terrorism
It is the nightmare of the cops ;)

You could check it:


So let's go to the tutorial.

Author: Fuzz
Made in: 2014
AltisLife cache restore by me and changed it to run with 4.4 by me ;) and some others small changes.
Fell free to change all that you need.

 

1- FIRST STEP: Create the vItem: speedbomb

1.1) Open Config_vItems.hpp and add:

class speedbomb {
        variable = "speedbomb";
        displayName = "STR_Item_SpeedBomb";
        weight = 10;
        buyPrice = 100000;
        sellPrice = 90000;
        illegal = true;
        edible = -1;
        icon = "icons\ico_speedbomb.paa";
    };

Inside class VirtualItems and add the icon: ico_speedbomb.paa inside icons folder.


1.2) Add the item to one seller:

1.2.1) Rebel Shop:

class rebel {
        name = "STR_Shops_Rebel";
        side = "civ";
        license = "rebel";
        level[] = { "", "", -1, "" };
        items[] = { "waterBottle", "rabbit", "apple", "redgull", "tbacon", "lockpick", "pickaxe", "toolkit", "fuelFull", "peach", "boltcutter", "blastingcharge", "speedbomb" };
    };

Inside class VirtualShops


OR (could be both too, you choose)


1.2.2) Create a new one (Terrorist Shop):

class terrorist {
        name = "STR_Shops_Terrorist";
        side = "civ";
        license = "terrorist";
        level[] = { "", "", -1, "" };
        items[] = { "speedbomb" };
    };

Inside class VirtualShops and add in the stringtable.xml :

<Key ID="STR_Shops_Terrorist">
            <Original>Terrorist Shop</Original>
            <Czech>Teroristický Obchod</Czech>
            <Spanish>Tienda de Terrorista</Spanish>
            <Russian>Террорист магазин</Russian>
            <German>Selbstmord-Shop</German>
            <Italian>Negozio Terrorist</Italian>
            <French>Marché du Terrorisme</French>
            <Portuguese>Loja Terrorista</Portuguese>
            <Polish>Terrorist sklepu</Polish>
</Key>


1.3) Set up the name that will show on Y menu and shop:
Add in: stringtable.xml

<Key ID="STR_Item_SpeedBomb">
            <Original>Speed Bomb</Original>
            <Czech>Rychlost Bomb</Czech>
            <Spanish>Bomba de velocidad</Spanish>
            <Russian>Скорость бомба</Russian>
            <German>Geschwindigkeit Bombe</German>
            <French>Speed Bomb</French>
            <Italian>Velocità Bomb</Italian>
            <Portuguese>Bomba de Velocidade</Portuguese>
            <Polish>szybkość Bomb</Polish>
</Key>


2- SECOND STEP: Create the function file.

Create the file: fn_speedBomb.sqf inside core\items :

    /*
    	File: fn_speedBomb.sqf
    	Author: Fuzz
    	
    	Description:
    	Attaches a speed bomb to a vehicle.
    */
    private["_unit"];
    _unit = cursorTarget;
    
    if(!license_civ_rebel) exitWith {hint "You need Rebel Training to use it."}; // OPTIONAL - If you want license to plant the bomb.
    if((!(_unit isKindOf "LandVehicle"))&&(!(_unit getVariable ["restrained",false]))) exitWith {hint "You cannot add a speed bomb unit to this."};
    if(player distance _unit > 7) exitWith {hint "You need to be within 7 feet!"};
    if(!([false,"speedbomb",1] call life_fnc_handleInv)) exitWith {};
    closeDialog 0;
     
    life_action_inUse = true;
     
    player playMove "AinvPknlMstpSnonWnonDnon_medic_1";
    sleep 1.5;
    waitUntil {animationState player != "ainvpknlmstpsnonwnondnon_medic_1"};
     
    life_action_inUse = false;
    if(player distance _unit > 7) exitWith {titleText["You are not in range!","PLAIN"];};
     
    titleText["You have attached an armed speed bomb to this vehicle.","PLAIN"];
    //life_experience = life_experience + 25;
     
    [_unit] spawn
    {
    	_veh = _this select 0;
    	waitUntil {(speed _veh) > 70}; // 70 - Speed for activate the bomb. You can change if you want ;)
    	[[_veh, "caralarm",10],"life_fnc_playSound",true,false] spawn BIS_fnc_MP;
    	hint "A speed bomb you planted on a vehicle has just become active!";
    	{ [[2,"A speed bomb has been activated on this vehicle and will detonate when your speed drops below 50km/h!"],"life_fnc_broadcast",_x,false] spawn BIS_fnc_MP; } foreach (crew _veh);
    	waitUntil {(speed _veh) < 50}; // 50 - Speed that the bomb will explode. You change it what you want. Don't forget to change the text above too.
    	serv_killed = [player,"1090"];
    	publicVariableServer "serv_killed";
    	_test = "Bo_Mk82" createVehicle [0,0,9999];
    	_test setPos (getPos _veh);
    	_test setVelocity [100,0,0];
    	hint "A speed bomb you planted on a vehicle has DETONATED!";
    };


3 - THIRD STEP: Set the explosion sound

Add in description.ext inside class CfgSounds :

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

And add the sound file: bombarm.ogg inside sounds folder.

4 - FOURTH STEP - Add the action function to plant the bomb.

Open core\pmenu\fn_useItem.sqf and add:

case (_item isEqualTo "speedbomb"):
    {
    	[] spawn life_fnc_speedBomb;
    };

Inside: switch (true) do and above:

Quote

default {
        hint localize "STR_ISTR_NotUsable";
    };

Like as:

switch (true) do {
    case (_item in ["waterBottle","coffee","redgull"]): {
        ...
    };

    ...

    case (_item in ["apple","rabbit","salema","ornate","mackerel","tuna","mullet","catshark","turtle_soup","hen","rooster","sheep","goat","donuts","tbacon","peach"]): {
        if (!(M_CONFIG(getNumber,"VirtualItems",_item,"edible") isEqualTo -1)) then {
            if ([false,_item,1] call life_fnc_handleInv) then {
                _val = M_CONFIG(getNumber,"VirtualItems",_item,"edible");
                _sum = life_hunger + _val;
                switch (true) do {
                    case (_val < 0 && _sum < 1): {life_hunger = 5;}; //This adds the ability to set the entry edible to a negative value and decrease the hunger without death
                    case (_sum > 100): {life_hunger = 100;};
                    default {life_hunger = _sum;};
                };
            };
        };
    };

    case (_item isEqualTo "speedbomb"):
    {
    	[] spawn life_fnc_speedBomb;
    };

    default {
        hint localize "STR_ISTR_NotUsable";
    };
};

 

5 - FIFTH AND LAST STEP:

Open the file Functions.hpp and add:

class speedBomb {};

Inside: class Items like as:

class Items {
        file = "core\items";
        class blastingCharge {};
        class boltcutter {};
        class defuseKit {};
        class flashbang {};
        class jerrycanRefuel {};
        class jerryRefuel {};
        class lockpick {};
        class placestorage {};
        class spikeStrip {};
        class storageBox {};
        class speedBomb {};
    };


I think its all!

Sorry if i missed something, i'm very new, so just say that is missing something and ill look ;)

Have fun!!!

Files:
ico_speedbomb.paa
bombarm.ogg

  • Like 1

Share this post


Link to post
Share on other sites

4.4R4 ??

[[_veh, "caralarm",10],"life_fnc_playSound",true,false] spawn BIS_fnc_MP;
    	hint "A speed bomb you planted on a vehicle has just become active!";
    	{ [[2,"A speed bomb has been activated on this vehicle and will detonate when your speed drops below 50km/h!"],"life_fnc_broadcast",_x,false] spawn BIS_fnc_MP; } foreach (crew _veh);
    	
        [_veh,"carAlarm"] remoteExec ["life_fnc_say3D",RANY];
    	hint "La bombe de vitesse vien d'ètre activer !";
    	{ [2,"Une bombe de vitesse a été activée sur ce véhicule et détonera quand votre vitesse seras en dessous de 50km/h!"] remoteExec ["life_fnc_broadcast"]; } foreach (crew _veh);
    	
Edited by CapOral

Share this post


Link to post
Share on other sites
On 2017-2-17 at 2:56 PM, Hunlaik said:

How?

The icon he provided you place in the root icons folder - 

class speedbomb {
        variable = "speedbomb";
        displayName = "STR_Item_SpeedBomb";
        weight = 10;
        buyPrice = 100000;
        sellPrice = 90000;
        illegal = true;
        edible = -1;
        icon = "icons\ico_speedbomb.paa";
    };

You add this to Config_VItems.hpp and he's saying you need to add the icon to the folder that's all buddy

Share this post


Link to post
Share on other sites
On ‎18‎/‎06‎/‎2017 at 6:26 AM, TulparHAN said:

What can be done to bomb the bomb?

For example, if you drive 5 km, then the bomb is deactivated.

I didn't tested it, so I've no idea if this works or not, but you can try:

Spoiler
/*
     File: fn_speedBomb.sqf
     Author: Fuzz
     
     Description:
     Attaches a speed bomb to a vehicle.
*/
private["_unit","_distance","_oldPos","_traveledDistance"];
_unit = cursorTarget;
if(!license_civ_rebel) exitWith {hint "You need Rebel Training to use it."}; // OPTIONAL - If you want license to plant the bomb.
if((!(_unit isKindOf "LandVehicle"))&&(!(_unit getVariable ["restrained",false]))) exitWith {hint "You cannot add a speed bomb unit to this."};
if(player distance _unit > 7) exitWith {hint "You need to be within 7 feet!"};
if(!([false,"speedbomb",1] call life_fnc_handleInv)) exitWith {};
closeDialog 0;
 
life_action_inUse = true;
 
player playMove "AinvPknlMstpSnonWnonDnon_medic_1";
sleep 1.5;
waitUntil {animationState player != "ainvpknlmstpsnonwnondnon_medic_1"};
 
life_action_inUse = false;
if(player distance _unit > 7) exitWith {titleText["You are not in range!","PLAIN"];};
 
titleText["You have attached an armed speed bomb to this vehicle.","PLAIN"];
//life_experience = life_experience + 25;
 
[_unit] spawn
{
 _veh = _this select 0;
 waitUntil {(speed _veh) > 70}; // 70 - Speed for activate the bomb. You can change if you want ;)
 _distance = 0;
 _oldPos = position player;
 hint "A speed bomb you planted on a vehicle has just become active!";
 { [[2,"A speed bomb has been activated on this vehicle and will detonate when your speed drops below 50km/h!"],"life_fnc_broadcast",_x,false] spawn BIS_fnc_MP; } foreach (crew _veh);
 while {true} do {
  _traveledDistance = _oldPos distance position player;
  _distance = _distance + _traveledDistance;
  _oldPos = position player;
  if (_distance >= 5000) exitWith {
   { [[2,"You traveled more than 5KM! The bomb has been deactivated."],"life_fnc_broadcast",_x,false] spawn BIS_fnc_MP; } foreach (crew _veh);
   hint "The speed bomb you planted on a vehicle has DEACTIVATED! Its traveled more than 5KM.";
  };
 } 
 waitUntil {(speed _veh) < 50}; // 50 - Speed that the bomb will explode. You change it what you want. Don't forget to change the text above too.
 serv_killed = [player,"1090"];
 publicVariableServer "serv_killed";
 _test = "Bo_Mk82" createVehicle [0,0,9999];
 _test setPos (getPos _veh);
 _test setVelocity [100,0,0];
 hint "A speed bomb you planted on a vehicle has DETONATED!";
};

 

Share this post


Link to post
Share on other sites
23 hours ago, Deadlesszombie said:

If you read the top, it is from thr altisliferpg cache and fuzz is the author of the script

I dont believe its from fuzz

Share this post


Link to post
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

×