Jump to content
derox

Survive Radiation zone

Recommended Posts

Heey:)

Here I am aigen.

I am making that multiplayer mission now.

And i have that script that change clotes. Now i want that if you have those new clostes (hazard suits).

Then you can survive a radiation zone. for the radiation zone. I am using this script.

/* SYNTAX: [unitArray, radiationLevel, shieldedVehicleArray] execVM "radiationSource.sqf"

VARIABLES: unitArray: Array - Array of units affected by the radiation source

radiationLevel: Number - damage each units will suffer while staying nearby the radiation source

(damage is added every second, so 0.1 means the unit will lose 0.1 of health each second, 1 means

instant death)

shieldedVehicleParam: Matrix - Matrix containing a couple of values [className, damageScale] which

represents the damage reduction in percentage for the units inside the given vehicle

(for example modern tanks are shielded against radiation sources, so you can use this to reduce

the damage for units inside a vehicle).

If you are not interested in vehicle damage reduction just pass the script an empty array [].

NOTES: You should call this script from a trigger with a certain area, so you can pass the thisList array to the

script. For example a call could be

call{[thisList, 0.1, []] execVM "radiationSource.sqf"}

*/

//local function used to check how many units are alive in an array

if (isServer) then

{

_areAlive =

{

_count = 0;

{

if (alive _x) then {_count = _count + 1};

}

forEach _this;

_count

};

//initializing local variables

_unitArray = _this select 0;

_damage = _this select 1;

_vArray = _this select 2;

//number of units who activated the trigger

_currentAliveUnits = _unitArray call _areAlive;

while {_currentAliveUnits > 0} do

{

//compute and apply the damage factor for each unit in unitArray

{

_damageRed = 0;

//triggering unit is in a vehicle

if (count crew vehicle _x > 0) then

{

_v = vehicle _x;

//check if the vehicle in which the unit is mounted is radiation shielded

{

if ((_x select 0) == (typeOf _v)) then {_damageRed = _x select 1};

}

forEach _vArray;

};

_totalDamage = _damage - (_damage / 100 * _damageRed);

if (_totalDamage <= 0.001 and _x == player) then {hintSilent "."}

else

{

if (_totalDamage <= 0.01 and _x == player) then {hintSilent "."}

else

{

if (_x == player) then {hintSilent "."};

};

};

//set the current damage for the unit

if (count crew _x > 0) then

{

{_x setDamage ((damage _x) + _totalDamage)} forEach crew _x;

}

else {_x setDamage ((damage _x) + _totalDamage)};

//DEBUG

//player groupchat format["%1 health is %2", player, 1 - (damage player)];

}

forEach _unitArray;

sleep 1;

_currentAliveUnits = _unitArray call _areAlive;

};

};

So now i want that if you have that hazard suit you can just walk in those zones with out getting hurt.

would be nice if someone can help me with this:)

Share this post


Link to post
Share on other sites
Holy no code wrap...

this addEventHandler ["HandleDamage", {false}];

But then if somone shoot at you. You will not die right?

And when you change clotes then the game spawns a new unit. And that is gona by the player who activated it. So there is no init in the unit.

ps. What do you mean with Holy no code wrap...

Thx for replying

Share this post


Link to post
Share on other sites
ps. What do you mean with Holy no code wrap...

I think he meant when posting scripts and stuff to add CODE tags for easier visibility and reading.

insert code here

Share this post


Link to post
Share on other sites

Somone on skype sended me this.

if("US_Soldier_Light_EP1" == "GUE_Soldier_1") then {}; else {};

But i dont know what i have to put in that.

then {...} else {...}

Share this post


Link to post
Share on other sites

Hmmm. That if statement doesn't make much sense. it should be something along these lines:

if (player isKindOf "US_Soldier_Light_EP1") then {hint "Correct kind of unit"} else {hint "the incorrect kind of unit"}

As far as the radiation suit, idk. What addon/mod is it with?

---------- Post added at 02:21 ---------- Previous post was at 02:19 ----------

