Advertisement

Author Topic: radio activity effects. solved (may be... have to test it in MP)  (Read 361 times)

0 Members and 1 Guest are viewing this topic.

Offline fleepee

  • Members
  • *
  • Enter the Matrix!
I'm making a mission in which you have to get a barrel of radio active sands and load it into a LAV (called plomb).
I created a trigger with a 15 meters radius (trig_radio_activity) attached to the barrel (named radio_active) and grouped with my squad (any team member activates it), when a member of the team enters it, it launches this script:
Code: [Select]
_rad=0;

if (player in list trig_radio_activity) then {
ppEffectCreate ["colorCorrections", 1510];
"colorCorrections" ppEffectEnable true;
"colorCorrections" ppEffectAdjust[ 1, 1, 0, [-5, 0.09, 2.01, -0.09],[1.04, -0.6, -0.27, 1.05],[-5, -5, -5, 0]];
"colorCorrections" ppEffectCommit 10;

"ChromAberration" ppEffectEnable true;
"ChromAberration" ppEffectAdjust[0.1, 0.1, true];
"ChromAberration" ppEffectCommit 10;

"DynamicBlur" ppEffectEnable true;
"DynamicBlur" ppEffectAdjust[2.1];
"DynamicBlur" ppEffectCommit 10;
};

{while {_x distance radio_active <15 and alive _x} do {
_dist=_x distance radio_active;
_x setDammage (getDammage _x) + 0.01/(_dist*2);
_rad = _rad + (getdammage _x)*1000;
hintsilent format [localize "STR_RAD", name _x, round (_rad + (getdammage _x)*1000)];
sleep 0.1;
} } forEach list trig_radio_activity;

"colorCorrections" ppEffectAdjust [1, 1, 0, [0.0, 0.0, 0.0, 0.0], [1.0, 1, 1, 0.5],  [0, 0, 0, 0.0]];
"colorCorrections" ppEffectCommit 10;
"ChromAberration" ppEffectAdjust[0, 0, true];
"ChromAberration" ppEffectCommit 30;
"DynamicBlur" ppEffectAdjust[0];
"DynamicBlur" ppEffectCommit 30;

if (cesium_loaded) exitwith {};
(str_rad= "%1 recieved %2 REMS")

The barrel has and addaction to take it which launches take_cesium.sqf:
(take_cesium= radio_active addAction [localize "str_take_cesium", "take_cesium.sqf",showWindow];)

Code: [Select]
private "_caller";

_cesium = _this select 0;
_caller = _this select 1;
//_weapon= primaryWeapon _caller;
cesium_dropped=false;
publicVariable "cesium_dropped";

while {alive _caller} do {
//waituntil {_caller distance _cesium <2};
_caller playmove "AmovPknlMstpSlowWrflDnon_gear";
_cesium removeAction take_cesium;
//_caller action ["dropWeapon", _caller, _weapon];
sleep 2;
cesium_pris=true;
publicVariable "cesium_pris";
_cesium attachto [_caller, [-0.01,0.000,-0.05], "RightHandMiddle1"];
_cesium setVectorDir [5, 1, 1];
_cesium setVectorUp [0, 1, 1];

drop_cesium = _caller addAction [localize "str_drop_cesium", "drop_cesium.sqf",showWindow];
sleep 1;
if (cesium_dropped) exitWith {_cesium removeAction drop_cesium;};
if (not alive _caller) then {detach _cesium; _cesium setPos [getPos _cesium select 0, getPos _cesium select 1, 0]; _cesium setVelocity [0, 0, 0]; _caller removeAction drop_cesium;take_cesium= _cesium addAction [localize "str_take_cesium", "take_cesium.sqf",showWindow]; trig_radio_activity attachto [radio_active,[0,0,0]];};

waituntil {vehicle _caller == plomb};
_caller removeAction drop_cesium;
//_cesium removeAction take_cesium;
detach _cesium;
detach trig_radio_activity;
deletevehicle _cesium;
deletevehicle trig_radio_activity;
sleep 2;
cesium_loaded = true;
publicVariable "cesium_loaded";
if (true) exitwith {};
};

if (true) exitwith {};

drop_cesium.sqf:
Code: [Select]
private "_caller";

_cesium = radio_active;
_caller = _this select 0;

_caller removeAction drop_cesium;

_caller playmove "AmovPknlMstpSlowWrflDnon_gear";
sleep 1;

detach _cesium;
_cesium setPos [getPos _cesium select 0, getPos _cesium select 1, 0];
_cesium setVelocity [0, 0, 0];
trig_radio_activity attachto [radio_active,[0,0,0]];

cesium_dropped=true;
publicVariable "cesium_dropped";

take_cesium= _cesium addAction [localize "str_take_cesium", "take_cesium.sqf",showWindow];

In MP, I'm having the video effects but not other players if they enter the radius of radio activity. (that's what I've been said)
Video effects remain if i'm no more in the trigger's list but one member of my squad is.
if I order an AI to take the barrel of cesium, then to drop it, when I'm getting near the barrel, the damages doesn't seem to work anymore...

so:
- how can I make that video effects happens to each player and only if he gets less than 15m from the barrel?
- how can I make that they stop if the player is at a distance from the barrel greater than 15m even if a member of the squad isn't?
- I wish the damages start again each time you get near the barrel.

