Im trying to get position to place a marker, for smoke thrown.. I have tried and searched, still trying and searching..any help will be appreciated!![]()
Im trying to get position to place a marker, for smoke thrown.. I have tried and searched, still trying and searching..any help will be appreciated!![]()
http://forums.bistudio.com/showpost....50&postcount=3
Just use "SmokeShellGreen" instead of just "SmokeShell".
something like this using fired eventhandlers, tested.
just be aware that you should remove the eventhandler if there is a time where the player should be able to throw smokes without marker moving...Code:_idx = player addEventHandler ["Fired", { if ((_this select 5) != "SmokeShellGreen") exitWith {}; _null = (_this select 6) spawn { _pos = getPos _this; sleep 1; while {(_pos distance (getPos _this)) > 0} do { _pos = getPos _this; "myMarkerName" setMarkerPos _pos; sleep 1; }; }; }];
edit: corrected while loop, it did not end due to missing line, now it does.
Last edited by Demonized; Aug 2 2011 at 17:48. Reason: added missing line in while loop, to make loop actually end..
My scripts:
Spoiler:
what to do when posting any kind of code dammit!!
Any new mission editor or scripter in Arma2 should have read Mr Murrays Editing Guide Deluxe at least once, it still applies for A2 even though it was made for Armed Assault.
Thanks guys. Testing now..
---------- Post added at 04:21 PM ---------- Previous post was at 03:42 PM ----------
Ok, worked like a charm.. using the example Kylania pointed out. Demonized, what would be the advantage of using the eventhandler method, I'm noob, so haven't gotten into that yet. Thanks!
Code:hint "Chopper on the way"; _chopper = chopper2; _chopper setCombatMode "blue"; _chopper setBehaviour "CARELESS"; // move to player _chopper doMove (position player); _chopper flyInHeight 65; while {!unitReady _chopper} do {sleep 1}; //_chopper doMove (position player); hint "Throw smoke!"; _smokeCnt = 0; while {_smokeCnt == 0} do { _smokeArray = ((position player) nearObjects["SmokeShellGreen",50]); _smokeCnt = count _smokeArray; if (_smokeCnt > 0) then { _smoke = _smokeArray select 0; _smokePos = position _smoke; _lz = "HeliHEmpty" createVehicle (position _smoke); }; sleep 1; }; hint "Landing.. get in!"; _chopper land "GET IN";
the eventhandler grabs the EXACT grenade you threw, Kylania's grabs any green smoke grenade within 50 meters of yourself then selects the closest one.
The eventhandler is more accurate and reliable tbh.
Missions/Gamemodes - F.U.B.A.R. (WIP)
Mods/Addons - Green Sea Conflict (WIP)
Resources - ArmA 3 Notepad++ Syntax Highlighting
PC - i5 3570K | Gigabyte GTX 680 OC | 16GB DDR3
gotit. Thanks I guess in this case, the chopper pilot whouldn't know who threw the smoke... only to look for smoke. So in this case, i think I'm ok with what I have. Thanks again for the help.
Last edited by smacker909; Aug 2 2011 at 17:40.
the eventhandler just automatically runs when you use a weapon, for example what unit throws wich smoke grenade.
so you dont have to have a script "watching" the area around the player for "smokegrenades".
however there is after some thought, many different issues that arise using eventhandler wich needs to be considered or accounted for, and for a new scripter kylanias way would be the best choise for easy control.
in this case a eventhandler is probably just making the easy more difficult.
your script posted above looks like the best approach for your purpose, since you look for smoke near player so the possibility of wrong grenades would be small or insignificant.
edit: did not see last posts before posting...
Last edited by Demonized; Aug 2 2011 at 17:49.
That makes good sense Demonized. Thanks for the explanation. I'm soaking up as much as I can![]()