Jump to content
johnnyboy

[Solved] How to create footprints

Recommended Posts

Problem:  I thought this was solved, but it turns out foot prints are permanent ONLY if a player was near the unit making footprints at the time.  So we cannot have an AI run through waypoints leaving a permanent footprint trail.  However, this would still be useful in a scenario where a player is tracking another player.  Bummer!!

 

I'd like to create footprints (and make them permanent) as part of trail for JBOY dog to track.

 

The command nearestObjects returns an array of near objects with left and right footprints in it:

 

[NOID footstep_l.p3d,NOID footstep_l.p3d,NOID footstep_l.p3d]

 

How do I create these footprints via a command?  I tried typeOf and getModelInfo on these footstep objects, but it wasn't giving me an object I could use CreateSimpleObject with...

 

Once created, I'm hoping that enableSimulation false will prevent them from disappearing (that works for shell casings..).

 

 

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites

Just a feel. I wonder wether you can create some other ones with something like:

0 = [] spawn {

  _obj = player;
  _psl = "#particlesource" createVehicleLocal getpos _obj;
  _psl setParticleParams [["A3\Characters_F\footstep_L.p3d", 16, 30, 0], "", "Billboard", 1, 150000, [0, 0, 0], [0, 0, 0], 1, 1, 0, 0, [4, 5, 10, 10], [[0.1, 0.1, 0.1, 0.75], [0.4, 0.4, 0.4, 0.5], [1, 1, 1, 0.2]], [0], 1, 0, "", "", _obj];

  _psr = "#particlesource" createVehicleLocal getpos _obj;
  _psr setParticleParams [["A3\Characters_F\footstep_R.p3d", 16, 30, 0], "", "Billboard", 1, 150000, [0, 0, 0], [0, 0, 0], 1, 1, 0, 0, [4, 5, 10, 10], [[0.1, 0.1, 0.1, 0.75], [0.4, 0.4, 0.4, 0.5], [1, 1, 1, 0.2]], [0], 1, 0, "", "", _obj];

}};

 

That doesn't work but perhaps someone can confirm the p3d and give some light on all these parameters.

  • Like 1

Share this post


Link to post
Share on other sites
9 hours ago, johnnyboy said:

I'd like to create footprints (and make them permanent) as part of trail for JBOY dog to track.

....now...for how many of your guests you like me to cook dinner for doing that?

  • Like 1

Share this post


Link to post
Share on other sites

I figured out how to make footprints permanent.  Run the following code for a given unit, and the loop will find near footprints (objects of type "#mark") and disable simulation on them.  When simulation is disabled, they no longer disappear after a few seconds.   Better trails for tracking someone are now possible!

_d=[player] spawn 
{ 
    params["_man"];
    while {alive _man} do
    {
        {
            hint format ["surfaceType=%1",surfaceType getpos _man];
            if (typeOf _x == "#mark") then {_x enableSimulation false;};
        } foreach (nearestObjects [_man, [], 3]);
        sleep 1;
    };
};

And you guys thought "#mark"s were just something in your shorts!

  • Like 7

Share this post


Link to post
Share on other sites

Jonny you da mank mank. Ive been wanting this forever for snowy- track the psycho-who lives in the woods-type missions

  • Like 2

Share this post


Link to post
Share on other sites

Sadly, there is a problem with this. 

Problem:  It turns out foot prints are permanent ONLY if a player was near the unit making footprints at the time.  So we cannot have an AI run through waypoints leaving a permanent footprint trail.  However, this would still be useful in a scenario where a player is tracking another player.  Bummer!!

 

I guess BIS felt there was no sense creating footprints if there are no players nearby to see them (for performance reasons).  One step forward, two steps back...

 

 

Share this post


Link to post
Share on other sites

Eh, came up with a mock up idea for you. You could create an array of footsteps which stores their position and the time at which they were made which you could sort through when hunting or whatever:
(Run this in the debug console in the VR world and run round like crazy)

 

h = [] spawn {
	private _lastPos = getPosWorld player;
	private _tmpPos  = [0,0,0];
	private _positions = [];
	private _footsteps = [];
	private _i = 0;

	while {true} do {
		_tmpPos = getPosWorld player;
		if (_tmpPos distance _lastPos >1) then {
			_footstep = createSimpleObject [
				format ["a3\characters_f\footstep_%1.p3d", ['l', 'r'] select (_i %2)],
				AGLtoASL (player modelToWorldVisual ([[0,0.2,0],[0.2,0,0]] select (_i %2)))
			];
			_footstep setDir (getDir player);
			_positions pushBack [_tmpPos, time, _footstep];
			
			_i = _i + 1;
			_lastPos = _tmpPos;
		};
		hintSilent format ["FOOTSTEPS: %1", count _positions];
		sleep (1/((speed player) max 1));
	};
};

 

  • Like 7
  • Thanks 1

Share this post


Link to post
Share on other sites

Edit: ninja'd

BTW, don't forget to use surface normals and set up-vector =)

  • Like 3

Share this post


Link to post
Share on other sites

Brilliant workaround @HallyG...where there's a will there's a way.  In the beginning of a mission I can record  player prints into  multiple segments (say 10 prints per segment), and save 10 segments or so, and then leapfrog (setpos) the footprint segments along the track path as the player progesses along the track.

 

Edit:  Now that I actually studied your code, I see you actually figured out how to actually create the footsteps.  This means I can go back to my original approach of creating footsteps on the AI being tracked...I hope!  Sweet!  Thanks again.

 

1 hour ago, pedeathtrian said:

Edit: ninja'd

BTW, don't forget to use surface normals and set up-vector =)

Good point @pedeathtrian, thanks!  

  • Like 2

Share this post


Link to post
Share on other sites

Cool stuff, thanks a lot!

One question: Is there a way to (scriptwise) color the footprints, e.g. red, like if the guy stepped into a pool of blood?

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, Undeceived said:

One question: Is there a way to (scriptwise) color the footprints, e.g. red, like if the guy stepped into a pool of blood?

Great idea UD!  I just tried it and setObjectTexture had no effect on the footprints.  I think someone would have to take the footprint.p3d and make a red one for that to work.

 

Something else to note is that footprints that the game creates (which was my first solution above) do change color depending on surface type.  So they are black/grey on cement/roads, and red/brown in dirt or sand etc.  So there is some extra processing happening to determine footprint color based on surface.

 

But in HallyG's solution you use createSimpleObject to create the print and it always comes out dark black.  And it looks wrong when in dirt, sand, etc.

  • Like 1
  • Thanks 1

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

×