Thanks in advance, here's the link to the mission: http://www.ofpec.com/forum/index.php?topic=34906.0
« Last Edit: 13 May 2010, 23:41:51 by fleepee »

Offline Ironman

  • Former Staff
  • ****
    • {GSF} Home Page
Re: radio activity effects.
« Reply #1 on: 13 May 2010, 15:16:02 »
why not just add an addaction to the barrel itself?

I dont think that will solve your problem... I am just curious why you wouldn't do that?
TS3 IP: tor.zebgames.com:9992

Offline fleepee

  • Members
  • *
  • Enter the Matrix!
Re: radio activity effects.
« Reply #2 on: 13 May 2010, 15:31:28 »
Because I want the video effects and the damages to start before you select the action...

Offline Loyalguard

  • Former Staff
  • ****
Re: radio activity effects.
« Reply #3 on: 13 May 2010, 17:09:52 »
Maybe we could try getting rid of the trigger and using something else instead to simplify,  Maybe this:

Code: [Select]
while {true} do
{
_rUnits = position radio_active nearEntities ["man",15]; // Find all units within 15m of the barrel
{
if (local _x) then
{
_dist=_x distance radio_active;
_x setDammage (getDammage _x) + 0.01/(_dist*2);
_rad = _rad + (getdammage _x)*1000;
hintsilent format [localize "STR_RAD", name _x, round (_rad + (getdammage _x)*1000)];
};
sleep 0.1;
} forEach _rUnits;
sleep .01;
};

Now, I do not know much about ppEffects so I am not sure where to enter that code.  Don't you need ppEffectDestroy to end the effects?  I don't see how the visual effects stop based on the code you entered (but, as I said, I don't know much about them).

I threw in the local condition check just to make sure we only setDammage once per loop iteration (since this script will need to run on all clients and the server to work for players and AI).  It may be unnecessary so if something isn't working you may want to try to take it out.  With the above you can totally get rid of the trigger and attachTo.   I hope this helps a little.  Good luck!

EDIT:

The above should work, but on second thought, I think this is better:

Put this in the editor init line of every unit

Code: [Select]
this execVM "radiation.sqf"
Add this script to your mission:

Code: [Select]
// radiation.sqf
_unit = this; // Maybe _this select 0 (I can't remember when only passing a single object argument).

while {true} do
{
waitUntil {_unit distance radio_active < 15};
while {_unit distance radio_active < 15} do
{
_dist = _unit distance radio_active;
_unit setDammage (getDammage _unit) + 0.01/(_dist*2);
_rad = _rad + (getdammage _unit)*1000;
hintsilent format [localize "STR_RAD", name _unit, round (_rad + (getdammage _unit)*1000)];
sleep 0.1;
}; // When distance > 15 innermost while-loop will exit and wait will await until _unit is <15 again.
}; // This while-loop never ends.
« Last Edit: 13 May 2010, 18:39:02 by Loyalguard »

Offline fleepee

  • Members
  • *
  • Enter the Matrix!
Re: radio activity effects.
« Reply #4 on: 13 May 2010, 19:54:50 »
I'm trying a mix of your solution and mine, it seems to work good. :good:

I had to set "_rad=o" at the beginning of your script  and yes, put "_this select 0"
"while {not cesium_loaded}" allows script loop to end when cesium is loaded.

I'll post later the final script when video effects will be allright too! :D

EDIT:
Here is the script that seems to work:
Code: [Select]
_unit = _this select 0;
_rad=0;

while {not cesium_loaded} do
{
waitUntil {_unit distance radio_active < 15};
if (isPlayer _unit) then {
ppEffectCreate ["colorCorrections", 1510];
"colorCorrections" ppEffectEnable true;
"colorCorrections" ppEffectAdjust[ 1, 1, 0, [-5, 0.09, 2.01, -0.09],[1.04, -0.6, -0.27, 1.05],[-5, -5, -5, 0]];
"colorCorrections" ppEffectCommit 10;

"ChromAberration" ppEffectEnable true;
"ChromAberration" ppEffectAdjust[0.1, 0.1, true];
"ChromAberration" ppEffectCommit 10;

"DynamicBlur" ppEffectEnable true;
"DynamicBlur" ppEffectAdjust[2.1];
"DynamicBlur" ppEffectCommit 10;
};

while {_unit distance radio_active < 15} do
{
_dist = _unit distance radio_active;
_unit setDammage (getDammage _unit) + 0.01/(_dist*2);
_rad = _rad + (getdammage _unit)*1000;
if (isPlayer _unit) then {
hintsilent format [localize "STR_RAD", name _unit, round (_rad + (getdammage _unit)*1000)];
};
sleep 0.1;
}; // When distance > 15 innermost while-loop will exit and wait will await until _unit is <15 again.
sleep 10;
if (isPlayer _unit) then {
"colorCorrections" ppEffectAdjust [1, 1, 0, [0.0, 0.0, 0.0, 0.0], [1.0, 1, 1, 0.5],  [0, 0, 0, 0.0]];
"colorCorrections" ppEffectCommit 10;
"ChromAberration" ppEffectAdjust[0, 0, true];
"ChromAberration" ppEffectCommit 30;
"DynamicBlur" ppEffectAdjust[0];
"DynamicBlur" ppEffectCommit 30;};

if (cesium_loaded) exitwith {};
};
Thanks a lot Loyalguard! :good:
« Last Edit: 13 May 2010, 23:40:56 by fleepee »