Jump to content
Sign in to follow this  
travisneids

Get Class/Object Names

Recommended Posts

What is the best way to find class names and object names? Example: If I want to modify the ammo on a AH9, without relying on the community each time, what is the best way to find the ammo object of a helicopter and modify it?

I'm new to Arma3 scripting - not programming...so my approach may be skewed lol.

Thanks!

---------- Post added at 13:58 ---------- Previous post was at 13:51 ----------

Using this https://community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3 it looks like I could use getAmmoCargo on the vehicle object?

Share this post


Link to post
Share on other sites
to get class names, use: http://browser.six-projects.net/cfg_vehicles/classlist?version=67.

But I am not sure I understand waht is it you want to do with them?

my getAmmoCargo would be incorrect.

I'm currently modifying an already created mission file. They have a script that fixes damage and refuels the helicopter if you land in a specific spot. Their helicopters are civilian helicopters with no weapons. I've changed those helicopters to armed helicopters and I would like this Fix/Refuel script to now include a Rearm of ammo in the helicopter.

Maybe their is an easier way to rearm the helicopter not using their current method (while loop)? It would be neat to keep the same format (time delay...the lower the ammo the longer you have to be on the pad).

Here is their rearm script with my code commented at bottom:

private ["_damage","_percentage","_veh","_vehType","_fuel"];
_veh = _this select 0;
_vehType = typeOf _veh;

if (_veh isKindOf "ParachuteBase" || !alive _veh) exitWith {};

if !(_veh isKindOf "Helicopter") exitWith { _veh vehicleChat "This pad is for chopper repairs only, soldier!"; };

_veh engineOn false;

_veh vehicleChat format ["Repairing and refuelling %1. Stand by...", _vehType];

_damage = getDammage _veh;

while {_damage > 0} do
{
_veh engineOn false;
sleep (1 + (random 1.5));
_percentage = 100 - (_damage * 100);
_veh vehicleChat format ["Repairing (%1%)...", _percentage];
if ((_damage - 0.01) < 0) then
{
	_veh setDamage 0;
	_damage = 0;
} else {
	_veh setDamage (_damage - 0.01);
	_damage = _damage - 0.01;
};
};

_veh vehicleChat "Repaired (100%).";

_fuel = fuel _veh;

while {_fuel < 1} do
{
_veh engineOn false;
sleep 1;
_percentage = (_fuel * 100);
_veh vehicleChat format["Refuelling (%1%)...", _percentage];
if ((_fuel + 0.01) > 1) then
{
	_veh setFuel 1;
	_fuel = 1;
} else {
	_veh setFuel (_fuel + 0.01);
	_fuel = _fuel + 0.01;
};
};

_veh vehicleChat "Refuelled (100%).";

sleep 2;

//My crappy code that doesn't work - just trying to get a value.
_ammo = _veh ammo;
_veh vehicleChat format["Rearming %1..", _ammo];

sleep 2;

_veh vehicleChat format ["%1 successfully repaired and refuelled.", _vehType];

---------- Post added at 14:38 ---------- Previous post was at 14:25 ----------

Ah ok - pretty easy actually. But I still need to be able to get the current ammo count. Closer!!!

_vehicle setVehicleAmmo 1;

---------- Post added at 14:46 ---------- Previous post was at 14:38 ----------

Now just a matter of figuring out the correct name for the Gatling gun on the helicopter me thinks!

//My crappy code that doesn't work - just trying to get a value.
ammoCount = _veh ammo "Gatling 6.5 mm";
_veh vehicleChat format["Ammo at %1", ammoCount];
_veh setVehicleAmmo 1;

---------- Post added at 14:54 ---------- Previous post was at 14:46 ----------

I guess I'm either super smart or just didn't give it enough time but I figured it out using the in-game editor debug tools. I was able to drill down to the weapon on the current helicopter I was in and find the name of the gun:

ammoCount = _veh ammo "LMG_Minigun_heli";
_veh vehicleChat format["Ammo at %1", ammoCount];
_veh setVehicleAmmo 1;

Now just to loop through until the ammo count = the amount I want it to!

Share this post


Link to post
Share on other sites
I'm also not quite sure what you're looking for but the best I could get is your looking to get the magazine classname automatically?

If so you could use something like this:

https://community.bistudio.com/wiki/magazinesTurret

I actually have exactly what I want. If you look at the current script, it slowly repairs and fills up the fuel of the vehicle. I'm going to do the same with the ammo since the original mission didn't have helicopters with weapons.

Using the following is exactly what I needed:

ammoCount = _veh ammo "LMG_Minigun_heli";
_veh vehicleChat format["Ammo at %1", ammoCount];
_veh setVehicleAmmo 1;

ammo uses 3 paramaters: unitName (the object that has the weapons as a child), the script command then the weapon you want the count from (since the object can have multiple weapons). This returns a number which is my ammo count! :yay:

I think what I was looking for is a list of these commands and that is exactly what the below urls give me. The wiki to see the commands and the in-game editor to see where I can find the objects and its children/properties.

And again I used a combination of https://community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3 and the in-game editor debug screen (looking through the config files which nicely shows you whatever object you are currently in or using).

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  

×