OFPEC Forum
Addons & Mods Depot => OFP - Addons & Mods General => Topic started by: remcen on 13 Aug 2005, 20:51:36
-
as some of you might know i am involved in a mod focusing on the iraqi army and this is what i imagine could be their way of night vision (although i know they had a few chinese-made NVGs):
throwable flares, if possible with some smoke.
first i tried a simple smokeshell and added a lightcolor[]= etc. line. result: no light.
then i tried a throwable flare and added the class smoke etc. part from the smokeshell. the flare was throwable, but there neither was smoke nor did the flare keep burning when it hit the ground.
as our resident config wizard tomislav is unavailable due to homeland security reasons (compulsory military service in germany ;) ) i pose the question to you out there:
how is it possible to make a throwable flare which smokes and keeps burning when it hits the ground? - at best through config-editing due to performance reasons.
in fact i can imagine some ways to detect someone having thrown a flareand then launch a smoke script, etc, or simply setpos'ing a non-material glow object to the pos where a smokeshell landed, but i'd like to avoid scripting as i said - cos it never works as smoothly as config-editing.
ok, here's my latest attempt:
cfgammo
...
class flare: grenade {};
class imuc_flaregrenade : flare
{
cost=100;
simulation=shotIlluminating;
simulationStep=0.05;
explosive = false;
lightColor[] = {1, 1, 1, 0};
soundHit[]={,0,1};
class Smoke
{
interval = 0.01;
// single cloudlet parameters
cloudletDuration = 4.0; // time to live (not including fades)
cloudletAnimPeriod = 1.0; // animation speed
cloudletSize = 0.25;
cloudletAlpha = 1.0;
cloudletGrowUp = 1.5; // grow-up time
cloudletFadeIn = 0.0; // fade-in time
cloudletFadeOut = 5.0; // fade-out time
cloudletAccY = -0.3; // vertical acceleration
cloudletMinYSpeed = 0; // vertical speed range
cloudletMaxYSpeed = 10;
cloudletShape = "cl_basic";
cloudletColor[] = {1, 1, 1, 0};
initT = 1000;
deltaT = -500;
class Table
{
class T1 {maxT = 0; color[] = {0.7, 0.7, 0.7, 1};}
class T2 {maxT = 1000; color[] = {0.4, 0.4, 0.4, 1};}
};
// source parameters
density = 1.0;
size = 1.5;
initYSpeed = 1.0;
timeToLive = 1e20; // time to live (not including fades)
in = 3.0; // fade-in time
out = 0.0; // fade-out time
};
};
etc.
cfgweapons:
...
class grenadelauncher: default {};
class handgrenade: GrenadeLauncher {};
class SmokeShell: HandGrenade {};
class imuc_flaregrenade: smokeshell
{
//--
valueMagazine = 2;
ammo=imuc_flaregrenade;
displayName="illumination grenade";
displayNameMagazine="illumination grenade";
shortNameMagazine="illum grenade";
};
etc.
-
ZIG had made a GlowStick,when it is thow away, it will be ignite!
See the attach addon! ;D
-
thanks a lot. at least i have now a more exact idea of how a scripted version would look like. will try that definetely :D
what about a config-edited version? smoke and glow obviously don't mix, right? :-\
-
that may not be possible,cause you've tried it. ::)
I think the only way is to make a smoke shell (light smoke) and get the "fired" event and add "drop" command to it. Aren't smoke shells always on the ground? ;)
-
I'm not familiar with flares but I know that the only way to get throwables to stay on the ground is to base them off of a smoke shell, and THEN configure their different properties, and do the rest through scripting.
-
The only problem with using a smokeshell is that the AI wont use it in open combat unless scripted to. I dont think you can avoid scripting here.
Your best bet would be to create 2 new weapons in a config, one would be the dummy flare, modelled as a handgrenade. Add a fired EH to the unit in the config and when the dummy flare hits the ground, substitute it with a new weapon that glows (like zig's lightstick things) PLUS a smoke shell.
Could eb quite laggy tho but I dont know from experience any other way it would work. You could try adding smoke and a light object to the same weapons again but I doubt it'd work.
Alternativly you could use the drop command for te light effect and when fired, just fire a smokeshell and attach a drop particle to it (possibly by a looped script) something like this ...
; script requires the fired EH to activate it
_unit = _this select 0
_ammo = _this select 4
_missile = nearestobject [_unit,_ammo]
_timer=0
_endtimer=400
#loop
_pos = (getpos _missile)
_vel = (velocity _missile)
@ true
drop ["koulesvetlo", "", "Billboard", 1,2, [0,0,0], _vel, 0, 1.275, 1, 0, [5,6,5],[[1,1,1,1],[1,1,1,1]],[0],0,0,"","",_missile]
? _timer > _endtimer : exit
goto "loop"
I'm not to sure about the "koulesvetlo" model, it's something I got off an old tracer script I made. The glow may be longer or shorter than the smokeshell lasts. To fix this, fiddle with the _endtimer figure.
Hope this helps
-
The only problem with using a smokeshell is that the AI wont use it in open combat unless scripted to.
Partly, yes.
You can however fool the AI thinking it throws something else than a smokeshell...
You config a handgrenade dummy which the AI uses when throwing your smokeshell based object.
The handgrenade dummy is removed at the moment it's thrown and replaced with the smokeshell based object leaving the AI still 'think' it has thrown a regular nade..
You can use other 'dummy weapons' as well with this...
You could actually make your glowing flare as a fireplace, define it to have a little smoke, the light and use that above method to throw it...
Wouldn't take many lines of scripting and would not lag at all (at least not the script)..
-
yes, this was the solution I was going to offer. I have recently made a petrol bomb addon that uses this basic principle, although it uses slightly fancier scripting on impact to simulate a good fire effect.
Look @ ZIG's glowstick addon for a good idea on how this is done
Use a 'fired' evenhandler to run the switching script and remember to give the dummy handgrenade and the real smokeshell (that will be our flare) have the same model, so the switch looks realistic.
even if you can't get the smokeshell to glow, try this technique ...
- as part of your 'fired' EH add a script that adds a 'glowing drop' using the drop command when you want the flare to ignite
- Define the smoke of the smokeshell to be invisible, i.e. give it a 4th colour figure of 0 ( {0,0,0,0} ) so that the clouds of smoke become invisible
This way when the smokeshell lands you get a glow, not smoke. Maybe ZIG's glowsticks will give you a hint with the drop he used.
If you need more help here, please say and i'll try n write a few example scripts and configs.
-
Using a fireplace would be better, you would not need to use drop[]..
= no looping script..
Fireplace can be defined to not smoke (afaik)...
But that's just a question of preference I guess :)
-
Having little experience in all this 'addon' malarky, I would be inclinde just to agree with you. All I'm sayin is I've done it my way and it works.
You seem to be talking theoretically.
-
Not completely theorically but haven't tested the fireplace idea with this though...
It might be that the fireplace is one of those objects that can't have it's velocity set...
There are a few in OFP that act like that...
which the fireplace then probably is :P
MCAR uses fireplaces as countermeasure flares on planes etc, just can't remember right now whether they were setPossed or setVelocitied... :(
If the fireplace would need to be setpossed then drop[] would be a better solution..
Although you could create the fireplace one on the ground once the flare has 'landed' :)
-
Theres some smoke/flare rockets in the BAS OH-58 pack, with a very nice night effect to them.. might be worth looking into..
-Tetrian
-
thanks for the input guys :)
the way i've done it is like hater_kint suggested - loosely based on Zig's glowstick addon. i cannibalized his script - with his permission of course ;)
the flare itself is a smokeshell with reduced smoke. when a unit with a fire-eventhandler - triggered script fires this smokeshell a empty fireplace which i already used for othe stuff, is setpos'ed at the position of the smokeshell. of course AI would never fire this "flare" itself unless it's scripted, but it wouldn't do so with a standard BIS flare or smokeshell either.
my solution now is that the glow is added a few seconds after the shell is thrown so that it's already alight when it flies through the air which looks really cool.
AI wouldn't fire these flares - this could be fixed by coding it as handgrenade like paddy suggested... but i doubt that it makes sense that AI throws these flares at enemies, doesn't it? is that really sensible? i mean, AI throws the first dummy grenade... enemy not hurt... AI throws the second dummy grenade... enemy not hurt ... etc.
well. i think i'll stick to the solution as it's now - with all its restrictions :/