From 7aef080d9426c28206fa8d7b31d5628713be3325 Mon Sep 17 00:00:00 2001 From: INeedBots Date: Sun, 27 Sep 2020 12:26:38 -0600 Subject: [PATCH] flares and health --- userraw/maps/mp/killstreaks/_helicopter.gsc | 71 +++++++++++++++++---- 1 file changed, 59 insertions(+), 12 deletions(-) diff --git a/userraw/maps/mp/killstreaks/_helicopter.gsc b/userraw/maps/mp/killstreaks/_helicopter.gsc index 5b76f56..2ed7e16 100644 --- a/userraw/maps/mp/killstreaks/_helicopter.gsc +++ b/userraw/maps/mp/killstreaks/_helicopter.gsc @@ -10,12 +10,30 @@ - scr_helicopter_cobra_duration 40.0 - (default) the amount in seconds the helicopter will fly around for + - scr_helicopter_cobra_num_flares + 0 - (default) the number of flares on this helicopter + + - scr_helicopter_cobra_health + 1500 - (default) the amount of health on this helicopter + - scr_helicopter_pavelow_duration 60.0 - (default) the amount in seconds the helicopter will fly around for + - scr_helicopter_pavelow_num_flares + 1 - (default) the number of flares on this helicopter + + - scr_helicopter_pavelow_health + 3000 - (default) the amount of health on this helicopter + - scr_helicopter_apache_duration 40.0 - (default) the amount in seconds the helicopter will fly around for + - scr_helicopter_apache_num_flares + 1 - (default) the number of flares on this helicopter + + - scr_helicopter_apache_health + 1500 - (default) the amount of health on this helicopter + Thanks: H3X1C, Emosewaj */ @@ -59,11 +77,25 @@ init() setDvarIfUninitialized( "scr_helicopter_pavelow_duration", 60 ); setDvarIfUninitialized( "scr_helicopter_apache_duration", 40 ); + setDvarIfUninitialized( "scr_helicopter_cobra_num_flares", 0 ); + setDvarIfUninitialized( "scr_helicopter_cobra_health", 1500 ); + setDvarIfUninitialized( "scr_helicopter_pavelow_num_flares", 1 ); + setDvarIfUninitialized( "scr_helicopter_pavelow_health", 3000 ); + setDvarIfUninitialized( "scr_helicopter_apache_num_flares", 1 ); + setDvarIfUninitialized( "scr_helicopter_apache_health", 1500 ); + level.helicopter_allowQueue = getDVarInt("scr_helicopter_allowQueue"); level.cobra_duration = getDvarFloat( "scr_helicopter_cobra_duration" ); level.pavelow_duration = getDvarFloat( "scr_helicopter_pavelow_duration" ); level.apache_duration = getDvarFloat( "scr_helicopter_apache_duration" ); + level.cobra_flares = getDVarInt("scr_helicopter_cobra_num_flares"); + level.cobra_health = getDVarInt("scr_helicopter_cobra_health"); + level.pavelow_flares = getDVarInt("scr_helicopter_pavelow_num_flares"); + level.pavelow_health = getDVarInt("scr_helicopter_pavelow_health"); + level.apache_flares = getDVarInt("scr_helicopter_apache_num_flares"); + level.apache_health = getDVarInt("scr_helicopter_apache_health"); + // array of paths, each element is an array of start nodes that all leads to a single destination node level.heli_start_nodes = getEntArray( "heli_start", "targetname" ); assertEx( level.heli_start_nodes.size, "No \"heli_start\" nodes found in map!" ); @@ -759,18 +791,24 @@ heli_think( lifeId, owner, startnode, heli_team, heliType ) chopper.owner = owner; if ( heliType == "flares" ) - chopper.maxhealth = level.heli_maxhealth*2; // max health + chopper.maxhealth = level.pavelow_health; + else if ( heliType == "minigun" ) + chopper.maxhealth = level.apache_health; else - chopper.maxhealth = level.heli_maxhealth; // max health + chopper.maxhealth = level.cobra_health; chopper.targeting_delay = level.heli_targeting_delay; // delay between per targeting scan - in seconds chopper.primaryTarget = undefined; // primary target ( player ) chopper.secondaryTarget = undefined; // secondary target ( player ) chopper.attacker = undefined; // last player that shot the helicopter chopper.currentstate = "ok"; // health state - - if ( heliType == "flares" || heliType == "minigun" ) - chopper thread heli_flares_monitor(); + + if ( heliType == "flares" ) + chopper thread heli_flares_monitor(level.pavelow_flares); + else if ( heliType == "minigun" ) + chopper thread heli_flares_monitor(level.apache_flares); + else + chopper thread heli_flares_monitor(level.cobra_flares); // helicopter loop threads chopper thread heli_leave_on_disconnect( owner ); @@ -2220,26 +2258,35 @@ deployFlares() } -heli_flares_monitor() +heli_flares_monitor(numFlares) { level endon ( "game_ended" ); for ( ;; ) { + if (!numFlares) + return; + level waittill ( "stinger_fired", player, missile, lockTarget ); if ( !IsDefined( lockTarget ) || (lockTarget != self) ) continue; - missile endon ( "death" ); - - self thread playFlareFx(); - newTarget = self deployFlares(); - missile Missile_SetTargetEnt( newTarget ); - return; + numFlares--; + self thread misguideRocket(missile); } } +misguideRocket(missile) +{ + level endon ( "game_ended" ); + missile endon ( "death" ); + + self thread playFlareFx(); + newTarget = self deployFlares(); + missile Missile_SetTargetEnt( newTarget ); +} + deleteAfterTime( delay ) { wait ( delay );