IRONFRONT FANS FORUM
Register Latest Topics
 
 
 


Reply
  Author   Comment  
Jason126

Private
Registered:
Posts: 4
Reply with quote  #1 
Hey everyone!

I got back into playing Iron Front again recently and started playing around with scripting. I really wanted to be able to use night vision in the editor but I couldn't get that to work. So I ended up creating a script that calls a C-47 to continuously fly over and drop flares to make night fighting a little easier in IF. When I got it working I was so excited I figured it should be shared with the community! This is my first post and I am really new to coding but I thought it was pretty cool!! I guess if it's "finished" this thread can be moved to the released scripts section? Thought I would put it here first and see what everyone thought of it. The code is below.

The script is based around two files. One is the core and then I put the C-47 code into a different file. That's it.

Code:

//////////////////////////////////////////////////////////////////
// Simulated Air Drop Flares Sequence for Iron Front Liberation 1944
// Author: Jason126
//////////////////////////////////////////////////////////////////
// This is a really cool script I made to continuously illuminate the battlefield at night.
// It was designed to simulate a C-47 supporting ground troops, dropping flares on parachutes.
// It makes night fighting in Iron Front a lot more fun!

//Installation and Use: 
//1. This file and C47.sqf goes into your mission folder. Typically located at C:\Users\Your_User_Name\Documents\Iron Front\missions\Your_Misson_Name.
//2. In the Iron Front editor, create an infantry unit set as player. Then name some unit dropAircraft, it can be any unit you wish.
//    This is just to make the globalChat work.
//3. In the Init. field of the player unit type command: this addAction ["Call for White Flares", "contFlareDropWhite.sqf"];
//4. Use the in game player menu to scroll to "Call for White Flares" and activate.
//5. As designed the script will delay for 60 seconds to simulate arrival of the drop aircraft on your position.
//6. The "for" loop then starts, it simulates the aircraft dropping 3 flares per pass at random intervals.
//7. 20 seconds later the "drop aircraft" starts its next pass, it makes a total of 10 passes.
//8. After 10 sets of 3 flares the script terminates.

//Notes:
//1. If you desire faster "on station time" adjust sleep 60; below or remove it completely.
//2. To simulate the aircraft flying over the initial position of the parachute is set to a random counter within 300 meters.
//    Ajdust "(random 300 - random 300)" to change drop dispersal.
//3. "sleep 3" simulates time delay as the crew throws flares out the door.
//4. "sleep 20" is the delay between drops, 20 is about right for continuous illumination, change as desired.
//5. If you want more flares per drop, change the "{_q<3}" value below.
//6. If you want more passes of the aircraft change the "{_i<10}" value below.
//7. "F_40mm_white" is the class name for a lit flare, the ammunition class name does not work.
//8. To change the color of the flare simply change to "F_40mm_red", "F_40mm_yellow", "F_40mm_green"
//9. This script was created for use in Iron Front "vanilla" with D-Day DLC. 
//    I do not have the Arma2CO, Arma3CO, or anything else. But it should work in all?
//10. The sound is not necessary and may be removed if desired.

dropAircraft globalChat "Copy, Flare Drop Inbound, Standby.";
dropAircraft globalChat "ETA 60 seconds.";

sleep 60;
for [{_i=0}, {_i<10}, {_i=_i+1}] do
{
  [] execVm 'C47.sqf';
  
  sleep 5;
  for [{_q=0}, {_q<3}, {_q=_q+1}] do
  {
    _chute= createVehicle ["parachutewest", position player, [], 0, "Fly"];
    _chute setpos [(getPos player select 0) + (random 300 - random 300), (getpos player select 1) + (random 300 - random 300), 250];
    _chute setVehicleInit "parachute1 = this"; processInitCommands;
    _litFlare = "F_40mm_white" createVehicle [0, 0, 0];
    _litFlare setPos [(getpos _chute select 0), (getPos _chute select 1)-10, (getPos _chute select 2)-10];
    _litFlare attachto [parachute1, [0, 0, 0]];
    playSound "lib_weapon_rest_off";
    sleep (3 + (random 5) - (random 5));
  };
sleep 20;

};





And here is the code for the C47 script:


Code:

//////////////////////////////////////////////////////////////////
// Partner file for: Simulated Air Drop Flares Sequence for Iron Front Liberation 1944
// Author: Jason126
//////////////////////////////////////////////////////////////////
// See file "contFlareDropWhite.sqf" for description, installation and notes on this script.

_c47plane= createVehicle ["LIB_Li2", position player, [], 0, "Fly"];
_c47plane setpos [(getPos player select 0) + (random 50 - random 50), (getpos player select 1) - (700), 250];
_c47plane setDir (0 +(random  30));

sleep 25;

deleteVehicle _c47plane;

0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.