Jump to content
Sign in to follow this  
natanbrody

TearGas Script Help

Recommended Posts

guys I have made a script that has the effect of a teargas grenade but I don't know how to make it affect everyone who doesn't have combat goggles (Classname - G_Combat)

Here is the script so far

While{true} do {

"dynamicBlur" ppEffectEnable true; // enables ppeffect

"dynamicBlur" ppEffectAdjust [0]; // enables normal vision

"dynamicBlur" ppEffectCommit 15; // time it takes to normal

resetCamShake; // resets the shake

20 fadeSound 1; //fades the sound back to normal

waituntil{

((nearestObject [getpos player, "SmokeShellRed"]) distance player < 10)

and

(getpos (nearestObject [getpos player, "SmokeShellRed"]) select 2 < 0.5)

};

"dynamicBlur" ppEffectEnable true; // enables ppeffect

"dynamicBlur" ppEffectAdjust [20]; // intensity of blur

"dynamicBlur" ppEffectCommit 3; // time till vision is fully blurred

enableCamShake true; // enables camera shake

addCamShake [10, 45, 10]; // sets shakevalues

player setFatigue 1; // sets the fatigue to 100%

5 fadeSound 0.1; // fades the sound to 10% in 5 seconds

sleep 5;

};

Share this post


Link to post
Share on other sites

This sounds cool.

Question: Would using player in a script only apply to player, or does unit or man have to be used to apply to all?

Share this post


Link to post
Share on other sites

I'm not very advanced with MP scripting, but all you should need is to add:

waitUntil {!isNull player};

on top of your script, then your code should be executed on every player

Share this post


Link to post
Share on other sites

Have you got it to work otherwise? I remember reading a comment on the wiki saying that nearestObjects doesn't work with grenades, and that you should use nearObjects instead. Here's the comment:

If you want to detect nearby grenades for the position of a unit, for example, using 'nearestObjects' won't work. You have to use 'nearObjects' instead.

count( nearestObjects [_unit, ["GrenadeHand"], 30]) // WON'T WORK

Won't ever return anything but 0.

count (_unit nearObjects ["GrenadeHand", 30]) // WORKS!

Will work.

I guess it works now, or the reason why the above didn't work was using count? Edit: Oh, of course you're using nearestObject (not nearestObjects), since you're checking for distance, that might explain.

Edited by Magirot

Share this post


Link to post
Share on other sites

The blurring stuff is a local effect, so you will need to run it on each client

Once the script is running at the client level, player will only refer to that individual player. IE, the unit they are playing as. It is a special keyword, so you can use it.

To run the script on each client use BIS_fnc_MP;

[params, functionName, target, isPersistent] spawn BIS_fnc_MP;

I am not sure how your script works, but I am assuming you might want to pass in the teargas's position. Don't want to affect players on the other side of the map after all

[_tearGasPos, "APPLY_TEARGAS_EFFECTS", true, false] spawn BIS_fnc_MP;

Before this is called, every client needs to know about your APPLY_TEARGAS_EFFECTS function.

True indicates to run on every client on the server, including the server, so you might want to have an if(isserver) exitwith{}; as the host doesn't need to be blinded.

False indicates that this doesn't need to be run on jip clients when they join the server.

Edited by brians200

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  

×