Jump to content
LurchiDerLurch

AC-130 Script for ARMA2 (0.3)

Recommended Posts

Loving this script, it's awesome.

I've been trying to incorporate it into my mission and it works fine, I have the option to call in the AC130 and the UAV without any issues. However I would like give the player the option of doing this ONLY once a certain objective has been completed.

I've been googling around now for ages and can't find anything of any use so any help would be greatly appreciated :)

Share this post


Link to post
Share on other sites

You could put one of these lines into a trigger:

Type 1: Ability to call rotating AC130 via mapclick

player addAction ["Call AC130", "LDL_ac130\Actions\ac130_action_map.sqf"];

Type 2: Ability to call AI controlled rotating AC130 via mapclick

player addAction ["Call AC130 (AI)", "LDL_ac130\Actions\ac130_action_map_AI.sqf"];

Type 3: Ability to call rotating UAV via mapclick

player addAction ["Call UAV", "LDL_ac130\Actions\uav_action_map.sqf"];

Share this post


Link to post
Share on other sites

Thanks for the reply. That doesn't seem to work though :(

I installed the script using the addon method. Do i need to put any scripts inside my mission folder? All I have in there right now are:

briefing.sqf

description.ext

init.sqf

mission.sqm

I copied and pasted the code posted earlier into the init.sqf file in order to change some of the settings (time until it arrives for testing purposes).

I've got the "init" and the "call ac130" game logic (the player controlled one) synchronized to my player. When i preview it I am able to call an AC130 straight away.

So I created a trigger, using:

Condition: !alive car;

On Act: player addAction ["Call AC130", "LDL_ac130\Actions\ac130_action_map.sqf"];

However when i preview again I can still call an AC130 straight away, even though the car is not dead. Any idea what I'm doing wrong? As you can tell, i'm a total noob!

Also - I can't seem to destroy tanks...they're completely invincible...

Share this post


Link to post
Share on other sites

Ahhh i finally figured it out!

For any other noobs like me wondering how to make the AC-130 available after a certain parameter has been met:

