Jump to content

bad benson

  • Content count

  • Joined

  • Last visited

  • Medals

  • Medals

Community Reputation

1660 Excellent

About bad benson

  • Rank
    Chief Warrant Officer
  1. Ambient Light Source

    fixed the transition being instant when moving in and out of the marker area too fast. note that the effects themselves are just to test the code. i know it isn't pretty i also made it only do what it needs to but i'm sure this can be optimised a lot more. i just made it work. bb_fnc_lerpnestedarray = { params ["_default", "_target", "_per"]; private _lerpedarray = []; { if (_x isEqualType []) then { _lerpedarray pushBack ([_x, _target select _forEachIndex, _per] call bb_fnc_lerpnestedarray); } else { _lerpedarray pushBack ([_x, _target select _forEachIndex, _per] call BIS_fnc_lerp) }; } foreach _default; _lerpedarray }; "filmGrain" ppEffectEnable true; "colorCorrections" ppEffectEnable true; player setVariable ["ppFX", [time, 0, false]]; ["bb_ppFX", "onEachFrame", { params ["_time", "_mkrs"]; (player getVariable "ppFX") params ["_stamp", "_oldper", "_state"]; _inarea = !(({player inArea _x} count _mkrs) isEqualTo 0); _per = if _inarea then { (_oldper + (time - _stamp)/_time) min 1 } else { (_oldper - (time - _stamp)/_time) max 0 }; player setVariable ["ppFX", [time, _per, _inarea]]; if (_inarea isEqualTo _state && {_per isEqualTo _oldper}) exitwith { //hintsilent "handled" }; //hintsilent str _per; "filmGrain" ppEffectAdjust [_per *0.5, -1, 0.1, 0.05, 2, false]; "filmGrain" ppEffectCommit 0; _targetcolors = [ 1, 1, 0, [0.77,1.25,0,0], [2.83,5,0.73,1.29], [0.33,0.33,0.33,0], [0,0,0,0,0,0,4] ]; _defaultcolors = [ 1, 1, 0, [0,0,0,0], [1,1,1,1], [0.33,0.33,0.33,0], [0,0,0,0,0,0,4] ]; _result = ([_defaultcolors, _targetcolors, _per] call bb_fnc_lerpnestedarray); "colorCorrections" ppEffectAdjust _result; "colorCorrections" ppEffectCommit 0; }, [5, ["area1", "area2"]]] call BIS_fnc_addStackedEventHandler;
  2. oh yea i didn't notice you used sleep that extensively. terminate makes a lot more sense in that case.
  3. i mean if you want it to be a loop, you could store all the code sequences in an array and then loop through them via foreach or count and inside that you would only need to put one single exitwith check...i think. so if you don't want to copy paste it between every sequence, just create the needed structure to avoid that more generally speaking. _execution = [ { params ["_units", "_args"]; ///actual stuff systemchat "sequence 1"; }, { params ["_units", "_args"]; ///actual stuff systemchat "sequence 2"; }, { params ["_units", "_args"]; ///actual stuff systemchat "sequence 3"; } ]; { if _enemyclose exitwith {systemchat "execution aborted"}; [_units, [_arg1, _arg2]] call _x } foreach _execution; this is semi pseudo code. not tested. but to illustrate what i meant.
  4. Ambient Light Source

    ok here's a basic example of lerping post process effects based on distance to a position or being inside of one or more marker areas. this function is needed for both examples bb_fnc_lerpnestedarray = { params ["_default", "_target", "_per"]; private _lerpedarray = []; { if (_x isEqualType []) then { _lerpedarray pushBack ([_x, _target select _forEachIndex, _per] call bb_fnc_lerpnestedarray); } else { _lerpedarray pushBack ([_x, _target select _forEachIndex, _per] call BIS_fnc_lerp) }; } foreach _default; _lerpedarray }; it's used to smoothly fade between the effects. to do it based on a center postion use this: "filmGrain" ppEffectEnable true; "colorCorrections" ppEffectEnable true; ["bb_ppFX", "onEachFrame", { params ["_center", "_range"]; _dist = (player distance _center) min _range; _per = 1-(_dist/_range); "filmGrain" ppEffectAdjust [_per min 0.15, -1, 0.1, 0.05, 2, false]; "filmGrain" ppEffectCommit 0; _targetcolors = [ 1, 1, 0, [0.77,1.25,0,0], [2.83,5,0.73,1.29], [0.33,0.33,0.33,0], [0,0,0,0,0,0,4] ]; _defaultcolors = [ 1, 1, 0, [0,0,0,0], [1,1,1,1], [0.33,0.33,0.33,0], [0,0,0,0,0,0,4] ]; _result = ([_defaultcolors, _targetcolors, _per] call bb_fnc_lerpnestedarray); "colorCorrections" ppEffectAdjust _result; "colorCorrections" ppEffectCommit 0; }, [getpos player, 50]] call BIS_fnc_addStackedEventHandler; the last line has the input position and the radius which is used to fade in/out the effects. _________________________________________________ alternatively one could use an array of markers and have the effect fade in/out quickly when crossing a border into one of them. "filmGrain" ppEffectEnable true; "colorCorrections" ppEffectEnable true; player setVariable ["ppFX", [time, false]]; ["bb_ppFX", "onEachFrame", { params ["_time", "_mkrs"]; _inarea = !(({player inArea _x} count _mkrs) isEqualTo 0); (player getVariable "ppFX") params ["_stamp", "_active"]; if ((_inarea && !_active) or (!_inarea && _active)) then { player setVariable ["ppFX", [time, if _active then {false} else {true} ]]; }; _per = if _active then { ((time - _stamp)/_time) min 1; } else { (1 - ((time - _stamp)/_time)) max 0; }; "filmGrain" ppEffectAdjust [_per *0.5, -1, 0.1, 0.05, 2, false]; "filmGrain" ppEffectCommit 0; _targetcolors = [ 1, 1, 0, [0.77,1.25,0,0], [2.83,5,0.73,1.29], [0.33,0.33,0.33,0], [0,0,0,0,0,0,4] ]; _defaultcolors = [ 1, 1, 0, [0,0,0,0], [1,1,1,1], [0.33,0.33,0.33,0], [0,0,0,0,0,0,4] ]; _result = ([_defaultcolors, _targetcolors, _per] call bb_fnc_lerpnestedarray); "colorCorrections" ppEffectAdjust _result; "colorCorrections" ppEffectCommit 0; }, [5, ["area1", "area2"]]] call BIS_fnc_addStackedEventHandler; here the parameters are duration of the fade transition and an array of the markers. it's a bit unsmooth when you go in and out quickly. i'll fix that later.
  5. Ambient Light Source

    @TPM_Aus i honestly think that post process effects will probably get you closer to your target picture. the lighting in arma is pretty basic so it will mostly look like a rave party in the woods with set up lights. particles help but i dunno. just imho. i love those scripted monsters you made. really cool stuff. i'll try to make a concept for a blending ppeffects based on an area. see where it goes. could be useful for other stuff like enhancing underwater effects maybe.
  6. Ambient Light Source

    @Harzach i could be wrong here but i think light points are always local objects like particle emitters no matter what command you use to create them. atleast that is how i remember it. but it was a while back i used this stuff. @TPM_Aus you should be way more specific about what exactly you need, if you are looking for concrete examples. the fog in that picture for example is location based and not around the player. it would need a rewrite, if it would be a constant effect that takes movement into account. but i'm assuming you already have the fog you need. as for the light. i simply put red and blue to 100% in the RGB array since your example picture had a lot of purple in it. one way to have the light exist for everyone would be putting that exact code in a trigger with its condition set to true (literally type the word true into the condition field) or the init line of a dummy object like an invis helipad. nothing special required. i'd be interested what you are trying to depict though (unless you need to keep it spoiler free ). because you can do some crazy stuff with post process screen effects, which you could increase moving into a certain area much like a geiger counter would work with audio. that would be a bit more trippy than lighting and stuff. or do it all at the same time. depends on what you need.
  7. Ambient Light Source

    this is just a quick test. trying to make it look a bit more dynamic than the scripts i've seen. more like dark alleyway manhole steam.
  8. note that, you could've done that with Schatten's script too. this could potentially also be faster. although formating it the way he did takes some resources too, running addXCargoGlobal only once for each type of item is less stuff to do in the second part of it all. i don't want this to get too confusing but for this purpose there is no real reason to have individual strings. maybe i'm missing something. so with his output just do {_crate addWeaponCargoGlobal _x} forEach (_stuff select 0); {_crate addMagazineCargoGlobal _x} forEach (_stuff select 1); {_crate addItemCargoGlobal _x} forEach (_stuff select 2); {_crate addBackpackCargoGlobal _x} forEach (_stuff select 3);
  9. Ambient Light Source

    i'm working on some ground fog atm. will drop something in here later. it's mind blowingly hard to make a lingering particle that doesn't sink or rise. i'm probably just being stupid but i can't get it quite right yet. close though
  10. Ambient Light Source

    _light = "#lightpoint" createVehicleLocal getpos player; _light setLightBrightness 1.0; _light setLightAmbient [1, 0, 1]; _light setLightColor [1, 0, 1]; _light setLightDayLight true; _light setLightUseFlare false; _light setLightFlareSize 5; _light setLightFlareMaxDistance 500; _light setLightAttenuation [2,4,4,0,9,10]; as you can see the flare is disabled. that is the actual light point visualised. if you want that you can enable it and play with the related parameters. i tried to add all related commands that i could find (might've missed some...check wiki for cross links). you could also try adding some particles to make it more of a haze than just basically coloring the surroundings. EDIT: for tweaking i would suggest making the _light variable global (like TPM_light). then you can run everythign except for the first line over and over with some tweaks until you hit the sweet spot.
  11. Ambient Light Source

    what does your code look like at the moment? would be great to have something to work with.
  12. what are the other two?! genuinely curious. @HorribleGoat i hope there are some jetpacks planned or something similar. these giant complex strucutres scream for some tribes-like airborne gunfights.
  13. @Undeceived yes. that's what the filtering is all about. _objs = (nearestObjects [_trigger, ["All"], selectMax ((triggerArea _trigger) select [0, 2])]) select {_x inArea _trigger}; i thought you wanted everything so i used "All". you should first try using the array that Schatten used in his function. like this _objs = (nearestObjects [_trigger, ["WeaponHolder", "WeaponHolderSimulated"], selectMax ((triggerArea _trigger) select [0, 2])]) select {_x inArea _trigger}; pretty sure that will give you all fo it. if not try some of the above mentioned classes. i think though that these two are the main parent classes, so it should work.
  14. @Undeceived you need to use the right input array. i didn't read the whole function by Schatten but he uses nearestObjects using the trigger properties to get the right input. so it'll probably work better for what you are searching for, if my stuff confuses you. of course you could just modify my version like this (just for completeness' sake) _objs = (nearestObjects [_trigger, ["All"], selectMax ((triggerArea _trigger) select [0, 2])]) select {_x inArea _trigger}; //taken from Schatten's code but his function also gives you an amount for each item while mine just uses doubles (class string for each individual item) which you probably want. so depends on what you need really. just to add something i have noticed debugging, in case someone else finds the useful. these are the classes i found in the config that have the word weaponholder in them. so if you are still not catching any of the ones you want with any of this code you might wanna try these classes for the filter. "GroundWeaponHolder", "GroundWeaponHolder_Scripted", "Library_WeaponHolder", "WeaponHolder", "WeaponHolder_Single_F", "WeaponHolder_Single_limited_item_F", "WeaponHolder_Single_limited_magazine_F", "WeaponHolder_Single_limited_weapon_F", "WeaponHolderSimulated", "WeaponHolderSimulated_Scripted" didn't have time to find out what those are used for. and several of those are probably parent classes. maybe someone knows more. might be used by Eden when you place a single item maybe.
  15. in the meantime you can try this _stuff = [[],[],[],[]]; _objs = vehicles; _objs inAreaArray _trigger apply { (_stuff select 0) append (weaponCargo _x); (_stuff select 1) append (magazineCargo _x); (_stuff select 2) append (itemCargo _x); (_stuff select 2) append (backpackCargo _x); }; _stuff will contain the output. i used "vehicles". if you are using a trigger that will be activated to get the items you could also use the "thisList" variable inside the onActivation line of the trigger to get every object insdie the trigger area instead of checking all present vehicles in the mission. you could also filter that by class. some examples //to only check certain classes based on parent class do: _objs = vehicles select {_x isKindOf "Car"}; //or explicit classes: _objs = vehicles select {typeOf _x in ["GroundWeaponholder", "GroundWeaponholder_Scripted", "WeaponHolder_Simulated"]}; //or by string search _objs = vehicles select {toLower (typeOf _x) find "weaponholder" > -1}; that's just some quick and dirty examples though. not tested ingame.