Jump to content
Sign in to follow this  
Muzza

M203 Flare => map marker.

Recommended Posts

Hey guys, i have another stupid question!

How do I make it so that when a certain colour of flare (eg the only red flare the player has) is fired, then the point vertically underneath the flare will become a new marker (that can be used as a spawnpoint, airstrike location....)

Share this post


Link to post
Share on other sites

You basically want 3 things to happen:

1: check if and when a flare is fire

2: identify where the flare is

3: create a marker at the flare

Now there is a event script that executes when a flare (any flare) is ignited. Unfortunately the position of the flare is not send to that script

onFlare (since version 1.45)
   Launched when illuminating shell is lit. 
   An array is passed to the script: [[r, g, b], gunner]

       r, g, b: Number - the light color 
       gunner: Object - the unit who fired the flare shell 

Unless I'm mission something, it might not be possible

Share this post


Link to post
Share on other sites

hmm shouldnt something like this show the RGB values to you? cant you use some if...then statements to determine if the values are what you want then place a marker where the player is? wont be exactly as you planned it but it will be close.

i do like the idea of using a flare as a kind of.. marker beacon tho :)

player addeventhandler ["onflare", "hint format['Red Value=%1','Green Value=%2','Blue Value=%3']"]

BTW testing it right now, will reply when i fail or succeed :)

ok so i failed... but i got the idea right.. use the eventhandler "onflare" to check if its the right color then make it mark your current position or even a few hundred meters to your facing. still noob here so dont mind me :)

Edited by H3NRY
missspelled "addeventhandler" lol

Share this post


Link to post
Share on other sites

Yea it's easy to locate the position of the player that fires the flare, but this can be up to a few hundred meters away from the flare itself.

I can manage to make a script identify if a flare is fired, but the location of the flare, I can not trace the location of the round

---------- Post added at 05:43 AM ---------- Previous post was at 05:14 AM ----------

Yes I have your solution!!!

place your player in the editor, in the init line put this.

this addEventHandler ["fired", {_this exec "onshotsfired.sqs"}]; this addmagazine "FlareRed_M203"

Then create the onshotsfired.sqs and in there put:

_ammotype = _this select 4;

? _ammotype iskindof "F_40mm_Green" OR _ammotype iskindof "F_40mm_RED" OR _ammotype iskindof "F_40mm_White" OR _ammotype iskindof "F_40mm_Yellow" : goto "flare";

hint "that was no flare";

exit;


#flare

hint format["Ammo type just fired is %1",_ammotype]; 

_flare = nearestObject [player, _ammotype];

~4

_marker = createMarker ["_Marker1", (getpos _flare)];
_markers setMarkerShape "ICON";
"_Marker1" setMarkerType "DOT";


exit

I'm sure you can work on out what you want from here on, if not just ask:)

Share this post


Link to post
Share on other sites

When i fire a bullet it tells me that was no flare, which is good.

But no matter which flare i try with this script it tells me 'that was no flare' and the script is not transported to the #flare section.

Try it for yourself with a flare, i may yet be wrong.

Share this post


Link to post
Share on other sites

I have tried repeatedly, with all of my addons off.

Whenever i fire a western FlareRed_M203 it tells me 'that was no flare'

How can i get the rpt file? ive tried looking for it.

Share this post


Link to post
Share on other sites

_ammotype = _this select 4;

? _ammotype iskindof "F_40mm_Green" OR _ammotype iskindof "F_40mm_RED" OR _ammotype iskindof "F_40mm_White" OR _ammotype iskindof "F_40mm_Yellow" : goto "flare";

hint "that was no flare";

exit;


#flare

hint format["Ammo type just fired is %1",_ammotype]; 

_flare = nearestObject [player, _ammotype];

~4

_marker = createMarker ["_Marker1", (getpos _flare)];
_markers setMarkerShape "ICON";
"_Marker1" setMarkerType "DOT";


exit

I'm sure you can work on out what you want from here on, if not just ask:)

For the life of me i cannot make this script work..

Can i ask why

_ammotype = _this select 4; ?

does "_this select 4" not mean "[1,2,3,4] exec onshotsfired?"

Sorry to keep bothering everybosy about this, bt being so close yet so far to finnishimg my mission is driving me nuts

Share this post


Link to post
Share on other sites

I'll make you an example mission, Muzza.

the

_ammotype = _this select 4

looks what kind of ammo has been fired by the unit. You see, the eventhandler sends an array with information to the script: [unit, weapon, muzzle, mode, ammo]

the 4th (actually 5th, but 'unit' is 0) is the type of ammunition fired.

---------- Post added at 02:17 PM ---------- Previous post was at 02:05 PM ----------

here's a link to an example mission.

Unrar into your \\profile\missions folder, load it up in the editor and preview

http://rapidshare.com/files/310584182/flare.utes.rar.html

If this doesn't work that something strange is going on, because it works just fine over here

Share this post


Link to post
Share on other sites

[delete this]

Edited by Muzza

Share this post


Link to post
Share on other sites

hmm... does it include a way to do more than one?

seems to only show one then once the dot is up its there for good( unless you delete is in th map).

seems it wpould be usefull to be able to shoot up a few or even have the first delete when a second one goes off

Share this post


Link to post
Share on other sites

well right now you can only shoot one and have it mark on the map, what i was htinking was if you shoot annother flare of the same color flare it replaces the marker on the map with the new one where the new flare was, if you shoot oe of annother collor ( eg green) it should place a marker on the map of that color( eg green) in addition to the original red one.

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  

×