Jump to content
Sign in to follow this  
max power

Making Sheep Sprint

Recommended Posts

This seems a bit obscure but I hope someone has an idea of how to hack out some behaviour from these blasted sheep.

What I'm after it making some sheep mill around for a few second and then trigger them to sprint away.

So, I found out the hard way (like everyone else) that sheep can't be grouped or be given waypoints because they are agents. So, I was asking around and apparently the thing to do is use scripts to create them with createUnit. Now they can be grouped and they can be given waypoints... but NOTHING I can do will make them sprint. I thought maybe they can't sprint, so I tried making a sheep a player to see what they are capable of- they can sprint, they just choose not to.

Another problem I'm having is not being able to name the sheep- but I think maybe that's more a problem from the fact I've only been scripting for like 3 days and not necessarily a problem with the game.

So, I thought maybe executing some scared sheep FSMs might help... But I can't execute FSM on these sheep now because the sheep FSMs require agents. :jail:

Does anyone have any idea how I can just make some bloody sheep and get them to mince around, then sprint away?

Share this post


Link to post
Share on other sites

This won't affect how fast they move, but I have used the moveto command on them and cows to get them to move.

I found for my project cows better because they have a faster movement compared to sheep. Not sure what you are doing, but I found the sheep to be quite slow. Goats are quite fast so seem to react better.

I used the forcespeed command to obtain a level of control over their speed, by slowing down certain animals that weren't as "freaked" by a vehicle.

An example of what the above commands acheived. Sheep not shown below.

Z4UnF-C1MbA

Hope this helps

Blake

Share this post


Link to post
Share on other sites

Could you use the attachTo command to attach them to a civilian, but set the presence of the civilian to 0, or car, etc? I think I've seen this with other objects.

Share this post


Link to post
Share on other sites

Have a look in animals2.pbo... there's already 'scared' fsm's (like reactDanger.fsm, reactFire.fsm) and functionality enabled through the config.

See the execFSM and related scripting commands for altering the various fsm's variables as needed.

You'll note in the Sheep's config it inherits from 'CAAnimalBase' which already has a 'firedNear' eventHandler in-place for instance that runs 'ca\animals2\data\scripts\reactfire.fsm'.

FSM's are a whole little sub-culture in RV... quite cool & interesting really.

Edited by Synide

Share this post


Link to post
Share on other sites
Could you use the attachTo command to attach them to a civilian, but set the presence of the civilian to 0, or car, etc? I think I've seen this with other objects.

yea, you attach the sheep to a civilian, and hide the civilian and allowdamage false. then you just give the civilian and sheep a waypoint intead, if it looks like its going too fast, use forcespeed on the civilian to make it look like the sheep is naturally running

Share this post


Link to post
Share on other sites
Have a look in animals2.pbo... there's already 'scared' fsm's (like reactDanger.fsm, reactFire.fsm) and functionality enabled through the config.

See the execFSM and related scripting commands for altering the various fsm's variables as needed.

You'll note in the Sheep's config it inherits from 'CAAnimalBase' which already has a 'firedNear' eventHandler in-place for instance that runs 'ca\animals2\data\scripts\reactfire.fsm'.

FSM's are a whole little sub-culture in RV... quite cool & interesting really.

I've been looking at those but they don't sprint from danger. They just toddle around.

---------- Post added at 08:32 ---------- Previous post was at 08:21 ----------

This won't affect how fast they move, but I have used the moveto command on them and cows to get them to move.

I found for my project cows better because they have a faster movement compared to sheep. Not sure what you are doing, but I found the sheep to be quite slow. Goats are quite fast so seem to react better.

I used the forcespeed command to obtain a level of control over their speed, by slowing down certain animals that weren't as "freaked" by a vehicle.

An example of what the above commands acheived. Sheep not shown below.

Hope this helps

Blake

That looks great, BlakeAce. I guess these animals were placed in the editor?

Just for academic purposes, have you found a way to name them via script? I'm finding setvehiclevarname a little difficult to use for some reason. Also, it seems like you're able to put agents into 'teams', but these teams seem to be different than the fireteams which are a subgroup of groups. Do you know anything about that?

Igneous and Panther

Thank you for your replies. You'll be happy to know that a BIA employee suggested the same thing! I'm going to try some other measures first but I think I may have to resort to this ingenious method.

Thanks everyone for your very helpful replies.

Share this post


Link to post
Share on other sites

Thanks for the heads up, Master85!

I eventually solved this in a really complicated (for me) way.

I spawned a bunch of agent sheep to graze and look sheepish- however, a lot of the time they appear to iceskate. When the scary scariness approaches, a trigger executes a script that:

  • Gets a bunch of men and hides them, then sets their positions and orientations to the positions and orientations of the agent sheep.
  • Attaches the agent sheep to the men.
  • Spawns a bunch of identical unit sheep some distance away.
  • Gets the position, orientation, and animation of each agent sheep.
  • Moves the unit sheep to the agents sheep's locations, and switches their animations to match.
  • Hides the agent sheep.
  • Attaches the unit sheep to the men.
  • Gives the men orders that gets them to run at a speed limited to a running sheep to a location with a little bit of random delay so they don't take off all at once like robots... and disables their FSM chattiness. I had a few sheep run by me going "Hey there!"
  • Forces the unit sheep to play the running sheep animation after a short delay so they have time to turn around first.

And like 5 days ago I didn't script at all. Damn cutscenes. Thanks to everyone in this thread plus Mondkalb and Celery. No thanks to Gossamer Solid.

Edited by Max Power

Share this post


Link to post
Share on other sites

I guess these animals were placed in the editor?

Just for academic purposes, have you found a way to name them via script? I'm finding setvehiclevarname a little difficult to use for some reason. Also, it seems like you're able to put agents into 'teams', but these teams seem to be different than the fireteams which are a subgroup of groups. Do you know anything about that?

Yes editor placed.

I have done it two ways, first uses the sync method. Sync all the sheep to a reference object, minus the reference object from the array of synced objects to get an array of all the sheep objects.

_ref_object = _this select 0;
_sheep_array = synchronizedObjects _ref_object ;
_sheep_array = _sheep_array -[_ref_object];

The other way was to create a trigger in a script started from one of the sheep objects, then filter for the same type of object as the calling object. Not very elegant, but works.

SR2 = [this, typeof this] execVM "Herd_Behaviour.sqf";

_refobj = _this select 0;
_ClassType = _this select 1;

_trg2=createTrigger["EmptyDetector",getPos _refobj];
_trg2 setTriggerArea[1000,1000,0,false];
_trg2 setTriggerActivation["ANY","PRESENT",false];
_trg2 setTriggerTimeout [0, 0, 0, true ];
_trg2 setTriggerStatements["this", "", ""];

waituntil {sleep 1; count  (list _trg2) >0}; 

_Herd_List = [];
{
if (_x iskindof _ClassType) then
{
	_Herd_List = _Herd_List + [_x];
};
}foreach (list _trg2);

fsm's are on my todo list to learn about, so can''t help there.

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
Sign in to follow this  

×