Pyro05x/airfield control – User

From Bohemia Interactive Community
Jump to navigation Jump to search
http://i.creativecommons.org/l/by-nc-sa/2.5/88x31.png
All work shown here is licensed under a Creative Commons Attribution- NonCommercial-ShareAlike 2.5 License unless otherwise indicated.

This is my most valuable piece of work. I'm polishing this off for the 505 release 1.05 patch this month. Due to the lack of players, this mission is just too big for early release. My editor is configured to use 4-character tab stops. (I don't feel like reformatting it to look correctly on here.)

to do

to do before v1.0 final release

known bugs

High Priority: game locks up (or locks the computer up completely) when outro begins.
  • the specific cause of this is unknown.

I really hate testing and debugging these kinds of bugs.

  • Low Priority: the oil pumps spin once and freeze the duration of the game. no known fix or work-around.

testing

  • switching "move" and "hold" waypoints
  • class-specific equipment on spawn
so far, so good.

features to add

  • better object choice for runway lights.
    • maybe use the particle drop command to do this?
  • begin work on the progress bar HUD element. (v1.1 features may be here sooner than planned)
    • make the box with 25 progress stages.

tweaks

  • weapons crate contents

scheduled for v1.1

  • more buildings and objects
    • sandbags near the landing sites
    • repair stations
    • a power station and power lines
      • destruction of power station results in a low-power state for the runway and hangar lights.
        • add generators. start them when power station gets blown up. if the generators go down, creepy darkness.
    • other industrial buildings
    • maybe another hotel
  • find a way to beautifully display capture progress in a way that does not interfere with game play. (oooo shiny!)
  • rescale the point system
point gain possibly 5 per 10 seconds. both flags are visible when the game starts. when a team gains points the flag will slowly rise from the ground. game ends when the flag hits the top (a score limit set by server (300-2000 range)) or the time limit is reached. the team with the highest flag wins.
  • movement actions and better model choice for the light switches in the hangar
  • put xxxxxx xxxxxxxx or xxxxxxxx xxxxxxxxxx in the xxx xxxxxx.
  • a paradropping system
    • wait 30 seconds after selecting your drop location

ideas for a v1.2 release

  • buildings/environment - complete overhaul
    • a power station and power lines
    • other industrial buildings
    • a well-defined line between residential and industrial areas
    • well-designed residential districts (upper and lower classes)
    • maybe some houses here and there
    • apartment buildings
    • farms?

unlikely ideas

  • JointOps-style PSPs: scattered spawn points that can be captured...this will have to include giving players the ability to choose their spawn points.
The scope of this idea strays from my original dream of a massive, centralized, battle at nightfall. It would have to be in a separate edition of the mission.


features and scripts

counter-measures for choppers

with audible alarm and visual representation of flares with a flickering effect.

onIncomingMissile.sqf

