joejoe87577 10 Posted December 22, 2013 Hello everyone, I've been looking around for a script that tells me where a popup target has been hit. Just like in this mission from ArmA 1: Link to armaholic I couldn't extract the pbo file with elitness or cpbo (I couldn't get it running on my system). It would help a lot if anyone could extract the file and post it right here. I've already made contact with the mission author, but he has not written any scripts for a long time, so he could not help me with that. Kind regards, Joejoe Share this post Link to post Share on other sites
djporternz 26 Posted December 22, 2013 (edited) [NOTE: I don't have ArmA1 so can't check how the mission above represents the hit markers, but I'll jump in anyway!] I knew I had a script that I used to do something similar during alpha/beta, but had to find it and then check that it still worked. I've checked this on the current dev build only, so YMMV. To test simply create two targets in the editor. Name one anything you like and add the init: This addEventHandler ["HitPart", "_this execVM 'Scripts\Range\Accuracy.sqf'"]; (Check the path on that init and change as needed.) The second target is named 'pt1_0'. No init needed. You can 'this allowDamage false;' if you have to ;-) create the marker: Empty > Objects (Helpers) > Sphere (10cm) and name it 'Hit_Ind'. It can be placed anywhere on the map as it's position is what is updated. You'll already have placed down someone to shoot at the target, right?! Copy and save the code below to a file: Accuracy.sqf Save and preview in the editor. // Accuracy Marker using "HitPart" Event Handler //NOTE: Known to be have been buggy in dedicated MP (late 2012). Current status unknown. // //Add this init to target shot at //Init: This addEventHandler ["HitPart", "_this execVM 'Scripts\Range\Accuracy.sqf'"]; // // Returned from "HitPart" EH: TYPE ARRAY [[target, shooter, bullet, position, velocity, selection, ammo, direction, radius, surface, direct]] //target: Object - Object that got injured/damaged. //shooter: Object - Unit that inflicted the damage. If injured by a vehicle impact or a fall the target itself is returned, or, in case of explosions, the null object. In case of explosives that were planted by someone (e.g. satchel charges), that unit is returned. //bullet: Object - Object that was fired. //position: Position3D - Position the bullet impacted (ASL). //velocity: Vector3D - 3D speed at which bullet impacted. //selection: Array - Array of Strings with named selection of the object that were hit. //ammo: Array - Ammo info: [hit value, indirect hit value, indirect hit range, explosive damage, ammo class name] OR, if there is no shot object: [impulse value on object collided with,0,0,0] //direction: Vector3D - vector that is orthogonal (perpendicular) to the surface struck. For example, if a wall was hit, vector would be pointing out of the wall at a 90 degree angle. //radius: Number - Radius (size) of component hit. //surface: String - Surface type struck. //direct: Boolean - true if object was directly hit, false if it was hit by indirect/splash damage. private ["_array", "_unit", "_shooter", "_bullet", "_position", "_velocity", "_selection", "_ammo", "_direction", "_radius", "_surface", "_direct", "_PositionASL", "_PosASL_1", "_PosASL_2", "_PosASL_3", "_Position_1", "_Position_2", "_Position_3", "_A", "_B", "_C", "_PosASL_PT1_0", "_PosASL_PT1_0_X", "_PosASL_PT1_0_Y", "_PosASL_PT1_0_Z", "_D", "_E", "_F", "_G", "_H", "_I", "_PosASL_PT1_99", "_PosASL_PT1_99_X", "_PosASL_PT1_99_Y", "_PosASL_PT1_99_Z", "_J", "_K", "_L"]; _array = _this Select 0; _unit = _array Select 0; _shooter = _array Select 1; _bullet = _array Select 2; _position = _array Select 3; _velocity = _array Select 4; _selection = _array Select 5; _ammo = _array Select 6; _direction = _array Select 7; _radius = _array Select 8; _surface = _array Select 9; _direct = _array Select 10; _PositionASL = getPosASL _unit; _PosASL_1 = _PositionASL Select 0; _PosASL_2 = _PositionASL Select 1; _PosASL_3 = _PositionASL Select 2; //hintc format ["X: %1 Y: %2 Z: %3",_PosASL_1,_PosASL_2,_PosASL_3]; _Position_1 = _Position Select 0; _Position_2 = _Position Select 1; _Position_3 = _Position Select 2; //hintc format ["X: %1 Y: %2 Z: %3",_Position_1,_Position_2,_Position_3]; //Reference Target 1 _A = _Position_1-_PosASL_1; _B = _Position_2-_PosASL_2; _C = _Position_3-_PosASL_3; //hintc format ["X: %1 Y: %2 Z: %3",_A,_B,_C]; _PosASL_PT1_0 = getPosASL PT1_0; _PosASL_PT1_0_X = _PosASL_PT1_0 Select 0; _PosASL_PT1_0_Y = _PosASL_PT1_0 Select 1; _PosASL_PT1_0_Z = _PosASL_PT1_0 Select 2; _D = _PosASL_PT1_0_X+_A; _E = _PosASL_PT1_0_Y+_B; _F = _PosASL_PT1_0_Z+_C; // Hit_Ind is object type: Empty > Objects (Helpers) > Sphere (10cm) Hit_Ind setposASL [_D,_E,_F]; playSound3D ["A3\Sounds_F\sfx\blip1.wav", player, false, getPos player, 1, 1, 0] Hopefully this will get you where you want to go... Cheers. Edited December 22, 2013 by DJPorterNZ Spelling, grammar Share this post Link to post Share on other sites
Falsche9 10 Posted December 22, 2013 (edited) I came up with something similar: place a "Simple Target" (class "Target_F") on your range and put this in the init: this addEventHandler ["HitPart", {_spr = "Sign_Sphere10cm_F" createVehicle [0,0,0]; _spr setPosASL (_this select 0 select 3);}]; this worked on vehicles and other signs too. Edited December 22, 2013 by Falsche9 Share this post Link to post Share on other sites
djporternz 26 Posted December 22, 2013 Very simple & elegant solution there, Falsche. I've filed that little nugget away for a rainy day. Share this post Link to post Share on other sites
joejoe87577 10 Posted December 22, 2013 I'll give it a try and make a quick sample mission. ---------- Post added at 20:38 ---------- Previous post was at 20:31 ---------- Almost the right Thing. But what I wanted was this: (bottom right corner) I've no idea how this works. I've done some dialogs, but i don't now how to make that sort of hint/Dialog. ---------- Post added at 20:51 ---------- Previous post was at 20:38 ---------- I've made a sample Mission and uploaded it to my skydrive: http://sdrv.ms/1gQcEMo Share this post Link to post Share on other sites
Mattar_Tharkari 6 Posted December 23, 2013 (edited) I don't know much about dialogues but why not just have a live PIP view of the target? This will create a target at the distance in the direction the player is facing: nul = [50] execVM "target.sqf"; _dist = _this select 0; _tgtPos = player modelToWorld [0,_dist,0]; _tgt = createVehicle ["Target_F", _tgtPos, [], 0, "CAN_COLLIDE"]; _dir = [player,_tgt] call BIS_fnc_dirTo; _tgt setDir _dir; _tgt addEventHandler ["HitPart", {_mkr = "Land_PencilRed_F" createVehicle [0,0,0]; _mkr enableSimulation false; _mkr setPosASL (_this select 0 select 3);}]; _obj = createVehicle ["Sign_Sphere10cm_F", [0,0,0], [], 0, "CAN_COLLIDE"]; _obj setObjectTexture [0,"#(argb,8,8,3)color(0,0,0,0)"]; _obj setPos (_tgt modelToWorld [0,-0.5,1]); _camPos = ([0,0,0]); [] call BIS_fnc_PIP; sleep 1; _targ_pip = ["rendertarget0",[[_obj,_camPos],_tgt],_obj] call BIS_fnc_PIP; _targ_pip camCommit 0; //assistance to find the target - can be hard to spot in the terrain _wp = (group player) addWaypoint [_tgtPos, 0]; _wp setWaypointType "MOVE"; _arrow = createVehicle ["Sign_Arrow_Large_F", [0,0,0], [], 0, "CAN_COLLIDE"]; _arrow setPosATL [_tgtPos select 0,_tgtPos select 1, 2]; Picture of result: http://31.media.tumblr.com/9844365958a0765262034bb331da4235/tumblr_my973kkiY51sneir7o1_1280.jpg Edited December 23, 2013 by Mattar_Tharkari Share this post Link to post Share on other sites
joejoe87577 10 Posted December 23, 2013 Thanks, this works for me. But there are two Problems remaining. The 1fst one is rather easy, how do I destroy/remove/disable the PiP? I've tried "camDestroy", "deleteVehicle" on the "_obj" and on the "rendertarget0". But it doesn't work. How do i remove the PiP? And the 2nd one is that the PiP Picture doesn't Show the same as the live view does. On the Picture the Little sphere on the popup target Shows where the bullet hit. But on the PiP there is no sphere, i've also tried it with a IR Laser at night. same result, I aim for the "head" but the laser in the PiP Shows a completly different Position. ---------- Post added at 12:40 ---------- Previous post was at 12:29 ---------- I've uploaded the example Mission to my skydrive: Link Grab a weapon from the VirtualAmmoBox and go to one of the Shooting positions, the PiP will appear, as soon as you leave the Shooting Position (the hint "false" appears), the pip should disappear. Share this post Link to post Share on other sites
Mattar_Tharkari 6 Posted December 23, 2013 [] call BIS_fnc_PIP; Will remove the PIP - notice I put it in my script to remove any existing PIPs? Camera is blind to helper objects which is why I use red pencils in the script. If you need something larger use red gull cans ("Land_Can_V3_F")? Share this post Link to post Share on other sites
joejoe87577 10 Posted December 23, 2013 Ok, next time i'll read the whole script. Thanks Share this post Link to post Share on other sites
AldoUSMC 10 Posted April 13, 2014 I came up with something similar:place a "Simple Target" (class "Target_F") on your range and put this in the init: this addEventHandler ["HitPart", {_spr = "Sign_Sphere10cm_F" createVehicle [0,0,0]; _spr setPosASL (_this select 0 select 3);}]; this worked on vehicles and other signs too. Thanks for this....it works well in creating the markers on targets..... I've been trying to figure out how to use deleteVehicle to get rid of the _spr = "Sign_Sphere10cm_F" vehicles created by this..... but with no success. Assuming I put this in a Simple Target..... how would you recommend setting up an addAction or trigger to delete the vehicles created after finishing firing on the target so I could then re-engage a clean target ? I appreciate the Code you provided and wonder what you would recommend.... I have been googling an searching numerous resources for about a week + to try to figure it out myself via markers, triggers, ini box inputs etc etc. s/f & Thanks for anything you can provide AldoUSMC Share this post Link to post Share on other sites
f2k sel 145 Posted April 13, 2014 you could create an array , you will only need ary=[]; in one target or game logic or it will mess up, it just needs it to create the variable. ary=[];this addEventHandler ["HitPart", {_spr = "Sign_Sphere10cm_F" createVehicle [0,0,0]; _spr setPosASL (_this select 0 select 3); ary=ary+[_spr]}]; players init this addAction ["remove markers",{{deletevehicle _x} foreach ary;ary=[]}] 1 Share this post Link to post Share on other sites
AldoUSMC 10 Posted April 15, 2014 With the help of Larrow and F2k we solved this today via at least one method ...see this post http://forums.bistudio.com/showthread.php?176180-Counting-a-Specific-Objects-Within-a-Trigger-Array&p=2667313#post2667313"]http://forums.bistudio.com/showthread.php?176180-Counting-a-Specific-Objects-Within-a-Trigger-Array&p=2667313#post2667313 s/f AldoUSMC Share this post Link to post Share on other sites
joejoe87577 10 Posted April 15, 2014 I'll look up my solution, but you'll have to wait until tomorrow as I'm not at my computer. Gesendet von meinem Nexus 7 mit Tapatalk Share this post Link to post Share on other sites