Jump to content
Sign in to follow this  
cigar0

[TSS] Radiation Script 0.1 + performence and server question

Recommended Posts

radscan.png

 

Hi guys & girls,

 

we wrote a small script about a radiation-area and came across with some ideas and sounds that will simulate small radiation zones with a geiger counter sound.

You will find 3 zones.

 

zone 1: Big and less geiger reaction + small eyereaction (ppeffects)

zone 2: Medium reaction + medium eyereaction (ppeffects)

zone 3: high reaction + change color of the world, reaction with the eyes (ppeffects)

 

If you want to add damage, its up to you.

 

We chose a script without using triggers.

 

Examplemission: Download

 

First we wrote a function:

"function" Folder in your "Missionfolder"

Themissionname / functions / fnc_RADSi.sqf

/*
Author:
 	zinki && Cigaro

Description:
	Simulation of radioactive areas, [getMarkerPos "Radiaktiv1", 500, 400, 200]

Parameter:
	0: Position (i.e. getMarkerPos "markerName" or getPos ObjectName)
	1: Frist distance/Radius in meter
	2: Secound distance/Radius in meter
	3: Third distance/Radius in meter

Execute::
	init.sqf:
	TSS_fnc_RADS = compile preprocessFileLineNumbers "functions\fnc_RADSi.sqf";

	radio.sqf:
	_handle = [getMarkerPos "Radiaktiv1", 500, 400, 200] spawn TSS_fnc_RADS;
	_handle = [getMarkerPos "Markername", lowredarea, midradare, highradarea] spawn TSS_fnc_RADS;
*/

if (!hasInterface) exitWith {};

#define __DELAY getNumber (missionConfigFile >> "CfgSounds" >> _sound >> "delay")
#define __DISTANCE (player distance _pos)

Params ["_pos", "_dis1", "_dis2", "_dis3"];

waitUntil {sleep 20; __DISTANCE < _dis1};

while {true} do {

	if (__DISTANCE < _dis1 && {__DISTANCE > _dis2}) then {
	_sound = "RadiationLow";
 	playsound _sound;
	_ppradlow = ppEffectCreate ["dynamicBlur", 20];
	_ppradlow ppEffectEnable true;
	_ppradlow ppEffectAdjust [0.4];
	_ppradlow ppEffectCommit 2;
 	sleep __DELAY;
 	};

								if (__DISTANCE > _dis1) then {
									_ppradlow = ppEffectCreate ["dynamicBlur", 20];
									_ppradlow ppEffectEnable false;
								};

	if (__DISTANCE < _dis2 && {__DISTANCE > _dis3}) then {
	_sound = "RadiationMedium";
 	playsound _sound;
	_ppradmid = ppEffectCreate ["dynamicBlur", 21];
	_ppradmid ppEffectEnable true;
	_ppradmid ppEffectAdjust [0.9];
	_ppradmid ppEffectCommit 3;
 	sleep __DELAY;
 	};

								if (__DISTANCE > _dis2) then {
									_ppradmid = ppEffectCreate ["dynamicBlur", 21];
									_ppradmid ppEffectEnable false;
								};

 	if (__DISTANCE < _dis3) then {
 	_sound = "RadiationHigh";
 	playsound _sound;
	_ppradhigh1 = ppEffectCreate ["filmGrain", 23];
	_ppradhigh1 ppEffectEnable true;
 	_ppradhigh1 ppEffectAdjust [0.1, -5, 0.1, 0.01, 5, false];
 	_ppradhigh1 ppEffectCommit 4;

	_ppradhigh2 = ppEffectCreate ["radialBlur", 24];
	_ppradhigh2 ppEffectEnable true;
 	_ppradhigh2 ppEffectAdjust [0.01,0.01,0.15,0.15];
 	_ppradhigh2 ppEffectCommit 4;

	_ppradhigh3 = ppEffectCreate ["ColorCorrections", 25];
	_ppradhigh3 ppEffectEnable true;
 	_ppradhigh3 ppEffectAdjust [1, 1, 0, [0, 0, 0, 0.72],[5, 5, 5, -0.48],[0.2, 0.59, 0.11, 0]];
 	_ppradhigh3 ppEffectCommit 4;
 	sleep __DELAY;

	};
								if (__DISTANCE > _dis3) then {
									_ppradhigh1 = ppEffectCreate ["filmGrain", 23];
									_ppradhigh2 = ppEffectCreate ["radialBlur", 24];
									_ppradhigh3 = ppEffectCreate ["ColorCorrections", 25];
									_ppradhigh1 ppEffectEnable false;
									_ppradhigh2 ppEffectEnable false;
									_ppradhigh3 ppEffectEnable false;
								};
};

Next step:

 

init.sqf

TSS_fnc_RADS = compile preprocessFileLineNumbers "functions\fnc_RADSi.sqf";
execVM "scripts\radio.sqf";

Place a marker (empty) in the world. This marker should named (by example) like this:

"Radiaktiv1".

 

you should add a sqf file with this name:

radio.sqf (or whatever you want)

 

In this file, add this line:

_handle = [getMarkerPos "Radiaktiv1", 100, 50, 10] spawn TSS_fnc_RADS;

Radiaktive1: Name of a marker(empty) that should be a radioavtive zone

100 = big zone, 100meter, less radiation

50 = mid zone, 50 meter, medium radiation

10 = high zone, 10 meter, high radiation, high effect

 

 

Ok, everything is ready.

 

The function uses 3 sounds from the geigercountersound.

These sounds will be in the examplemission.

If you wanne change these sounds, just go ahead.

 

The example mission can be downloaded on top of this post.

 

IF this is enough for you, just play with it, use it for your missions, a small link to the real script or just a small sentence for the writer would be great.

BUT, we have a small question to everyone with good knowlege of scripting in Arma 3.

 

If someone knows how to write a function or script with a better performence, please let us know.

If also someone knows a way to start this script on a server and not on every client, we would be very happy.

 

Ok, thats it, have fun with this script

Cigar0

Share this post


Link to post
Share on other sites

If also someone knows a way to start this script on a server and not on every client, we would be very happy.

 

I don't think that makes much sense, most if not all the command used in your function have a local effect and would then be transfered from the server to the client. Better run it directly on the client.

 

One thing I noticed is, your while loop is missing a sleep which is used when none of the conditions are met.

 

Another thing you could do is work with triggers. Once a unit enters a trigger, the funciton is called and once the unit leaves the area, the function is terminated. That way you wouldn't need to run it permanently in a  loop. Just my 2cents. We chose a script without using triggers.

Share this post


Link to post
Share on other sites

what R3vo means is that u set a delay ( sleep __DELAY;) for every situation except if  player leaves _dis1.

in that case ur endless while loop is running at full speed which is always a bad idea.

Think about the delay value u could use for distances above _dis1 and use it in this block:

 if (__DISTANCE > _dis1) then 
 {  
  _ppradlow = ppEffectCreate ["dynamicBlur", 20];  
  _ppradlow ppEffectEnable false;
  sleep YOUR_DELAY; 
 };
  • Like 2

Share this post


Link to post
Share on other sites

how to add damage to player? and the sound not working

 

 

Edit*

 

i think the sample mission file is not working..

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×