/* onIncomingMissile.sqf * written by pyro05x * * This script alerts the crew of the vehicle if a missile (guided or * unguided) is fired and will most likely hit the vehicle. * * Note: The only global variable required is endGame, which should remain * false until the outro or the debriefing. * * This file and its contents are the property of Cory B. It is licensed * under the Creative Commons Attribution-Noncommercial-Share Alike 2.5 * License. To view a copy of this license, visit * http://creativecommons.org/licenses/by-nc-sa/2.5/ or send a letter to * Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, * 94105, USA. Those wishing to exercise the terms of this license may contact * me (Cory B.) on the Bohemia Interactive Forums which may be found at * http://www.flashpoint1985.com/cgi-bin/ikonboard311/ikonboard.cgi . * Alternatively, I may be contacted by email at * pyro05x[holyATcrap]gmail[omgDOThax]com */ //this addEventHandler ["IncomingMissile", {_this execVM "events\onIncomingMissile.sqf"}]; private ["_conSoundName","_conSoundLength","_conDistance","_conTypes","_conProbN","_conProbD","_target","_type","_missile","_loop","_conProbNa","_i","_misVel","_misSpd","_misPhi","_misTheta","_flickerArray"]; //name of the sound to be played (defined in Description.ext) _conSoundName = "missilewarn"; //length of sound file (seconds) _conSoundLength = 0.242; //distance til the measures affect the missile's direction (meters) _conDistance = 100; //list of ammo types for "smart" projectile _conTypes = ["M_Strela_AA","M_Stinger_AA","M_Javelin_AT","M_Sidewinder_AA","M_R73_AA"]; //probability that the missile will get confused by the flares. this is tested //ten times a second, so keep it less than 1/2. only accepts integers greater //than zero. also, simplify the numbers (ie. 4/10 = 2/5). //(hint: probability = successes / total tests) _conProbN = 1; //numerator _conProbD = 4; //denominator _target = _this select 0; _type = _this select 1; if !(_type in _conTypes) exitWith {echo "onIncomingMissile.sqf aborted at line 45; missile is not a heat-seeker."}; _missile = nearestObject [_this select 2, _type]; sleep 0.001; _type=nil; //if ((_conProbN <= 0) or (_conProbD <= 0) or (_conProbD mod 1 != 0) or (_conProbN mod 1 != 0) or (_conProbN > _conProbD)) exitWith {echo "Error: Expected integer > 0. See events\onIncomingMissile.sqf, lines 34-37."}; //sleep 0.001; spawn { _missile = _missile select 4; if (alive _missile and !endGame) then { (crew _target select 0) vehicleChat "Counter-measures automatically launched."; spawn { //heehee... this array has 200 elements. _flickerArray = [1,5,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2, 2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2, 2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2, 2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2, 2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,2+random 2,0]; for "_i" from 1 to 5 do { drop [ /* ShapeName */ "\ca\data\ParticleEffects\SPARKSEFFECT\SparksEffect", /* AnimationName */ "", /* Type */ "Billboard", /* TimerPeriod */ 0.2, /* LifeTime */ 10, /* Position */ [0,3.5,2.2], /* MoveVelocity */ [5,-2,0], /* RotationVelocity */ 0, /* Weight */ 0.1, /* Volume */ 0.04, /* Rubbing */ 0.2, /* Size */ _flickerArray, /* Color */ [[1,0.6,0.5,1]], /* AnimationPhase */ [], /* RandomDirectionPeriod */ 0, /* RandomDirectionIntensity */ 0, /* OnTimer */ "events\sparklies.sqf", /* BeforeDestroy */ "", /* Object */ _target]; drop [ "\ca\data\ParticleEffects\SPARKSEFFECT\SparksEffect", "", "Billboard", 0.4, 10, [0,3.5,2.2], [-5,-2,0], 0, 0.1, 0.04, 0.2, _flickerArray, [[1,0.6,0.5,1]], [], 0, 0, "events\sparklies.sqf", "", _target]; sleep 0.7; //playSound "click"; }; }; }; while {alive _missile and alive _target and !endGame} do { if (player in (crew _target)) then { playSound _conSoundName; }; sleep _conSoundLength; _missile = _missile select 4; }; }; if (local server) then { _conProbNa = []; for "_i" from 1 to _conProbN do { _conProbNa set [_i-1,_i]; sleep 0.0002; }; _conProbN=nil; //not using waitUntil in this case because it does not update fast enough _loop = true; for [{},{_loop},{_loop=_loop}] do { sleep 0.01; if (!alive _missile) exitWith {echo "onIncomingMissile.sqf aborted at line 141; missile has asploded."}; if (endGame) exitWith {echo "onIncomingMissile.sqf aborted at line 142; game is ending."}; if ((_missile distance _target) < _conDistance) then { _loop = false; }; _missile = _missile select 4; }; _loop=nil; while {(alive _missile) and !endGame} do { _missile = _missile select 4; if (floor(random _conProbD) in _conProbNa) then { _misVel = velocity _missile; _misSpd = 0.277778 * speed _missile; // 1 km/h = 0.277778 m/s sleep 0.001; _misTheta = direction _missile; /* cos(phi) = (Ax*Bx + Az*Bz + Ay*By) / (|A|*|B|) since Ax=Bx and Az=Bz and By=0, substitutions can be made cos(phi) = (Ax^2 + Az^2) / (|A|*sqrt(Ax^2 + Az^2)) u*v/(v^(1/2)) = u*(v^(1/2)) = u*sqrt(v) cos(phi) = sqrt(Ax^2 + Az^2) / |A| phi = arccos( sqrt(Ax^2 + Az^2) / |A| ) */ _misPhi = acos( sqrt((_misVel select 0)^2 + (_misVel select 1)^2) / _misSpd ); sleep 0.001; _misTheta = 1.5 - random(3) + _misTheta; _misPhi = 0 - random(3) + _misPhi; sleep 0.001; // x = r*sin(theta)*cos(phi) y = r*sin(theta)*sin(phi) z = r*cos(theta) _missile setVelocity [_misSpd*sin(_misTheta)*cos(_misPhi), _misSpd*cos(_misTheta), _misSpd*sin(_misTheta)*sin(_misPhi)]; sleep 0.001; _missile setDir _misTheta; _misPhi = _misPhi + 90.0; _missile setVectorUp [sin(_misTheta)*cos(_misPhi), cos(_misTheta), sin(_misTheta)*sin(_misPhi)]; sleep 0.001; } else { sleep 0.005; }; sleep 0.095; }; };

