Jump to content
Hypnomatic

Quick and fun projectile path tracing!

Recommended Posts

Is someone adapted this script to track the fragmentation spawned by ACE 3, I would love them forever. The frag system is open-source now, so it should be possible.

Share this post


Link to post
Share on other sites
	{ 
	  [_x, [0,0,1,1], 3, 2, nil, 6] call hyp_fnc_traceFire;  
	} forEach Allunits; 

When I call this from admin console and global exec it runs on every client as intended. But calling that script on a client from the server does not work, when called from onPlayerKilled.sqf   

Why is does it not work?

Share this post


Link to post
Share on other sites
Guest

I've always been doing that with non-moving particles instead of lines. Might wanna give that a try...

Here's how my old script worked (adapted on the fly – untested in ArmA3):

// this addEventHandler ["fired", { [_this] spawn ArA_fnc_tracebullet; };

(...)

 

Tajin,

 

The fact that you is using spawn don't create a delay in the drop particle process making the first particle to be dorped only hundreds of meters away from the player?

Share this post


Link to post
Share on other sites

Right, call is probably better for that.

Share this post


Link to post
Share on other sites

Hi! 

I have been using this mod, and i have been wondering if there is a way to make the script activateable, and not just continuously activated

Share this post


Link to post
Share on other sites

Hi there, i need some of your help please.

 

I'm trying to make a script which will basically delete the bullet and draw a green tracer line to the cursortarget.

 

So far as I know, all the scripts were based on the bullet tracing, and I was wondering if it is possible just to draw line for 5-7 sec which will be created about 100m distance or something like that.

 

 

 

 

Let me show I want to make, its incorrect code:
 
init.sqf

[] execVM 'scripts\tracer.sqf';



Player addEventhandler ["Fired", {
_bullet = (_this select 6);
_target = cursorTarget;
dist_1=player distance _target;
if (primaryweapon player== "impulseg") then
{
deletevehicle _bullet;

if (_target isKindOf "Man") and (if (dist_1 < 50))then {

[player, [1,0,0,1], 3, 2, nil, 3] call hyp_fnc_traceFire;
_target setdamage 1;
};
};

}];

Share this post


Link to post
Share on other sites
On 9/29/2013 at 9:40 AM, Hypnomatic said:

Sort of, IIRC the drawLine3D command is new to ARMA3, so I would need to come up with some particle or something to use. Everything else in the script should work in ARMA 2 though, so I'll toy with a few different particles to see if anything looks good. Maybe something like Tajin's example.

As mentioned above, this isn't really a script for gameplay purposes, but more so a script for just testing bullet mechanics and screwing around in general.

To give you an example, let's say I create 2 soldiers, and a tank in the editor, and name the soldiers soldier1 and soldier2, and the tank tank1. If you haven't already saved the mission, do so now, then navigate to it's folder (Mine would be My Documents\Arma 3 - Other Profiles\Hypnomatic\missions\WhateverINamedTheMission.Altis) outside of ARMA and create the file init.sqf (Make sure you have file extension visible so you don't just create init.sqf.txt!). Into init.sqf I would paste:

 


/*
General init for the tracer function
*/
firedBullets = [];

addMissionEventHandler ["Draw3D", { //On every frame...
   {
       for "_i" from 0 to (count _x) - 2 do {
           drawLine3D [_x select _i, _x select (_i + 1), [1,0,0,1]]; //...draw lines connecting the positions on the path that the bullet took...
       };
   } forEach firedBullets; //...for every bullet that has been fired since the last clearing.
}];
player addAction["Clear Lines", {firedBullets=[];}]; //Clears the lines of all bullets no longer in the air

/*
Syntax: 
   [_unit] call hyp_fnc_traceFire;
Params: 
   _unit: Either a vehicle or unit
Return Value:
   Scalar: The ID of the "fired" EventHandler that was added.
*/
hyp_fnc_traceFire = {
   (_this select 0) addEventHandler ["fired", {
       [_this, (position(_this select 6))] spawn {
           private["_params","_initialPos","_bullet","_index","_positions"];
           //Vars and Params
           _params     = _this select 0;
           _initialPos = _this select 1;
           _bullet     = _params select 6;
           _index      = count firedBullets;
           _positions  = [_initialPos];

           //Assemble the array of positions and push it to the global array
           waitUntil {
               if (isNull _bullet) exitWith {true};
               _positions set [count _positions, position _bullet];
               firedBullets set [_index, _positions];
           };
       };
   }]
};  

[soldier1] call hyp_fnc_traceFire;
[soldier2] call hyp_fnc_traceFire;
[tank1] call hyp_fnc_traceFire;
 

 

(Note the addition of the 3 lines at the bottom)

Save it and launch the mission, and you should be good!

Also dropping a message to Jester about using his video in the post. If he's all good with it I'll add it to the OP.

 

This script is written for an older version of arma3 (yes its a bit of a necro thread now, but its still a useful script to use)
 

The script produces an error about waitUntil returned Nil , boolean expected, 
Still produces the trace but it waituntil now loop instruction must have changed syntax since this was written, and I'm not a coder. so

How to update this to fix this  error?

Share this post


Link to post
Share on other sites

Maybe replace the waitUntil with:

 

while {!(isNull _bullet)} do {

_positions set [count _positions, position _bullet];

firedBullets set [_index, _positions];

};

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

×