Jump to content
Sign in to follow this  
Scanger

Flashbang (work in progress)

Recommended Posts

back again with another update...i found a way to track the fired object,i.e. grenade/flashbang, this will give the impact time and position. i will give this script but bear in mind it still has bugs that hopefully someone can iron out

This is the eventhandler for your unit equipped with flashbang

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class eventhandlers

{

fired ="[_this select 0, _this select 1, _this select 4] exec ""\JMG_Flashbang\Scripts\test.sqs""";

};

test.sqs

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">;==================================================

;Ammo tracker and Flashbang script by Scanger

;==================================================

_player       = _this Select 0

_weapon       = _this Select 1

_ammoType     = _this Select 2

;==================================================

;Intercepts fired object

;==================================================

_ammo = NearestObject [_player,_ammoType]

;==================================================

;WEAPON & AMMO CHECK

;==================================================

?!((_weapon == "JMG_Flashbang") && (_ammoType == "JMG_Flashbang")): exit

;==================================================

;Ammo Position tracker

;==================================================

#TrackAmmo

_PosAmmo = getpos _ammo

_player groupChat "TrackAmmo"

~.1

?(alive _ammo):goto "TrackAmmo"

_player groupChat "Boom!"

;==================================================

;Creates dummy vehicle then places at impact point

;==================================================

_position = "Logic" createVehicle [0,0,0]

_position setPos _PosAmmo

;==================================================

;Checks players position relative to dummy vehicle

;Decides level of blindnesss inflicted by flashbang

;==================================================

?(player distance _position < 20): titletext ["", "WHITE IN", 15]

?((player distance _position > 20) && (player distance _position < 40)): titletext ["", "WHITE IN", 10]

?((player distance _position > 40) && (player distance _position < 60)): titletext ["", "WHITE IN", 4]

?((player distance _position > 60) && (player distance _position < 100)): titletext ["", "WHITE IN", 0.3]

~1

;==================================================

;Tells the player his distance from impact point

;==================================================

_far = player distance _position

_player groupChat Format["Distance from impact %1",_far]

exit

known bugs:

You do NOT have to be staring at flashbang to get blinded..it goes by distance from flashbang(any help on fixing appreciated)

I haven't yet added any disorientation feature but it will happen. currently it'll only work on HUMAN players since they can see, AI won't be affected in this release.

currently using grenade model and smokeshell pics, will make new ones later today

it's not perfect but it's a start...especially the tracking ammo bit, i've left my chat sections in script so u can see when things happen

edit: fixed distance issue(needed Logic dummy vehicle)

TO SAVE PEOPLE TIME RECOMPILING THIS SCRIPT HERE'S A LINK TO MY TEST

JMG_Flashbang.pbo

Unit is under west>men>JMG Soldier(Flashbang)

Share this post


Link to post
Share on other sites

i've run into a major snag

ANY custom grenade i make or download doesn't work in multiplayer, but has no problems in single player.

it appears on the gear page but cannot be switched to ingame

so the flashbang script is on hold until i figure this out cos only in MP will the flashbang be most effective.

any ideas? crazy_o.gif

and if anyone has a link to a custom grenade that works in multiplayer that'd be great, then maybe i can find where the problem is.

Scanger

Share this post


Link to post
Share on other sites

MP issues with custom grenades has been a problem for a long time. The only workaround that I was able to come up with was remove all weapons and mags at the start of the MP mission and then using a script to rearm the unit.

re scripts: feel free to take a look at the flashbang scripts I did for the Delta Force addon. Note: This is a really old addon so the script and units are a bit basic (eg no EH's).

Delta Force 2 download link

This worked to a limited extent on AI.

Other references you can look at.

JAM2 - scripts for detecting a thrown grenade

BAS Blackhawks - Dust script has a unit orientation detection script by TJ (ie dust affects player when they are facing the helicopter)

SelectThis

Share this post


Link to post
Share on other sites

Thanks a lot SelectThis, i'll definitely give those a good look, I'm no master when it comes to scripting so any reference I can study is a God send :D

hardest part for the flashbang is the orientation alright so you won't get blinded when facing away from it, so hopefully I'll find the answer in there.

Scanger

BTW: i did find a workaround, if you run a custom startup...eg -mod=??? and edit cfgWeapons.hpp in the Bin folder of that and add your magazines into the "throw" weapon class then they'll work in multiplayer, thing is I'd assume all players on server must have the same change made to stop errors.

EDIT..i checked the BAS blackhawks dust in eyes thing...unfortunately it goes by distance from chopper again rather than orientation

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">@ player distance _mh60 < 25 && player distance _mh60 >7 && player animationphase "goggles" == 0 && ! (player in _mh60) && (getpos _mh60 select 2) <10 && vehicle player == player && (alive player)

but i got an idea of a way of implementing it by:

getting the players distance & direction relative to impact point

then rotating the dummy towards the player

then making a 180 degree flashzone and clearzone

flashzone/distance would give the amount of blindness/disorientation to inflict on player

clearzone/distance would still be flashed but to a lesser extent and without the disorientation unless within 10 ft or so

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  

×