Jump to content

[Tutorial] Radiation Area


Fuel
 Share

Recommended Posts

Well I have used some of the tutorials found here and thought it is only fair for me to put one up for what I made the other day.

Apologies if my script is not optimised etc, one of my friends told me I write "wet" code.

Difficulty: Easy

Framework Version: 4.4r3

10 damage every 5 seconds can be set to whatever you want.

If wearing the set clothing no damage but you still get the effects.

 

Right start with the map side, in the mission editor you need to create a trigger point, the size does not matter, you can have it as big or as small as you want.

Once created you need to edit its properties so right click the trigger point and click properties. you should get this menu.

44239c2b5576e2b4be772f9bd7c64311.png

the Variable name can be anything you want, you need to set the "Trigger: Activation" and "Trigger: Expression"

Trigger: Activation

  • Type: None
  • Activation: Anybody
  • Activation Type: Present
  • Repeatable: Yes
  • Server Only: No

Trigger: Expression

Condition: 

this && (local player) && (vehicle player in thisList)

On Activation:

hint parseText format ["<t color='#0eb0ff'>You have entered a radioactive area!</t>"]; player setVariable ["exitRad",false]; player call life_fnc_radArea;

On Deactivation:

hint parseText format ["<t color='#0eb0ff'>You are leaving the radioactive area!</t>"]; player setVariable ["exitRad",true];

Click ok, save the mission and that is the map side done.

Now for the mission file.

Create a new file in Altis_Life.Altis\core\functions called fn_radArea.sqf, then copy and paste the below script inside it.

If you want to set how often damage is caused just edit the "sleep 5," to however long you want.

If you want to edit how much damage is caused edit the "_player setDamage (_damage + 0.1)" remember 0 is 100% of health 1 is dead.

To set what clothing is required to be warn edit the "if ((_uniform isEqualTo "U_B_Wetsuit") && (_vest isEqualTo "V_RebreatherB") && (_goggles isEqualTo "G_Diving")) then".

#include "..\..\script_macros.hpp"
/*
fn_radArea.sqf

Created by Fuel for RebornRoleplay.com

[UK/EU] Reborn Roleplay | RebornRoleplay.co.uk
*/

_player = [_this,0,objNull,[objNull]] call BIS_fnc_param;
_damage = getDammage _player;
_uniform = uniform _player;
_vest = vest _player;
_goggles = goggles _player;
_rad1 = ppEffectCreate ["ChromAberration",200];
_rad2 = ppEffectCreate ["DynamicBlur",500];
_rad3 = ppEffectCreate ["FilmGrain",2000];

if (!alive _player || (_damage == 1) || (_player getVariable ["exitRad",true])) exitWith {

	_player setVariable ["exitRad",true];
	_rad1 ppEffectEnable false;
	_rad1 ppEffectAdjust [0,0,true];
	_rad1 ppEffectCommit 1;
	_rad2 ppEffectEnable false;
	_rad2 ppEffectAdjust [0];
	_rad2 ppEffectCommit 1;
	_rad3 ppEffectEnable false;
	_rad3 ppEffectAdjust [0,0,0,0,0,true];
	_rad3 ppEffectCommit 1;};

// this is the check to see if they are wearing protective clothing
if ((_uniform isEqualTo "U_B_Wetsuit") && (_vest isEqualTo "V_RebreatherB") && (_goggles isEqualTo "G_Diving")) then {

//rad sound
	_player say2d "rad";

// edit this for the length of the effect
	for "_i" from 0 to 4 do {
	_rad1 ppEffectEnable true;
	_rad1 ppEffectAdjust [-0.02,0,true];
	_rad1 ppEffectCommit 1;
	_rad2 ppEffectEnable true;
	_rad2 ppEffectAdjust [0.03];
	_rad2 ppEffectCommit 1;
	_rad3 ppEffectEnable true;
	_rad3 ppEffectAdjust [0.12,1.52,3.54,2,2,true];
	_rad3 ppEffectCommit 1;
};
	sleep 5;

//loops the script until they exit
	[_player] remoteExec ["life_fnc_radArea",_player];

} else {

//rad sound
	_player say2d "rad";

// edit this for the length of the effect
	for "_i" from 0 to 4 do {
	_rad1 ppEffectEnable true;
	_rad1 ppEffectAdjust [-0.02,0,true];
	_rad1 ppEffectCommit 1;
	_rad2 ppEffectEnable true;
	_rad2 ppEffectAdjust [0.03];
	_rad2 ppEffectCommit 1;
	_rad3 ppEffectEnable true;
	_rad3 ppEffectAdjust [0.12,1.52,3.54,2,2,true];
	_rad3 ppEffectCommit 1;
};
	sleep 5;

//set the damage to player
	_player setDamage (_damage + 0.1);

//loops the script until they exit
	[_player] remoteExec ["life_fnc_radArea",_player];
};