events\sparklies.sqf

/* sparklies.sqf * written by pyro05x * * This script causes sparks to come off of a flare * * This file and its contents are the property of Cory B. It is licensed * under the Creative Commons Attribution-Noncommercial-Share Alike 2.5 * License. To view a copy of this license, visit * http://creativecommons.org/licenses/by-nc-sa/2.5/ or send a letter to * Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, * 94105, USA. Those wishing to exercise the terms of this license may contact * me (Cory B.) on the Bohemia Interactive Forums which may be found at * http://www.flashpoint1985.com/cgi-bin/ikonboard311/ikonboard.cgi . * Alternatively, I may be contacted by email at * pyro05x[holyATcrap]gmail[omgDOThax]com */ drop [ /* ShapeName */ "\ca\data\ParticleEffects\SPARKSEFFECT\SparksEffect", /* AnimationName */ "", /* Type */ "Billboard", /* TimerPeriod */ 1, /* LifeTime */ .2, /* Position */ _this, /* MoveVelocity */ velocity nearestObject _this, /* RotationVelocity */ 1, /* Weight */ 0.007, /* Volume */ 0.004, /* Rubbing */ 0.8, /* Size */ [0.5,0], /* Color */ [[1,.5,0,1]], /* AnimationPhase */ [], /* RandomDirectionPeriod */ 0.04, /* RandomDirectionIntensity */ 2, /* OnTimer */ "", /* BeforeDestroy */ "", /* Object */ ""];

king of the hill

I don't plan on modifying this one any more. Right now, it appears to be a solid script.

events\onPlayerKilled.sqf

