Muzza 0 Posted November 18, 2009 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
Toasted Duckie 0 Posted November 19, 2009 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
H3NRY 10 Posted November 19, 2009 (edited) 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 November 19, 2009 by H3NRY missspelled "addeventhandler" lol Share this post Link to post Share on other sites
Toasted Duckie 0 Posted November 19, 2009 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
Muzza 0 Posted November 19, 2009 thanks x10^8! I'l try what i want now! Share this post Link to post Share on other sites
Muzza 0 Posted November 19, 2009 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
Toasted Duckie 0 Posted November 20, 2009 I've tried with a flare, and it works, keep in mind that I've put in the WEST flare ammo types only Share this post Link to post Share on other sites
Muzza 0 Posted November 21, 2009 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
Muzza 0 Posted November 22, 2009 _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
Toasted Duckie 0 Posted November 22, 2009 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
Muzza 0 Posted November 22, 2009 (edited) [delete this] Edited November 22, 2009 by Muzza Share this post Link to post Share on other sites
H3NRY 10 Posted November 22, 2009 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
Toasted Duckie 0 Posted November 22, 2009 Henry it's very much possible, can you explain the desired effect a bit more detailed? Then I'll make another example. Thanks Share this post Link to post Share on other sites
H3NRY 10 Posted November 23, 2009 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
Muzza 0 Posted November 23, 2009 Everything works now! Thanks so much guys! Share this post Link to post Share on other sites