Now open your Functions.hpp, and paste 

class radArea {};

inside of 

    class Functions    {
        file = "core\functions";

Now open cfgRemoteEcec.hpp, and paste

F(life_fnc_radArea,CLIENT)

inside of

class CfgRemoteExec {
    class Functions {
        mode = 1;
        jip = 0;

        /* Client only functions */

Now open description.ext, and paste

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

inside of

class CfgSounds {
    sounds[] = {};

Now copy the attached sound file called rad.ogg and paste it into Altis_life.Altis/sounds/

And you are done, I do not think I have missed anything.

here if a quick video of it in action.

 

rad.ogg

  • Like 8
Link to comment
Share on other sites

  • 4 weeks later...
  • 2 weeks later...
  • 2 months later...
  • 1 month later...
  • 3 weeks later...
  • 3 weeks later...

Great work! Works on 4.4r4.

If anyone is running a modded server or just wants more options with clothing allowed to enter the zone then use and edit the following to your needs.
 

if ((_uniform isEqualTo "TRYK_U_B_PCUHsW") && (_vest isEqualTo "TAC_EI_RRV211_B") && (_goggles isEqualTo "skn_s10_balaclava_white_dry") || (_goggles isEqualTo "skn_s10_balaclava_red_dry") || (_goggles isEqualTo "skn_s10_balaclava_blue_dry") || (_goggles isEqualTo "skn_s10_balaclava_yellow_dry")) then {

 

Link to comment
Share on other sites

  • 2 months later...
  • 4 weeks later...

So, just a small improvement. The way it is, if you use a First Aid Kit, its effect will be negated after 5 seconds, when the script "awakes" as it keeps your damage internally and so does not calculate your health increase after the First Aid Kit usage. To bypass this, you can simply add:

_damage = getDammage _player;

right above:

_player setDamage (_damage + 0.1);

...and you can sustain more inside the radiation area, without the suit, provided you have a number of First Aid Kits to use.

Link to comment
Share on other sites

  • 3 weeks later...

Hello,

i get this Error when i go into the area. Someone hase a idea?

22:07:17 Error in expression <2,2,true];  _rad3 ppEffectCommit 1; };  sleep 5;  _player setDamage (_damage + 0>
22:07:17   Error position: <sleep 5;  _player setDamage (_damage + 0>
22:07:17   Error Allgemeiner Fehler in Ausdruck
22:07:17 File Addons\Scripte\fn_radArea.sqf [life_fnc_radArea], line 40

My ClientLog i have upload.

Client_Log.txt

#include "..\..\script_macros.hpp"
/*
fn_radArea.sqf

Created by Fuel for RebornRoleplay.com

[UK/EU] Reborn Roleplay | RebornRoleplay.co.uk

Erklärung:
If you want to set how often damage is caused just edit the "sleep 5," to however long you want.
If you want to edit how much damage is caused edit the "_player setDamage (_damage + 0.1)" remember 0 is 100% of health 1 is dead.
To set what clothing is required to be warn edit the "if ((_uniform isEqualTo "U_B_Wetsuit") && (_vest isEqualTo "V_RebreatherB") && (_goggles isEqualTo "G_Diving")) then".
*/

_player = [_this,0,objNull,[objNull]] call BIS_fnc_param;
_damage = getDammage _player;
_uniform = uniform _player;
_vest = vest _player;
_goggles = goggles _player;
_rad1 = ppEffectCreate ["ChromAberration",200];
_rad2 = ppEffectCreate ["DynamicBlur",500];
_rad3 = ppEffectCreate ["FilmGrain",2000];

if (!alive _player || (_damage == 1) || (_player getVariable ["exitRad",true])) exitWith {

	_player setVariable ["exitRad",true];
	_rad1 ppEffectEnable false;
	_rad1 ppEffectAdjust [0,0,true];
	_rad1 ppEffectCommit 1;
	_rad2 ppEffectEnable false;
	_rad2 ppEffectAdjust [0];
	_rad2 ppEffectCommit 1;
	_rad3 ppEffectEnable false;
	_rad3 ppEffectAdjust [0,0,0,0,0,true];
	_rad3 ppEffectCommit 1;
};

// this is the check to see if they are wearing protective clothing
if ((_uniform isEqualTo "U_B_Wetsuit") && (_vest isEqualTo "V_RebreatherB") && (_goggles isEqualTo "G_Diving")) then {
	//rad sound
	_player say2d "rad";

	// edit this for the length of the effect
	for "_i" from 0 to 4 do {
		_rad1 ppEffectEnable true;
		_rad1 ppEffectAdjust [-0.02,0,true];
		_rad1 ppEffectCommit 1;
		_rad2 ppEffectEnable true;
		_rad2 ppEffectAdjust [0.03];
		_rad2 ppEffectCommit 1;
		_rad3 ppEffectEnable true;
		_rad3 ppEffectAdjust [0.12,1.52,3.54,2,2,true];
		_rad3 ppEffectCommit 1;
	};
	sleep 5;

	//loops the script until they exit
	[_player] remoteExec ["life_fnc_radArea",_player];

} else {
	//rad sound
	_player say2d "rad";

	// edit this for the length of the effect
	for "_i" from 0 to 4 do {
		_rad1 ppEffectEnable true;
		_rad1 ppEffectAdjust [-0.02,0,true];
		_rad1 ppEffectCommit 1;
		_rad2 ppEffectEnable true;
		_rad2 ppEffectAdjust [0.03];
		_rad2 ppEffectCommit 1;
		_rad3 ppEffectEnable true;
		_rad3 ppEffectAdjust [0.12,1.52,3.54,2,2,true];
		_rad3 ppEffectCommit 1;
	};
	sleep 5;

	//set the damage to player
	_damage = getDammage _player;
	_player setDamage (_damage + 0.1);

	//loops the script until they exit
	[_player] remoteExec ["life_fnc_radArea",_player];
};

 

Link to comment
Share on other sites

  • 2 months later...

Hello,

Thanks for that, it's working well on 5.0 :)

Can you tell me what to do to set some damage even if there is protection ( -50% for exemple )

At the moment it's no damage with clothing

Thanks

EDIT:  

// this is the check to see if they are wearing protective clothing
if ((_uniform isEqualTo "U_C_Scientist")) then {

     _player setDamage (_damage + 0.05);

Edited by Thierry
resolved
  • Like 1
Link to comment
Share on other sites

  • 8 months later...
  • 2 years later...
  • 5 months later...
 2:21:08 "----------------------------------------------------------------------------------------------------"
 2:21:08 "               End of Altis Life Client Init :: Total Execution Time 36.4971 seconds "
 2:21:08 "----------------------------------------------------------------------------------------------------"
 2:21:13 Suspending not allowed in this context
 2:21:13 Error in expression <4,2,2,true];
_rad3 ppEffectCommit 1;
};
sleep 2;


_player setDamage (_damage + >
 2:21:13   Error position: <sleep 2;


_player setDamage (_damage + >
 2:21:13   Error Общая ошибка в выражении
 2:21:13 File mpmissions\__CUR_MP.Altis\core\functions\fn_radArea.sqf..., line 72
 2:21:13 Sound: Error: File: mpmissions\__CUR_MP.Altis\sounds\raditation.ogg not found !!!
 2:21:13 Sound: Error: File: mpmissions\__CUR_MP.Altis\sounds\raditation.ogg not found !!!
 2:21:15 Sound: Error: File: mpmissions\__CUR_MP.Altis\sounds\raditation.ogg not found !!!
 2:21:17 Sound: Error: File: mpmissions\__CUR_MP.Altis\sounds\raditation.ogg not found !!!
 2:21:19 Sound: Error: File: mpmissions\__CUR_MP.Altis\sounds\raditation.ogg not found !!!
 2:21:22 Suspending not allowed in this context
 2:21:22 Error in expression <4,2,2,true];
_rad3 ppEffectCommit 1;
};
sleep 2;


_player setDamage (_damage + >
 2:21:22   Error position: <sleep 2;


_player setDamage (_damage + >
 2:21:22   Error Общая ошибка в выражении
 2:21:22 File mpmissions\__CUR_MP.Altis\core\functions\fn_radArea.sqf..., line 72
 2:21:22 Sound: Error: File: mpmissions\__CUR_MP.Altis\sounds\raditation.ogg not found !!!
 2:21:22 Sound: Error: File: mpmissions\__CUR_MP.Altis\sounds\raditation.ogg not found !!!

How i can fix this?

Link to comment
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.

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.

 Share

×
×
  • Create New...

Important Information

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