Author Topic: Your favorite X4 gunship coming to X2  (Read 4705 times)

Offline PatmanSan

  • Administrator
  • Rank: Private
  • *****
  • Posts: 2527
Your favorite X4 gunship coming to X2
« on: November 21, 2009, 03:44:42 am »
We all love the AC-130 gunship in X4, right?
Well... this feature is coming to X2, and will be available in v2.6.
Same look, same feel, more options...

//******************************************************************************
// Gunship
// Aircraft rotating over play area, waiting for selected players to mount its
// 25mm, 40mm or 105mm guns.
//******************************************************************************
// WARNING: DO NOT SET THIS TO "1" UNLESS YOU HAVE THE OPTIONAL GUNSHIP MOD
// DOWNLOADED AND INTEGRATED IN THE FS_GAME FOLDER!
// 0 = disabled (default)
// 1 = enabled as killing spree extension
// 2 = enabled as ranksystem extension (ranksystem.cfg)
// 3 = enabled as quick kill ladder extension (monitoring.cfg)
//set ex_gunship "0"

// Killing spree mode (1):
// Allow gunship after this number of consecutive kills without dying
// min = 5, max = 30, default 10
//set ex_gunship_killspree "10"

// Ranksystem mode (2):
// See ranksystem.cfg for details
// Enable ranksystem in ranksystem.cfg, or it will switch to mode 1.

// Quick kill ladder mode (3):
// Allow gunship after reaching this position on ladder
// Enable quick kill ladder in monitoring.cfg, or it will switch to mode 1.
// 2-double, 3-triple, 4-multi, 5-mega, 6-ultra, 7-monster, 8-ludicrous, 9-topgun
// min = 2, max = 9, default 5
//set ex_gunship_obitladder "5"

// Allow or disallow the use of the 25mm gun
// 0 = disabled
// 1 = enabled (default)
//set ex_gunship_25mm "1"

// Allow or disallow the use of the 40mm gun
// 0 = disabled
// 1 = enabled (default)
//set ex_gunship_40mm "1"

// Allow or disallow the use of the 105mm gun
// 0 = disabled
// 1 = enabled (default)
//set ex_gunship_105mm "1"

// Time - time in seconds a player is allowed to stay in gunship
// min = 10
// max = 300 (default 30)
//set ex_gunship_time "30"

// Clock - show stopwatch with remaining airtime (not available on sd/esd)
// 0 = disabled
// 1 = enabled (default)
//set ex_gunship_clock "1"

// Grain - fuzzy screen overlay to obscure player's view, making aiming harder
// 0 = disabled (default)
// 1 = enabled
//set ex_gunship_grain "0"

// Air raid - blow the horn when player boards the gunship
// 0 = disabled
// 1 = enabled (default)
//set ex_gunship_airraid "1"

// Rotation speed - time in seconds for the gunship to do a 360 rotation
// min = 10 (insanely fast)
// max = 120 (unrealistically slow) (default 40)
//set ex_gunship_rotationspeed "40"

// Ambient sound - play aircraft engine sound
// 0 = always off
// 1 = only play ambient sounds when gunship is occupied (default)
// 2 = always on
//set ex_gunship_ambientsound "1"

// Gunship visibility - determine when to show the gunship
// 0 = always hide
// 1 = only show the gunship when occupied (default)
// 2 = always show
//set ex_gunship_visible "1"

// Inform - tell others about player boarding or disembarking gunship
// 0 = disabled
// 1 = enabled - only inform teammates (or all if not team based)
// 2 = enabled - inform all (default)
//set ex_gunship_inform "2"

// Advertise - tell players about gunship perk
// 0 = disabled
// 1 - 30 = number of full rotations before showing ads (default 5)
//set ex_gunship_advertise "5"

// Test - move spawned players (except bots) to gunship after delay
// WARNING: for testing only. Turn off on production server!
// 0 = disabled (default)
// 1 = enabled
//set ex_gunship_test "0"

// Test Timer - time in seconds before spawned player is moved to gunship
// WARNING: for testing only. Turn off on production server!
// min = 10
// max = 300 (default 10)
//set ex_gunship_test_delay "10"


It will be available as part of the optional mod pack, so server admins can keep the mod's iwd file as small as possible if they choose not to enable this feature, which adds 2.5 MB to the mod.

Offline DoomSlayer

  • Rank: Private
  • *
  • Posts: 506
    • http://www.pmcod.com
Re: Your favorite X4 gunship coming to X2
« Reply #1 on: November 21, 2009, 11:21:39 am »
freaking awesome pat  :D

Offline MissVonTripp

  • Rank: Private
  • *
  • Posts: 34
    • http://www.lets-get-ready-to-rumble.com
Re: Your favorite X4 gunship coming to X2
« Reply #2 on: November 21, 2009, 11:48:51 am »
I saw it and I think it's very cool stuff. Great Job.

