IDI-Systems / acre2

Advanced Combat Radio Environment 2 (ACRE2) for Arma 3
https://acre2.idi-systems.com
GNU General Public License v3.0
204 stars 118 forks source link

How should I use the API's ? #972

Closed ruisu07 closed 4 years ago

ruisu07 commented 4 years ago

Hi, I realized that some vehicles don't have radio racks (Dagor, Hemtt) and so, I'm looking to add them using ACRE2 API. The problem is that I don't know how to do it, for me the documentation is kinda confusing and I'm just struggling to make it work.

TheMagnetar commented 4 years ago

I am not sure I understand the question. There is an example with a list of arguments in the function itself: https://github.com/IDI-Systems/acre2/blob/master/addons/api/fnc_addRackToVehicle.sqf

[cursorTarget, ["ACRE_VRC103", "Upper Dash", "Dash", false, ["external"], [], "ACRE_PRC117F", [], ["intercom_1"]], false] call acre_api_fnc_addRackToVehicle

will add a rack (VRC103) to the vehicle pointed by the cursor named "upper dash" that cannot be removed (false). The radio will not be able to be accessed from inside and it will have by default an AN/PRC-117F. The rack will be connected to intercom 1.

ruisu07 commented 4 years ago

Should I add that argument to the init field of the vehicle in order to add racks on it? If so, I have tried that but doesn't seem to work. The vehicle by default doesn't have radio racks and I'm trying to add them to make convoy missions with a variety of vehicles

TheMagnetar commented 4 years ago

I suggest you start familiarizing yourself with SQF scripting. Probably you are not using the API function properly. For example: cursorTarget has no effect in the init field.

ruisu07 commented 4 years ago

Okay, I got the argument you gave me working, I just checked it out and what I want to use is acre_api_fnc_setVehicleRacksPreset because I need to have the possibility to use the racks from inside the vehicles.

ruisu07 commented 4 years ago

learned by doing, it's one of the best ways to learn I added; [this, ["ACRE_VRC103", "Superior", "Alto", false, ["inside"], [], "ACRE_PRC117F", [], ["intercom_1"]], true] call acre_api_fnc_addRackToVehicle to the Init of the vehicles and worked perfectly

TheMagnetar commented 4 years ago

Perfect! Closing the question!