Jump to content

R3F logistics question...


Turk

Recommended Posts

There are a few things that would need to change, e.g:

 

surveiller_conditions_actions_menu.sqf

 

R3F_LOG_action_heliport_larguer_valide = (driver R3F_LOG_objet_addAction == player && !isNull (R3F_LOG_objet_addAction getVariable "R3F_LOG_heliporte") &&

 

([0,0,0] distance velocity R3F_LOG_objet_addAction < 15) && (getPos R3F_LOG_objet_addAction select 2 < 40) && !(R3F_LOG_objet_addAction getVariable "R3F_LOG_disabled"));

 

The above checks if "dropping" is valid, with the main checks being velocity ([0,0,0] distance velocity R3F_LOG_objet_addAction < 15) and the Z distance from the ground (getPos R3F_LOG_objet_addAction select 2 < 40) .

 

You would need to change this to search for buildings/objects near by, then calculate the bounding box and then the world position based on the height, e.g:

 

 

 

_obj = (nearestObjects [_heli, ['Building], 40]) select 0; // find an object within 40 meters
_obj_bounds = boundingBox _obj; // get the bounding box of the object
_obj_height = _obj_bounds select 1; // get the height of the object
_world_pos = _obj modelToWorld [0, 0, _obj_height]; // get the world position, offsetting the z index by the height
_world_pos_z = _world_pos select 2; // get the z index of the world position

The above essentially gives you a z position in the world space, at the top of the building (or buildable object, e.g. floor) - not sure if the epoch buildables are a subclass of 'Building' or any of its children - but IIRC it is.

 

Then, inside larguer.sqf

 

detach _objet;

 
_objet setPos [getPos _objet select 0, getPos _objet select 1, 0];
_objet setVelocity [0, 0, 0];

 

This sets the object position, to its current X/Y, but zero Z (the ground) - essentially you would change this to:

 

 

detach _objet;

 
_objet setPos [getPos _objet select 0, getPos _objet select 1, _world_pos_z];
_objet setVelocity [0, 0, 0];

 

 

Keep in mind, this is all of the top of my head, I haven't tested this - I see a few issues with it, for example, it having trouble figuring out whether to drop on the ground or on top of an object - you would have to determine which is closer. Otherwise, you could add another action menu "Drop the object on closest building" which would give the pilot the choice (maybe a smarter option).

 

Another issue will be nearestObjects, as it will be searching in all planes (x, y, z) AFAIK, so you may need to filter out objects that are too far away on x/y planes - although I would hazard to guess this may not be a major problem as the first object in result SHOULD be the closest.

 

EDIT: actually nearestObjects would certainly cause a problem if you were hovering between a few buildings, I'll have a play around this evening and see what I can come up with - I've wanted to do this for a while anyway (e.g. put GPK on towers at castle)

Link to comment
Share on other sites

Couldn't get it to work how I wanted, ended up just doing the following:

 

surveiller_conditions_actions_menu.sqf (remove distance check)

 

R3F_LOG_action_heliport_larguer_valide = (driver R3F_LOG_objet_addAction == player && !isNull (R3F_LOG_objet_addAction getVariable "R3F_LOG_heliporte") &&

([0,0,0] distance velocity R3F_LOG_objet_addAction < 15) && !(R3F_LOG_objet_addAction getVariable "R3F_LOG_disabled"));
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...