On your mission put down the "LDL AC-130 Init" logic and sync it to your player, but do not put down any other of the LDL logics (that's where i was going wrong!)

Then create a trigger with a condition and enter one of the command LurchiDerLurch posted in the activation.

Sorted! Time for some bombing, thanks for the awesome script!

Share this post


Link to post
Share on other sites

can someone please add this to the stock campaigns for combined ops, I'm playing the Manhattan FOB in harvest red and the uav suck's. I cant use it for shit and I have ace and mando ruinning. No idea how to lock onto targets with these mods running. PLEASE replace the stock uav with this!

Share this post


Link to post
Share on other sites

Does this work with blastcore ? I mean getting the nice 105mm explosions. How do you up the blast effects and damages also btw thanks

Share this post


Link to post
Share on other sites
Sorry for the late response.

It's a little tricky... put this code into your init.sqf AFTER initialsing the script.

[]spawn
{
waitUntil{(LDL_ac130_active && LDL_plane_type == "UAV")};

sleep 3;

(LDL_weaponSlots select 0) set [1, 0];
(LDL_weaponSlots select 1) set [1, 0];

(LDL_weaponSlots select 0) set [2, 0];
(LDL_weaponSlots select 1) set [2, 0];
};

This code starts a new process, waits until the uav is started, sleeps 3 seconds to go sure that UAV is armed with the new weapon slots and the changes the munition to 0.

Thanks that works fine! But what do I do if i want the UAV to spawn 120 sec after requested. Then it doesnt. Just change the sleep to 123 ?

Also, is there a way to just remove the UAV instead of letting it fall down and crash?

Edited by MugAben

Share this post


Link to post
Share on other sites

Hey! I just found you script yesterday, I made a video featuring the addon/script. I think you may like it, Ill post a link as soon as it finish uploading 3-4 more hours xD. Its HD :p Is it ok if I place a "Where to get this script from" link in the vid description?

Share this post


Link to post
Share on other sites
Hey! I just found you script yesterday, I made a video featuring the addon/script. I think you may like it, Ill post a link as soon as it finish uploading 3-4 more hours xD. Its HD :p Is it ok if I place a "Where to get this script from" link in the vid description?

Sure. No problem.

Thanks that works fine! But what do I do if i want the UAV to spawn 120 sec after requested. Then it doesnt. Just change the sleep to 123 ?

Also, is there a way to just remove the UAV instead of letting it fall down and crash?

Have a look at the LDL_options:

0, //20: Delay for mapclick AC130 to arrive. Default: 120

This should also work for the UAV.

It should disappear when the script stops... I'll check it out.

Share this post


Link to post
Share on other sites
Hey! I just found you script yesterday, I made a video featuring the addon/script. I think you may like it, Ill post a link as soon as it finish uploading 3-4 more hours xD. Its HD :p Is it ok if I place a "Where to get this script from" link in the vid description?

Edit: DONE

Share this post


Link to post
Share on other sites
Sure. No problem.

Have a look at the LDL_options:

0, //20: Delay for mapclick AC130 to arrive. Default: 120

This should also work for the UAV.

It should disappear when the script stops... I'll check it out.

You misunderstood, or I explained it badly. :rolleyes:

When I choose that the UAV is to arrive after 120 sec, the "removeweapon ammo" thingie you gave me earlier, didnt work. I changed the sleep timer in this no-ammo thing, to 123 sec instead of 3. Then it worked. But!

When the "use"timer runs out (10 mins) and the UAV crashes down, how long does it take before I can request it again? I waited 15 mins, without success. And I double checked that the parameter said 3 available map clicks per player. So far I have only been able to request the UAV once. Im asking of this because the UAV is allready a very powerfull tool, all to powerfull with missiles IMO - and I want to limit its use so that my team has ie. 3 uses, of 10 mins each with a delay of arrival at 2 minutes. So they can't just fly it forever or request it again and again.

Finally, the UAV just drops dead down and crashes when used! This shouldnt happen. It should dissapear or fly away. :o

Sorry for being so demanding :D

Edited by MugAben

Share this post


Link to post
Share on other sites
You misunderstood, or I explained it badly. :rolleyes:

When I choose that the UAV is to arrive after 120 sec, the "removeweapon ammo" thingie you gave me earlier, didnt work. I changed the sleep timer in this no-ammo thing, to 123 sec instead of 3. Then it worked. But!

When the "use"timer runs out (10 mins) and the UAV crashes down, how long does it take before I can request it again? I waited 15 mins, without success. And I double checked that the parameter said 3 available map clicks per player. So far I have only been able to request the UAV once. Im asking of this because the UAV is allready a very powerfull tool, all to powerfull with missiles IMO - and I want to limit its use so that my team has ie. 3 uses, of 10 mins each with a delay of arrival at 2 minutes. So they can't just fly it forever or request it again and again.

Finally, the UAV just drops dead down and crashes when used! This shouldnt happen. It should dissapear or fly away. :o

Sorry for being so demanding :D

Now I understood.

1) You're right. You must add the delay to the 3 seconds (I didn't thought of the fact that the UAV is active as soon as the script starts... after the delay the script overwrites the weapons... so you must wait 3 seconds and overwrite them again... not very nice but I'll think about it ;) )

Btw: The script part I gave you works once... you could put it in a while loop so the script looks more that one time if the script is activated...

[]spawn
{
while{true} do
{
waitUntil{sleep 1;(LDL_ac130_active && LDL_plane_type == "UAV")};

while{LDL_ac130_active} do
{
sleep 3;

(LDL_weaponSlots select 0) set [1, 0];
(LDL_weaponSlots select 1) set [1, 0];

(LDL_weaponSlots select 0) set [2, 0];
(LDL_weaponSlots select 1) set [2, 0];
};
};
};

Untested but this should be an even better code. It waits until you start the UAV, as loong as you fly the UAV it sets the weapons to 0 and after that waits again for the UAV.

2) This seems to be a bug and I think it's (again) the LDL_scriptTerminated thing as =L2D=Curry already figured out... the plane disappears as soons as LDL_ac130_active is false... so here's a part of the script:

waitUntil{(LDL_scriptTerminated >= 4)};

LDL_ac130_active = false;