/* onPlayerKilled.sqf * written by pyro05x * * This script awards a player points to his score for defending the flag or * assaulting a defender. The result is a larger emphasis on the "King of the * Hill" element of the Capture & Hold gametype. * * I added a few variables that can be easily changed. * * This file and its contents are the property of Cory B. It is licensed * under the Creative Commons Attribution-Noncommercial-Share Alike 2.5 * License. To view a copy of this license, visit * http://creativecommons.org/licenses/by-nc-sa/2.5/ or send a letter to * Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, * 94105, USA. Those wishing to exercise the terms of this license may contact * me (Cory B.) on the Bohemia Interactive Forums which may be found at * http://www.flashpoint1985.com/cgi-bin/ikonboard311/ikonboard.cgi . * Alternatively, I may be contacted by email at * pyro05x[holyATcrap]gmail[omgDOThax]com */ //required public variables: // wOwned (boolean value, true if west owns the flag) // eOwned (boolean value, true if east owns the flag) //player addEventHandler ["killed", {_this execVM "events\onPlayerKilled.sqf"}]; private ["_conAPoint","_conDPoint","_conDist","_objFlag","_zMult","_vic","_vicSide","_perp","_perpSide","_vicXY","_perpXY","_flagZ","_pType","_pPoint"]; //distance in which the victim or the killer must be to receive points. _conDist = 25; //points awarded for assaulting the enemy flag (killing a defender) _conAPoint = 1; //points awarded for defending the flag (killing an attacker) _conDPoint = 1; //reference to the FLAG object _objFlag = baseflag; //calculated Z distance multiplier //this multiplier will modify the how the distance calculator sees the //z-coordinate of a player to change the shape of the flag zone. _zMult = 1; //sphere (default) //_zMult = 2; //squashed sphere //_zMult = 0.5; //extra tall sphere //_zMult = 0; //cylinder /////////////////////////////////////////////////////////////////////////////// ///// CAUTION ////// CAUTION ////// CAUTION ////// CAUTION ////// CAUTION ///// /////////////////////////////////////////////////////////////////////////////// //Modifying the below may cause your system to crash, lock up, overheat, //explode, dissolve, or disappear. I cannot and will not be responsible for //any result due to the ignorance of an individual. _vic = _this select 0; _vicSide = side _vic; _perp = _this select 1; _perpSide = side _perp; sleep 0.01; // teamkills (and civilian kills) don't count! :D if !((_vicSide == west and _perpSide == east) or (_vicSide == east and _perpSide == west)) exitWith {enableEndDialog}; _vicXY = getPosASL _vic; _perpXY = getPosASL _perp; _flagZ = (getPosASL _objFlag) select 2; sleep 0.01; _vicXY set [2, _flagZ + _zMult * ((_vicXY select 2) - _flagZ)]; _perpXY set [2, _flagZ + _zMult * ((_perpXY select 2) - _flagZ)]; sleep 0.01; _vicSide=nil; _flagZ=nil; _zMult=nil; // no points if not in the area if (( (_vicXY distance _objFlag) min (_perpXY distance _objFlag) ) > _conDist) exitWith {enableEndDialog}; sleep 0.01; _vic=nil; _vicXY=nil; _perpXY=nil; _conDist=nil; _objFlag=nil; _pType = "assault"; if ( ((_perpSide == west) and wOwned) or ((_perpSide == east) and eOwned) ) then { _pType = "defense"; }; sleep 0.01; _pPoint = switch (_pType) do { case "assault":{_conAPoint}; case "defense":{_conDPoint}; }; _conAPoint=nil; _conDPoint=nil; if (local server) then { _perp addScore _pPoint; }; _perp sideChat format ["I killed a%1 %2er!", switch (_perpSide) do { case west:{"n OPFOR"}; case east:{" BLUFOR"};}, switch (_pType) do { case "assault":{"attack"}; case "defense":{"defend"};}]; sleep 0.01; _perpSide=nil; if (player == _perp) then { if (_pPoint == 1) then { hint format ["You earned a flag %1 point!", _pType]; } else { if (_pPoint > 0) then { hint format ["You earned %1 flag %2 points!", _pPoint, _pType]; }; }; }; enableEndDialog;

lighting up the runway

The Island of Antigua has a dirt runway on it. I decided to light it up because it looks cool and the mission is at night.

loadScripts\runway.sqf

