Jump to content
Sign in to follow this  
Militant1006

How to make a gradual effect with triggers

Recommended Posts

Hello all, haven't been posting for a while, I have recently started making a apocalypse type mission in a fallout riddled zone, most things I am trying to accomplish are fairly straight forward and not too hard to do, however, I have been trying to create radioactive zones via many triggers, I use 4 different geiger counter sounds to indicate getting further into the radioactive zone, as well as using film grain effects as a visual effect.

that is an example of what I have so far (includes random earthquakes)

https://rapidshare.com/files/4042113869/co08_TheZone.Chernarus.rar

that is a demo of what I have so far, including the way I got the radioactive truck to work, note that is requires ACE (If you couldn't guess by the gasmasks and AK's)

What I really need is a way in which it detects when a player enters the zone (designed to be coop) and then applies the affects to them, with a geiger sound playing local to them, and a film grain which goes up each time a new trigger is hit (or however it should be done), when the player gets close enough I need the radioactivity to slowly start depleting their health, the big catch is it also needs to gradually decrease the film grain and use the lower intensity geiger sounds.

Also any suggestions for zombies/mutants/monsters scripts or small mods would be nice, but the primary thing I need by far is getting working radioactive zones.

Share this post


Link to post
Share on other sites

I don't know if it will help Militantsausage, but MMA has something regarding fallouts. What I think you're looking for...

Scroll down to Fallouts

Might be something usable here for you...

Share this post


Link to post
Share on other sites

Not really what I am looking for, Radiation is not due to nuclear weapons being used in the background story, and there certainly aren't any nukes that need to be dropped during the mission. I have essentially a way to simulate radiation zones already, I just need to make it more multiplayer compatible and make stages within the trigger, or perhaps I might need to use different code on a object in the center of a zone or something.

Share this post


Link to post
Share on other sites

There many ways to accomplish this. However, the solutions all depend on more details. Like can the zones be rectangular or if only ellipse can they be stretched ellipses? How, much fidely do you want?.

I'm going to assume that all the zones are circles (perfect ellipses) and that they do not overlap. All of the radiation triggers could be created like this then:

ANYBODY PRESENT, + REPEATEDLY

CONDITION: player in thisList

ON ACT: 0 = [thisTrigger] call EnteredRadiationZone;

ON DEACT: 0 = [thisTrigger] call LeftRadiationZone;

Basically whenever a player enters the zone then that zone is set as the players current radiation zone. When he leaves we call the function LeftRadiationZone. To initialize you could do something like this in init.sqf or similar:

//Set up radiation
G_CurrentRadiationZone = nil;

EnteredRadiationZone = {
   G_CurrentRadiationZone = _this select 0;
};

LeftRadiationZone = {
   G_CurrentRadiationZone = nil;
};

CalculateNearNess = {
   private ["_zone", "_unit", "_radius", "_percentNear"];
   _zone = _this select 0;
   _unit = _this select 1;
   //Average axes to get radius - should be similar though for decent result.
   _radius = ((triggerArea _zone select 0) + (triggerArea _zone select 1)) / 2;
   //100% means on top of source, 0 means on edge.
   _percentNear = ((((_radius - (_zone distance _unit)) / _radius) max 0) min 1) * 100;
   _percentNear
};

//Radiation handler
[] spawn {
   private ["_nearPercent"];
   while {true} do {
       sleep random 5;

       while {alive player} do {

           //Do stuff in here

           if (!isNil "G_CurrentRadiationZone") then {
               //player is in radiation zone
               _nearPercent = [G_CurrentRadiationZone, player] call CalculateNearNess;

               //Do stuff.. Eg.:
               // _nearPercent > 25: Apply film grain
               // _nearPercent > 50: Apply more
               // _nearPercent > 75: Apply damage reduce film grain
           } else {
               //Cancel effects.
           };

          sleep 2;
       };
   };
};

Share this post


Link to post
Share on other sites

Hi there,
I know this is an old post but I'm hoping I can get a lead on the info I'm looking for. Militantsausage, I've been searching around for something you mentioned in the first post but have not been able to find any other uses of it. You said your script includes randomly generated earthquakes. How did you go about scripting that? I'm attempting something similar in Arma 3 but I'm still learning how to script and am admittedly pretty inept.

I figured it out. For those who wish to do the same, give this a shot.
I created a new file "earthquakes.sqf" and input the following

 

while {alive player} 
do
{
quakesoundarray = [playsound "Earthquake_01", playsound "Earthquake_02", playsound "Earthquake_03", playsound "Earthquake_04"];
_random = selectRandom quakesoundarray;
enableCamShake true; 
addCamShake [random 10,30,10]; 
sleep random 60;
}

and in your mission's "init.sqf" file paste the following

execVM "earthquakes.sqf";

From the mission start until the player dies an earthquake of random intensity will be generated at a random time interval between 0 and 60 seconds.
To change the interval between quakes replace the 60 in "sleep random 60" with the desired number of seconds.
The quakesoundarray portion creates an array of sounds and names it "quakesoundarray", which is randomly selected from in the next line with the selectRandom function.

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  

×