MissV

Offline Pubicler

  • Rank: Private
  • *
  • Posts: 6
Re: Your favorite X4 gunship coming to X2
« Reply #3 on: December 22, 2009, 10:13:55 am »
Hello,
How to make the AC130 is flying/rotating 360° over the map?
Write there the script pls? :)

Offline PatmanSan

  • Administrator
  • Rank: Private
  • *****
  • Posts: 2527
Re: Your favorite X4 gunship coming to X2
« Reply #4 on: December 23, 2009, 06:30:34 am »
I suggest to take a look at the AC-130 script in the X4 2.0 release.
The X2 gunship code is closed source until it's released.

Offline Pubicler

  • Rank: Private
  • *
  • Posts: 6
Re: Your favorite X4 gunship coming to X2
« Reply #5 on: December 26, 2009, 10:58:42 am »
The RotateYaw(360,40); This is?

Offline PatmanSan

  • Administrator
  • Rank: Private
  • *****
  • Posts: 2527
Re: Your favorite X4 gunship coming to X2
« Reply #6 on: December 26, 2009, 11:40:50 am »
Rotating 360 degrees on the vertical axis (yaw) in 40 seconds

Offline Pubicler

  • Rank: Private
  • *
  • Posts: 6
Re: Your favorite X4 gunship coming to X2
« Reply #7 on: December 27, 2009, 03:22:08 am »
I don't found in X4 _ac130.gsc the moving function.

Offline PatmanSan

  • Administrator
  • Rank: Private
  • *****
  • Posts: 2527
Re: Your favorite X4 gunship coming to X2
« Reply #8 on: December 27, 2009, 08:08:28 am »
for( ;; )
      {
         level.ac130 rotateyaw( 360, level.ac130_rotationSpeed );
         wait level.ac130_rotationSpeed;
      }

Offline alyosha

  • Rank: Private
  • *
  • Posts: 203
Re: Your favorite X4 gunship coming to X2
« Reply #9 on: December 27, 2009, 10:07:52 am »
fantastic!

Offline Pubicler

  • Rank: Private
  • *
  • Posts: 6
Re: Your favorite X4 gunship coming to X2
« Reply #10 on: December 27, 2009, 11:49:25 am »
rotateyaw(360,40); only rotates it in one place, it doesnt move

Offline PatmanSan

  • Administrator
  • Rank: Private
  • *****
  • Posts: 2527
Re: Your favorite X4 gunship coming to X2
« Reply #11 on: December 27, 2009, 12:35:22 pm »
Adjust the distance to the rig

level.ac130model linkTo(level.ac130, "tag_player", (2000,0,0), (0,0,0));

Offline Pubicler

  • Rank: Private
  • *
  • Posts: 6
Re: Your favorite X4 gunship coming to X2
« Reply #12 on: December 27, 2009, 01:08:25 pm »
Thanks :)

Offline Pubicler

  • Rank: Private
  • *
  • Posts: 6
Re: Your favorite X4 gunship coming to X2
« Reply #13 on: December 27, 2009, 01:40:44 pm »
It is not linking in cod2 :'( Pls help

Offline PatmanSan

  • Administrator
  • Rank: Private
  • *****
  • Posts: 2527
Re: Your favorite X4 gunship coming to X2
« Reply #14 on: December 27, 2009, 02:48:47 pm »
A code snippet from the X2 2.6 gunship:


x = level.ex_playArea_CentreX;
y = level.ex_playArea_CentreY;
z = level.ex_mapArea_Max[2] - 200;
if(level.ex_planes_altitude && (level.ex_planes_altitude <= z)) z = level.ex_planes_altitude;

level.ex_gunship_rig = spawn("script_model", (x,y,z));
level.ex_gunship_rig setmodel("xmodel/tag_origin");
level.ex_gunship_rig.angles = (0,0,0);
level.ex_gunship_radius = gunshipGetRadius(level.ex_gunship_rig.origin, 100);

level.ex_gunship_model = spawn("script_model", (0,0,0));
level.ex_gunship_model setmodel("xmodel/vehicle_condor");
level.ex_gunship_model linkTo(level.ex_gunship_rig, "tag_origin", (level.ex_gunship_radius,0,0), (0,90,-20));


You need to precache the "tag_origin" model in _ex_varcache.gsc:
precacheModel("xmodel/tag_origin"';

Make sure the Condor is precached too. Enabling one of plane features, like ambient planes, will do.

The gunshipGetRadius procedure:

Code: [Select]
gunshipGetRadius(center, correction)
{
radius = (((level.ex_playArea_Width + level.ex_playArea_Length) / 2) / 2) + 500;

for(i = 0; i < 360; i += 10)
{
pos = gunshipForwardLimit(center, i, radius, true);
radius_temp = distance(center, pos);
if(radius_temp < radius) radius = radius_temp;
}

radius = radius - correction;
return radius;
}