Jump to content
Sign in to follow this  
super-truite

flashbang and obstacles

Recommended Posts

I am trying to make a little flashbang script. I got the inspiration for this from this video

and the list of postprocesses you can play with: http://community.bistudio.com/wiki/ppEffectCreatehttp://. What I do is check if a chemlight (or whatever object till someone nice makes me a flashbang 3D model :) ) is near a player, if so, I activate a postprocess effect ("colorCorrections") which blind this player for a while. I play a flashbang explosion sound at the same time. The major issue I need to solve is that with this method, the player is blinded even though the flashbang is not in its line of sight (for instance if there is a wall between the player and the nade).

Is there a function which allows to check if the line of sight between 2 object is clear?

Bonus question: If someone knows a way to create a harmless explosion at a location, it could be usefull too.

Edited by super-truite

Share this post


Link to post
Share on other sites

There are two commands that you need to use to check LOS.:

http://community.bistudio.com/wiki/terrainIntersect

http://community.bistudio.com/wiki/lineIntersects

That should do the trick.

For explosions you can use particle effects.

ps.: For more precision, dont use the regular position of the soldier for the checks above.

Instead create an invisible dummy-object, use "attachTo" to attach that object to a Memorypoint in the head of the soldier (the mempoint named "pilot" should work nicely) and use that position for your LOS check.

Share this post


Link to post
Share on other sites

thanks, I'll look at all this.

@Phantom six, not yet, but this is really easy to implement I guess. I plan to do it when this issue is solved

Share this post


Link to post
Share on other sites
thanks, I'll look at all this.

@Phantom six, not yet, but this is really easy to implement I guess. I plan to do it when this issue is solved

Great, this will be nice for a SWAT style mission :P . You're going to release it when ready?

Share this post


Link to post
Share on other sites

Ok, lineintersects did the job, thanks again. I have difficulties to implement particle effects though. There is this page: http://community.bistudio.com/wiki/ParticleArray and particle templates here : http://community.bistudio.com/wiki/ParticleTemplates, but unless I try all the possible combinations (...) it will be hard without a template doing more or less what I want. A simpler way would be to use the grenade explosion, but I don't know how to use it without creating a grenade (and this would do damages, which I don't want). Any thoughts on that?

@Phantom, I'll put the script in this thread when it is finished and when I will be not too ashamed of it :) (I am new at scripting).

Share this post


Link to post
Share on other sites

Hi super-truite.

When you need help with a 3d Model, i can help you out. This is a little thing which can be done in 1 or 2 hours. Let me know.

Share this post


Link to post
Share on other sites

Hi baraka, it would be really nice of you to do it! But I never made an addon. I'll told you when I'll know how to use the 3d model.

Share this post


Link to post
Share on other sites

It is getting complicated with the particle effects. But I've found where the particles files are which means I am making progress I guess:

You need to unpbo the data_f.pbo in your Arma3/addons directory, and here they are: data_f\a3\data_f\ParticleEffects.

In the example from http://community.bistudio.com/wiki/ParticleArray, you can replace the FLY.p3d file path by any of the paths fore .p3d files in the latter directory.

Playing with those files led me to two questions:

1) In game we see some flies sometimes, yet it seems there is no .p3d corresponding to it. Does it mean that there are not generated with this kind of particle effects like in arma? And if so what is the other method to create "particles"

2) Is there a way to make the particle really "bright", like something burning? You need to fill some arguments in the particlearray, but it seems there is none for brightness.

I repeat also a previous question: is it possible to use the grenade explosion without injuring players? A way would be to make players invincible during the time the grenade is exploding, but I don't like this solution. Isn't there a way to spawn just the visual effect of the explosion?

edit: In fact I figured out how to make the particles brighter: you can create a light source at the spot where the flashbang land using https://community.bistudio.com/wiki/lightAttachObject.

There is something I don't like though: The light source is not affected by obstacles, which is quite annoying. Is it an alpha bug or was it working this way in arma/arma 2 too?

Edited by super-truite

Share this post


Link to post
Share on other sites

Here is a draft of the script: http://www.sendspace.com/file/5y12sdhttp://. It's not perfect but it does the job.

I give an example mission because there are 2 scripts and 2 sounds files. It works only for human players. For AI, what I do is exactly the same thing as for humans, but instead of applying postprocesses effects when the flashbang is near the AI (which would be useless),

I play an animation and use _AI disableAI "target; _AI disableAI "autotarget"; to make them "blind" for a few seconds. I have an issue though:

The first question I had, was how to check if there is an obstacle between the target and the flashbang. For human players, as suggested by Tajin and like in the zooloo75 mission, I check if the LOS is clear between the player and the flashbang using lineintersects:

_posplayer = eyepos player; //position of the player eyes
_posflash = getposASL _flash; //_flash is defined before and is the nearest chemlight
if (lineIntersects [_posplayer, _posflash]) 
then {...} else{...};

For some reason, for the AI, this does not work (just replacing player by an AI unit). eyepos seems to work weirdly with AI.

To debug this I tried for instance to spawn a barrel on the position "eyepos _AIunit", and it spawns at some random location around it???

Any thoughts on how to solve this issue?

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  

×