Have a look at this post: http://forums.bistudio.com/showpost.php?p=1816029&postcount=374

I already have a better solution for that. I hope this will work better then.

Sorry for the circumstances and thanks for finding bugs! ;)

Lurchi

Edited by LurchiDerLurch

Share this post


Link to post
Share on other sites

Awesome scipt, really good. But yet another question:

Im starting the script with

[getPos x1,LDL_options select 0,LDL_options select 1,LDL_options select 21, LDL_options select 20]call LDL_ac130_rot_setup;

and i have the plain named plain1 with

this setVariable ["LDL_planeInUse", false, true];

im getting this started with addaction. Everything works fine, but there is one problem. When i open the map, the player is ,of course, at the location where he activates the ac130. looks a little bit strange, cause i want the player to be at the marker where the ac130 is. I tried to get the player into above mentioned plain1 (player moveincargo plain). But now he is at the start location of plain1, but not in the attacking ac130.

Is there a way to get the player into the created plain? To see him at the map at the correct location?

Share this post


Link to post
Share on other sites

[getPos x1,LDL_options select 0,LDL_options select 1,LDL_options select 21, LDL_options select 20]call LDL_ac130_rot_setup;

With your code you create a new AC130 at the position x1.

if you want to start the script with your existing ac130 try to start the script with the plane1 variable instead of the position x1.

[plain1,LDL_options select 0,LDL_options select 1,LDL_options select 21, LDL_options select 20]call LDL_ac130_rot_setup;

Share this post


Link to post
Share on other sites

I'm trying to import this into Bon's tforce mission.

In Bon's init.sqf I've added this at the top:

//Check for Addon
if (!(isClass(configFile>>"CfgPatches">>"LDL_ac130"))) then 
{
//No Addon detected
//Spawn LDL_init
LDL_init = compile preprocessFileLineNumbers "LDL_ac130\LDL_init.sqf";
[]spawn LDL_init;
}
else
{
//Addon detected.
//LDL_init = compile preprocessFileLineNumbers "LDL_ac130\LDL_init.sqf";
//[]spawn LDL_init;
};

//Wait for the init
waitUntil {!isNil "LDL_initDone"};
waitUntil {LDL_initDone};

//*****************************************//

Here's Bon's full init.sqf file with the above code added:

// by Bon_Inf*

//Check for Addon
if (!(isClass(configFile>>"CfgPatches">>"LDL_ac130"))) then 
{
//No Addon detected
//Spawn LDL_init
LDL_init = compile preprocessFileLineNumbers "LDL_ac130\LDL_init.sqf";
[]spawn LDL_init;
}
else
{
//Addon detected.
//LDL_init = compile preprocessFileLineNumbers "LDL_ac130\LDL_init.sqf";
//[]spawn LDL_init;
};

//Wait for the init
waitUntil {!isNil "LDL_initDone"};
waitUntil {LDL_initDone};

//*****************************************//

#include "config.sqf"
#include "funcs\compile_funcs.sqf"

if(isNil "tfor_deathcount") then {tfor_deathcount = 0};
Server setVariable ["tfor_artifunds",tfor_artifunds,false];


