Jump to content

Recommended Posts

Hey there guys,

 

I am looking around and wondering if anyone knows how to set up Dynamic Simulation, for ALL non-player units in the session, at all times. .. maybe a sleep or check timer where it applies it in periods for all non player units. Both from the start of the session and when you spawn them in mid session, through script or by Zeus

Micro managing activating dynamic simulation on any and all units is a bit tedious for me as Zeus

 

Share this post


Link to post
Share on other sites

couple scenarios:
1. if youre only spawning using Zeus: https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#CuratorObjectPlaced
2. If youre using Zeus and another script: https://community.bistudio.com/wiki/Arma_3:_Mission_Event_Handlers#EntityCreated. Although the preferred way is to just add the appropriate commands to the script itself, otherwise this has the potential to fire A LOT

one thing that got me at the beginning when i was working with DS, was if youre adding it for a NON-UNIT object, you'll add it for the single object. If you add it for a UNIT, you need to enable simulation for the GROUP, not the unit itself. SO dont run it for every unit, just skip over the units who's group is already being handled.
 

  • Thanks 1

Share this post


Link to post
Share on other sites

enableDynamicSimulation

 

MEH "entityCreated" fires very often. You could use "groupCreated" instead.

 

addMissionEventHandler ["GroupCreated", {
  params ["_group"];
  _group spawn {
    params ["_grp"];
    waitUntil {sleep 0.5; units _grp isNotEqualTo [] or isNull _grp};
    _grp enableDynamicSimulation true;
  };
}];

 

  • Thanks 1

Share this post


Link to post
Share on other sites
4 hours ago, pierremgi said:

enableDynamicSimulation

 

MEH "entityCreated" fires very often. You could use "groupCreated" instead.

 


addMissionEventHandler ["GroupCreated", {
  params ["_group"];
  _group spawn {
    params ["_grp"];
    waitUntil {sleep 0.5; units _grp isNotEqualTo [] or isNull _grp};
    _grp enableDynamicSimulation true;
  };
}];

 

 

That works!

I could not find VehicleCreated for spawned in vehicles so I assume it is EntityCreated

Share this post


Link to post
Share on other sites
3 hours ago, saddle said:

I could not find VehicleCreated for spawned in vehicles so I assume it is EntityCreated

2 questions, because now it sounds like youre using both the EH 'EntityCreated' &&  "GroupCreated" which will result in a lot of calls.
1. are you only spawning vehicles in Zeus or with another script also?
2. if the vehicles are spawned with another script, are they available to edit via Zeus after theyve spawned in?
 

Share this post


Link to post
Share on other sites
42 minutes ago, j0nes said:

2 questions, because now it sounds like youre using both the EH 'EntityCreated' &&  "GroupCreated" which will result in a lot of calls.
1. are you only spawning vehicles in Zeus or with another script also?
2. if the vehicles are spawned with another script, are they available to edit via Zeus after theyve spawned in?
 

 

1.

I am spawning men(groups) and vehicles by script as well as zeus.

So I am working on applying DS to all units, whether grouped, or singular, men as well as vehicles.

 

addMissionEventHandler ["GroupCreated", {
  params ["_group"];
  _group spawn {
    params ["_grp"];
    waitUntil {sleep 0.5; units _grp isNotEqualTo [] or isNull _grp};
    _grp enableDynamicSimulation true;
  };
}];

This works fine, but it only applies to infantry groups so far. Infantry are spawning in groups, and vehicles are spawning as single units.

 

2. Yes, everything can be edited as Zeus. Can be commanded, customized, killed off, ect.

I just need to make them selectable through a module in the Achilles mod called Add/Remove Editable Units first sometimes.

 

Share this post


Link to post
Share on other sites
1 minute ago, saddle said:

So I am working on applying DS to all units, whether grouped, or singular, men as well as vehicles.

 


addMissionEventHandler ["GroupCreated", {
  params ["_group"];
  _group spawn {
    params ["_grp"];
    waitUntil {sleep 0.5; units _grp isNotEqualTo [] or isNull _grp};
    _grp enableDynamicSimulation true;
  };
}];

This works fine, but it only applies to infantry groups so far. Infantry are spawning in groups, and vehicles are spawning as single units.

 

Single unit (infantry or manned vehicle) belongs to a group. The problem arises when spawning objects like empty vehicles. In other words, no matter the number of alive unit(s) in a group, inside a vehicle or not.
If you want to spawn objects like vehicles (empty) and apply the enableDynamicSimulation command, consider "entityCreated" MEH with strong filter like:
 

addMissionEventHandler ["EntityCreated", {
  params ["_unit"];
  if (_unit isKindOf "CAManBase" or _unit in vehicles) then { _unit enableDynamicSimulation true};
}];

 

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
addMissionEventHandler ["EntityCreated", {
  params ["_entity"];
  _validEntity = _entity isKindOf "CAManBase" || _entity in vehicles;
  if(!dynamicSimulationEnabled _entity && _validEntity)then
  {
	if(!isNull (group _entity))then{_entity = group _entity};
	_entity enableDynamicSimulation true;
  };
}];

I heard "strong filter" so of course i have to try to 1up the guy with 7200 posts

  • Thanks 1

Share this post


Link to post
Share on other sites

Tried to put it in and seems to work really well! So much fun! Thank you both! 

  • Like 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

×