btw, use the code tags whenever you post code. Code tags can be put in by the # sign on the advanced reply ui.

Share this post


Link to post
Share on other sites

Or just use [\code][/code] (without the first \ )

If the player puts on a rad suit this could help:

if (player isKindOf "US_Soldier_Light_EP1") then
{ 
while {damage player > 0.2} do {
player setDamage 0.05;
};
};

This requires the player to be that unit though so you'll have to make sure he gets that uniform.

About the shooting part, I know the rad suit is like x10000000 times more vulnerable in STALKER but the only way I can think of here is that you give the player an EHandler UNLESS he has the rad suit. With the code above the player HAS to die with one shot or else the code is gonna kick in, setting his damage to 0.

Share this post


Link to post
Share on other sites

Hey am also looking for somthing like this for a mission am working on did you manage to make it work?

Share this post


Link to post
Share on other sites

No dident realy work on it anymore. sorry and sorry for my late reaction :S

Share this post


Link to post
Share on other sites

You can look at this thread here

It features a Gasmask feature for ACE and Radiation. I understand that you require ACE & CBA for it to work; however you can tweak the radiation script to add damage and change certain call-backs from ACE Gasmask etc to a unit classlist.

Share this post


Link to post
Share on other sites
You can look at this thread here

It features a Gasmask feature for ACE and Radiation. I understand that you require ACE & CBA for it to work; however you can tweak the radiation script to add damage and change certain call-backs from ACE Gasmask etc to a unit classlist.

YEa i know that script but i wanted the mission to be with out ace i had like hazmat units and a script like Dayz that u could change clothes from Civ clothes too Hazmat Unit. But i stoped working on it. i am working on somting els :D but thx anyway :D

Share this post


Link to post
Share on other sites

I've placed trigger, everything is ok, when i'm on foot. But in a car there is no hint when I'm in area and my transport is dying too.

How to fix it?

Sorry for my bad English.

Share this post


Link to post
Share on other sites

That would need to be added to the trigger, but clientside. But you can surely add a custom sound file to your mission and use say3D to play it.

Well I know how to do this but it only plays once, do you know how to make it loop until out of the zone?

Share this post


Link to post
Share on other sites

Well, let me put it this way:

 

In multiplayer, createTrigger broadcasts the trigger creation throughout the network, having said that I don't know whether this also counts for editor created triggers. Either way, I only know in this particular case, a rather inconvenient way of getting the same trigger statements on both server and clientside, for the client should play the sounds and the server should handle anything else regarding the units in the radiation zone.

 

But assuming, you've established that, the easiest way is to find out how many seconds the sound file plays and then put it in a "while in radiation zone" loop with a sleep of the length of the sound file. In the trigger, it should look like this (untested):

//condition:
player in thisList

//onAct:
thisTrigger setVariable ["geiger", 0 spawn {
        while {player in thisList} do {
            player say3D "GeigerSound";
            sleep 5.3; //if the sound is 5.3 seconds long
        };
}];

//onDea:
terminate thisTrigger getVariable "geiger";

That way, the say3D will be done every x seconds, when the previous play is done.

Share this post


Link to post
Share on other sites

Well, let me put it this way:

 

In multiplayer, createTrigger broadcasts the trigger creation throughout the network, having said that I don't know whether this also counts for editor created triggers. Either way, I only know in this particular case, a rather inconvenient way of getting the same trigger statements on both server and clientside, for the client should play the sounds and the server should handle anything else regarding the units in the radiation zone.

 

But assuming, you've established that, the easiest way is to find out how many seconds the sound file plays and then put it in a "while in radiation zone" loop with a sleep of the length of the sound file. In the trigger, it should look like this (untested):

//condition:
player in thisList

//onAct:
thisTrigger setVariable ["geiger", 0 spawn {
        while {player in thisList} do {
            player say3D "GeigerSound";
            sleep 5.3; //if the sound is 5.3 seconds long
        };
}];

//onDea:
terminate thisTrigger getVariable "geiger";

That way, the say3D will be done every x seconds, when the previous play is done.

Thank you, i'll try this!!

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

×