if(isNil "paramsArray") then{
paramsArray = [
	11, // Time of Day
	10, // max. group size
	5,  // max. missions
	16, // max death per mission
	7,  // Enemy Skill
	1,  // Number enemy Inf
	1,  // Number enemy Vecs
	1,  // Artillery
	1,  // MHQ respawn
	0,  // Time speedup
	2,  // Marker system
	3,  // Injury System
	5,  // Injury System Agony
	2,  // rallypoints, fobs
	0,  // Ambient Civilians,
	1,  // Dynamic Weather,
	2,  // enemy Patrols
	0,  // enemy AA
	1,  // enemy Camps
	1,  // enemy reinf
	1,  // advanced aircraft
	1,  // advanced vehicles
	20, // ieds
	0   // ACRE radios
];
};
tfor_daytime = paramsArray select 0;			//Server setVariable ["tfor_daytime",tfor_daytime,false];
tfor_maxgroupsize = paramsArray select 1;		Server setVariable ["tfor_maxgroupsize",tfor_maxgroupsize,false];
tfor_maxmissions = paramsArray select 2;		//Server setVariable ["tfor_maxmissions",tfor_maxmissions,false];
tfor_max_death_per_mission = paramsArray select 3;	//Server setVariable ["tfor_max_death_per_mission",tfor_max_death_per_mission,false];
tfor_enemyskill = (paramsArray select 4)/10;		//Server setVariable ["tfor_enemyskill",tfor_enemyskill,false];
tfor_amount_enemyinfantry = paramsArray select 5;	//Server setVariable ["tfor_enemy_inf_strength",tfor_enemy_inf_strength,false];
tfor_amount_enemytanks = paramsArray select 6;		//Server setVariable ["tfor_enemy_vec_strength",tfor_enemy_vec_strength,false];
tfor_artillery = paramsArray select 7;			//Server setVariable ["tfor_artillery",tfor_artillery,false];
tfor_mhqrespawn = paramsArray select 8;			//Server setVariable ["tfor_mhqrespawn",tfor_mhqrespawn,false];
tfor_timespeedup = paramsArray select 9;		//Server setVariable ["tfor_timespeedup",tfor_timespeedup,false];
tfor_markersystem = paramsArray select 10;		//Server setVariable ["tfor_markersystem",tfor_markersystem,false];
tfor_injurysystem = paramsArray select 1;		//Server setVariable ["tfor_injurysystem",tfor_injurysystem,false];
tfor_injurysystem_agony = paramsArray select 12;	//Server setVariable ["tfor_injurysystem_agony",tfor_injurysystem_agony,false];
tfor_rallypoints = paramsArray select 13;		//Server setVariable ["tfor_rallypoints",tfor_rallypoints,false];
tfor_ambient_civs = paramsArray select 14;		//Server setVariable ["tfor_ambient_civs",tfor_ambient_civs,false];
tfor_dynamic_weather = paramsArray select 15;		//Server setVariable ["tfor_dynamic_weather",tfor_dynamic_weather,false];
tfor_enemy_patrols = paramsArray select 16;		//Server setVariable ["tfor_enemy_patrols",tfor_enemy_patrols,false];
tfor_enemy_aa = paramsArray select 17;			//Server setVariable ["tfor_enemy_aa",tfor_enemy_aa,false];
tfor_enemy_camps = paramsArray select 18;		//Server setVariable ["tfor_enemy_camps",tfor_enemy_camps,false];
tfor_enemy_reinforcements = paramsArray select 19;	//Server setVariable ["tfor_enemy_reinforcements",tfor_enemy_reinforcements,false];
tfor_adv_aircraft = paramsArray select 20;		//Server setVariable ["tfor_adv_aircraft",tfor_adv_aircraft,false];
tfor_adv_vehicles = paramsArray select 21;		//Server setVariable ["tfor_adv_vehicles",tfor_adv_vehicles,false];
tfor_ieds = paramsArray select 22;			//Server setVariable ["tfor_ieds",tfor_ieds,false];
tfor_acre = paramsArray select 23;			//Server setVariable ["tfor_acre",tfor_acre,false];

TFOR_INIT = true; // yay all variables set!!!


if(not isDedicated) then{WaitUntil{not isNull player}};
[] execVM "bon_artillery\bon_arti_init.sqf";
[] execVM "bon_recruit_units\init.sqf";
[] execVM "bon_loadoutpresets\bon_init_loadoutpresets.sqf";
[] execVM "bon_settings\bon_settings_init.sqf";
[] execVM "bon_lasertargeting\init.sqf";
[] execVM "bon_ieds\init.sqf";
[TFOR_TERMINAL] execVM "uav\init.sqf";
[TFOR_TERMINAL] execVM "bon_supplydrop\init.sqf";
[tfor_timespeedup] execFSM "fsm\skiptime.fsm";
[] execFSM "fsm\vehicledrivercheck.fsm";

if(tfor_dynamic_weather == 1) then {[] execFSM "fsm\dynamicweather.fsm"};

[] execVM "initserver.sqf";
[] execVM "initplayer.sqf";

I've added that before anything else in the init.sqf. I've also added the "LDL_ac130" folder to the mission folder.

