Jump to content
johnnyboy

Make trail of smashed down grass [SOLVED: mini-script]

Recommended Posts

As a player, when you go prone and crawl, grass is smashed down and stays down.  For a tracking script, I would like the grass to be smashed down by the fugitive periodically, showing us the "trail" of where the fugitive has been.

 

How can I squash grass via a script?

 

I don't want to use clutter cutter objects, because they remove the grass entirely.

 

Edit:  This is solved.  Credit: Grumpy Old Man for using invisible prone guy to crush grass.

Here's a mini-script to put in the init of a unit.  Give that unit waypoints through a grassy area, and follow him to see the smashed grass trail behind him.

// Put this in the init of a unit, and they will leave a smashed grass trail behind them
dmy= [this] spawn
{
    params["_dude"];
    _masher1 = createAgent ["C_man_p_beggar_F", [0,0,0], [], 0, "CAN_COLLIDE"];
    hideObject _masher1;
    _masher1 setUnitPos "DOWN";
    _masher1 setDir (getDir _dude);
    _masher1 setBehaviour "CARELESS";
    _masher1 allowDamage false;
    while {alive _dude} do
    {
        _masher1 setdir getdir _dude;
        _masher1 setpos (_dude modelToWorld [0,-2,0]);
        sleep .1;
    };
    deleteVehicle _masher1;
};
  • Like 2

Share this post


Link to post
Share on other sites

Just a thought: I know you can knock down trees by setting damage on trees to 1, could it work on grass too maybe? I don't know if trees have ID numbers on the objects though that's the thing, and I don't think grass is going to have ID numbers.

  • Like 1

Share this post


Link to post
Share on other sites

nah grass is procedurally generated. would be way too much data otherwise i'm guessing.

 

the question would be if AI units flatten grass too. i think tanks might do.

 

not really helping your problem but maybe also use some of those small objects ported from dayZ to lay a trail. like food containers and other garbage he might leave. maybe a campfire.

Share this post


Link to post
Share on other sites

They do.

hide some unit, force him into prone, use setAnimSpeedCoef 5 or higher,

then let him crawl along the wanted path, he will flatten the grass just fine.

 

Downside to this is, the grass is coming back up rather quickly.

You're fine for the first minute, but then it's getting faster, at 90 seconds it's almost full up again.

 

Last time I tried this you had to be within visible (I guess grass render) distance for the grass to be pushed down.

So as long as you know where a player is this shouldn't be too much of a problem.

 

Cheers

  • Like 2

Share this post


Link to post
Share on other sites

Can't think of any "clean" way to do it either.

Possibly spawn a "trail" of hidden units that move only very slightly (using forced movement animations for example).

 

 

Another possible alternative could be a slowly decaying particle trail. (maybe some kind of dust, if that fits your setting ?)

  • Like 2

Share this post


Link to post
Share on other sites

All good ideas.  Thanks guys.  I'm already periodically dropping a garbage item (can, water bottle, matches, etc.).  And at spots where hunted unit spends more time I wanted to mash the grass.  I'll give the hidden crawling grass masher slave a go.  I'm glad I'm not an Arma unit.  Sometimes you get assigned such meaningless and degrading tasks.

 

I'll just store the mashed grass position, and wait to mash until player with in X meters.

 

Dust probably won't work for me.  But persistent foot prints, and occasional cold camp fire, with just a tiny puff of smoke added, are also in the works.

  • Like 2

Share this post


Link to post
Share on other sites

I'm drooling already....because I know where you wanna go with this...keep up man!!! ;)

  • Like 2

Share this post


Link to post
Share on other sites

Thanks to you guys, I have a solution for a "mashed grass trail" left behind by walking units.  I just setposed a hidden prone dude behind the lead walker every 10th of a second.  It has the problem GOM mentioned, which is grass stands back up after a minute or two.  So if we want a persistent mashed path, we are going to have to remember these positions, and keep sending the invisible masher through the positions once a minute.  If I end up doing that, I will post that solution as well.

 

Credit: Grumpy Old Man for suggesting invisible prone guy to crush grass.

 

Put this script in any unit's init field.  Give the unit waypoints through a grassy area, and follow him as player to see the path.

dmy= [this] spawn 
{ 
    params["_dude"]; 
    _masher1 = createAgent ["C_man_p_beggar_F", [0,0,0], [], 0, "CAN_COLLIDE"]; 
    hideObject _masher1; 
    _masher1 setUnitPos "DOWN"; 
    _masher1 setDir (getDir _dude); 
    _masher1 setBehaviour "CARELESS"; 
    _masher1 allowDamage false; 
    while {alive _dude} do 
    { 
        _masher1 setdir getdir _dude; 
        _masher1 setpos (_dude modelToWorld [0,-2,0]); 
        sleep .1; 
    }; 
    deleteVehicle _masher1; 
};
  • Like 2

Share this post


Link to post
Share on other sites

You can probably use grass cutter object, but you dont want to leave millions of objects behind because of performance. Instead to create permanent flat grass, use invisible agent in conjunction with the player who is tracking and dynamically flat the grass along some stored path. Storing coordinates is far less expensive than having many permanent objects added along the path.

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

×