/* runway.sqf * by pyro05x * * this script lights up the runway on antigua island. Currently it is not as * easy to spot from the air as it should be. * * This file and its contents are the property of Cory B. It is licensed * under the Creative Commons Attribution-Noncommercial-Share Alike 2.5 * License. To view a copy of this license, visit * http://creativecommons.org/licenses/by-nc-sa/2.5/ or send a letter to * Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, * 94105, USA. Those wishing to exercise the terms of this license may contact * me (Cory B.) on the Bohemia Interactive Forums which may be found at * http://www.flashpoint1985.com/cgi-bin/ikonboard311/ikonboard.cgi . * Alternatively, I may be contacted by email at * pyro05x[holyATcrap]gmail[omgDOThax]com */ private ["_i","_x","_y","_dist","_var","_rcos102","_rsin102"]; //distance between each "light" _dist = 15; //I used substitution in the position formulas because it is more efficient. //Although creating over 100 radio towers just for the light on top is not =D //cos(102) = sin(192) //sin(102) = -cos(192) //sin(102) = cos(12) //cos(102) = -sin(12) //_rcos102 = _dist*cos(102); //_rsin102 = _dist*sin(102); _rcos102 = -0.207912 * _dist; _rsin102 = 0.978148 * _dist; for "_i" from 0 to 54 do { //_x = (18213.2+_dist*cos(192)) + (_i*_dist*_cos102); //_y = (17957.3+_dist*sin(192)) + (_i*_dist*_sin102); _x = 18213.2 - _rsin102 + (_i * _rcos102); _y = 17957.3 + _rcos102 + (_i * _rsin102); sleep 0.01; _var = format ["runway%1", _i]; call compile (_var + " = 'Land_radar' createVehicleLocal [_x,_y,0]; " + _var + " setPos [_x,_y,-16.5]"); sleep 0.01; }; for "_i" from 0 to 54 do { //_x = (18213.2+_dist*cos(12)) + (_i*_dist*_cos102); //_y = (17957.3+_dist*sin(12)) + (_i*_dist*_sin102); _x = 18213.2 + _rsin102 + (_i * _rcos102); _y = 17957.3 - _rcos102 + (_i * _rsin102); sleep 0.01; _var = format ["runway%1", _i]; call compile (_var + " = 'Land_radar' createVehicleLocal [_x,_y,0]; " + _var + " setPos [_x,_y,-16.5]"); sleep 0.01; };

awarding points to a player

The file's header explains it quite clearly...

pScore.sqf

/* pScore.sqf * written by pyro05x * * Description: Awards !points! points to player !player! after a !delay! * second delay. * * Syntax: [player, points, delay] execVM "pScore.sqf" * Parameters: player: Object * points: Number (optional, default=1) * delay: Number (optional, default=0.001) * * Example: [this, 2, 0] execVM "pScore.sqf"; * * This file and its contents are the property of Cory B. It is licensed * under the Creative Commons Attribution-Noncommercial-Share Alike 2.5 * License. To view a copy of this license, visit * http://creativecommons.org/licenses/by-nc-sa/2.5/ or send a letter to * Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, * 94105, USA. Those wishing to exercise the terms of this license may contact * me (Cory B.) on the Bohemia Interactive Forums which may be found at * http://www.flashpoint1985.com/cgi-bin/ikonboard311/ikonboard.cgi . * Alternatively, I may be contacted by email at * pyro05x[holyATcrap]gmail[omgDOThax]com */ private ["_player","_pName","_pSide","_points","_delay","_s","_r"]; _player = _this select 0; _pName = name _player; _pSide = side _player; //assign this early in case _player dies during this script. _points = _this select 1; _delay = _this select 2; if isNil("_points") then {_points = 1;}; if isNil("_delay") then {_delay = 0.001;}; _s = ""; if ((name player == _pName) and (_points > 0)) then { if (_points == 1) then { _s = "\n\nGood Job! You were awarded a capture point!"; } else { _s = format ["\n\nGood Job! You were awarded %1 points for flag capture!", _points]; }; }; sleep _delay; _delay=nil; _r = "BLUFOR"; if (_pSide == east) then { _r = "OPFOR"; }; titleText [("\n\n"+_pName+" has captured the flag for the "+_r+" team!"+_s), "plain down"]; _pName=nil; _pSide=nil; _r=nil; _s=nil; if (local server) then { _player addScore _points; };

flag capture progress

The progress is shown in a textual form for now. A dialog box is scheduled for v1.1. I'm still trying to figure out how to create dialogs that do not interfere with game play. Currently, you can't move while a dialog is open.
Starting over on this...

progress.hpp

DELETED!