I then put the

this setVariable ["LDL_planeInUse", false, true];

Into the C-130's init line.

When I launch the mission, I get the option for "AUTOPILOT AC-130 in the addaction menu, but as soon as I hit 400m I get this error:

Resource LDL_DialogAC130 not found

What could be the problem?

EDIT: Fixed. I forgot to add the config includes to the descriptions.ext

New problem:

How do I make it so Bon's resupply script gives the AC130 ammo?

Edited by zuff

Share this post


Link to post
Share on other sites

DUDE :D

I have inserted your script and addon mod into XENO's Domi 2 2.11 and really enjoying this in ArmA 2 stand alone ver. Flir :rolleyes: still damn fun !!

Took me some time to find the stand alone version for ArmA 2 I hope you keep it in a link for us poor boys.

Link to ver 0.5

- Operation Arrowhead and Combined Operations supported since v.0.6 (ARMA2 standalone is no longer supported) :butbut:

Thanks

LurchiDerLurch and crew job well done.

Edited by luap

Share this post


Link to post
Share on other sites

Great script, however I am not getting any kills added to my score whenever I use it as a copilot.

Any ideas?

Share this post


Link to post
Share on other sites
Because you don't kill anybody... The bullets have no connection to the player.

Then could it be possible to make the connection with the player, just like any other vehicle?

Share this post


Link to post
Share on other sites
is it possible to rearm the gunship? if possible, please can you tell me how can i do that.

I have been wanting to do just that for a while so I took some time to browe Lurchi's code and came up with this script.

Not 100% tested but it seems to work most of the time and it should be multiplayer compatible.

rearmAC130.sqf for v0.6

private ["_target", "_caller", "_id", "_object"];
_target	= _this select 0;
_caller	= if(count _this > 1) then {_this select 1} else {nil};
_id 	= if(count _this > 2) then {_this select 2} else {nil};
_args	= if(count _this > 3) then {_this select 3} else {nil};

_object = if(isNil "_caller") then {(vehicle _target)} else {(vehicle _caller)};

if(_object != _caller && !isNull _object) then {
//--- Start ---
_ac130_inUse = _object getVariable "LDL_planeInUse";
if(!isNil "_ac130_inUse") then {
	if(!_ac130_inUse) then {
		_object setVariable ["LDL_Ammo25", (LDL_options select 2), true];
		_object setVariable ["LDL_Ammo40", (LDL_options select 3), true];
		_object setVariable ["LDL_Ammo105",(LDL_options select 4), true];
	} else {
		hint "Cannot rearm while plane is in use.";
	};
};
//--- End ---
};

To run rearmAC130.sqf either use addAction or execVM

addAction:

//In init of plane or other objects

this addAction ["Rearm AC130","rearmAC130.sqf"];

In-game simply look at the object the action is attached to while in the plane to rearm.

execVM:

[this] execVM "rearmAC130.sqf";

For advanced users:

The actual rearming is done by the code in between

//--- Start --- and //--- End --- in rearmAC130.sqf.

rearmAC130.sqf for v0.7

private ["_target", "_caller", "_id", "_object"];
_target	= _this select 0;
_caller	= if(count _this > 1) then {_this select 1} else {nil};
_id 	= if(count _this > 2) then {_this select 2} else {nil};
_args	= if(count _this > 3) then {_this select 3} else {nil};

_object = if(isNil "_caller") then {(vehicle _target)} else {(vehicle _caller)};

if(_object != _caller && !isNull _object) then {
//--- Start ---
_ac130_inUse = _object getVariable "LDL_planeInUse";
if(!isNil "_ac130_inUse") then {
	if(!_ac130_inUse) then {
		_object setVariable ["LDL_Ammo25", (LDL_AC130_Adjustments select 2), true];
		_object setVariable ["LDL_Ammo40", (LDL_AC130_Adjustments select 3), true];
		_object setVariable ["LDL_Ammo105",(LDL_AC130_Adjustments select 4), true];
	} else {
		hint "Cannot rearm while plane is in use.";
	};
};
//--- End ---
};

Edited by mrCurry
Fixed version mismatch.

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

×