Page MenuHomeFeedback Tracker

Add SQF function for returning the cargo index of a unit.
Closed, ResolvedPublic

Description

Simple function to return the index of a unit in a vehicles cargo slots.

Details

Legacy ID
2645574950
Severity
None
Resolution
Fixed
Reproducibility
N/A
Category
Feature Request
Additional Information

This functionality is available in the engine and used in multiple places internally, it just needs to be exposed via an SQF function. It would literally take 5 minutes to add.

Event Timeline

Nou edited Steps To Reproduce. (Show Details)Jul 1 2014, 1:08 PM
Nou edited Additional Information. (Show Details)
Nou set Category to Feature Request.
Nou set Reproducibility to N/A.
Nou set Severity to None.
Nou set Resolution to Fixed.
Nou set Legacy ID to 2645574950.May 7 2016, 6:52 PM
Bohemia added a subscriber: Dwarden.Jul 1 2014, 1:08 PM

Related to #19435

Nou added a subscriber: Nou.May 7 2016, 6:52 PM
Nou added a comment.Jul 1 2014, 1:20 PM

This could also be returned in assignedVehicleRole, though adding a new function would most likely be the best option due to the possibility of people checking the return length of assignedVehicleRole.

Assignedvehiclerole has very little to do with actualnunits in cargo, even more so with cargo index of a unit

Nou added a comment.Jul 1 2014, 8:42 PM

That is actually incorrect.

assignedVehicleRole is used to determine turret locations for units that have been assigned (and then occupied if done correctly by a scripter or the unit moved in through the normal game interface). It is used to return vehicle positions in indeterminable slot roles already. It returning the cargo index for cargo assigned roles would be a somewhat natural extension of that functionality.

unit can have assigned role but not be inside a vehicle

player assignAsCargo heli;
hint str [assignedVehicleRole player, vehicle player != player]; //[["Cargo"], false];

^^^ not in vehicle yet assigned as Cargo. Same goes for assignedCargo

Nou added a comment.Jul 1 2014, 9:12 PM

Except that is generally considered bad practice, in that you assign a vehicle role, move the unit in, and then remove their role when they leave because the assigned vehicle role is not dependent on a specific vehicle type.

So in good, proper practice, yes, it is associated to where they are in the vehicle.

Yes, YOU can do it incorrectly, BUT further countering your argument you can assign a cargo index right now to a unit outside of the vehicle as well.

Nou added a comment.Jul 1 2014, 9:16 PM

It is a moot point either way because like I said, adding it to that function might possibly break previous scripts that check the length of assigned vehicle role.

I'm not sure I understood your last comment. Length of "assigned vehicle role". It is always 1 unless it is a turret, then it has path so it is 2. What exactly did you mean by that?

Nou added a comment.Jul 1 2014, 9:50 PM

If someone is being lazy and checking length of assignedVehicleRole instead of the values to determine if it is a turret position or not.

Great, now I have absolutely no clue what it is all about.

getCargoIndex function was added in rev. 126046.
"vehicle getCargoIndex unit"

Mass-closing all resolved issues not updated in the last month.

Please PM me in BI Forums (http://forums.bistudio.com/member.php?55374-Fireball) if you feel your bug was closed in error.