Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
0 Active | 46 Guests
Online:

LATEST FORUM THREADS

»
CoD: Battle Royale
CoD+UO Map + Mod Releases
Damaged .pk3's
CoD Mapping
heli to attack ai
CoD4 SP Mapping

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty 4
Category: CoD4 SP Mapping
CoD 4 mapping and level design for single player.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername, novemberdobby
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked subscribe
Author Topic: small help
voidsource
General Member
Since: May 5, 2007
Posts: 1513
Last: Sep 1, 2013
[view latest posts]
Level 8
Category: CoD4 SP Mapping
Posted: Friday, Apr. 22, 2011 06:16 am


video above shows my change in helicopters. now i am using a helicopter like the one in the mission "airlift" with the turret, but cant seem to get the script to properly get the hud to update. please help this is the stuff im using( all of it came from the airlift.gsc ):

Code:

#include maps\_anim;

#include maps\_utility;

#include maps\_hud_util;

#include common_scripts\utility;


seaknight_main()
{
	if( !isdefined( self ) )
		return;
	
	self handle_inits();

}

handle_inits()
{
	self thread seaknight_turret_anim_init();
	self thread seaknight_anims();
	self.animname = "seaknight";
	self assign_animtree();
	//self setmaxpitchroll( 5, 10 );
	//self sethoverparams( 32, 10, 3 );
}

seaknight_turret_test()
{
	while( !isdefined( level.cobraWingman ) )
		wait (0.05);
	
	eTarget = level.cobraWingman;
	
	iFireTime = weaponfiretime("seaknight_mark19");
	while ( true )
	{
		targetLoc = eTarget.origin;
		self setTurretTargetVec(targetLoc);
		fRand = ( randomfloatrange(2, 3));
		self waittill_notify_or_timeout( "turret_rotate_stopped", fRand );
		self fireWeapon();
		wait( 2 );
	}


}


seaknight_turret_think()
{
	// self == > the player seaknight
	level.playerInSeaknight = true;
	
	/*-----------------------
	SETUP TURRET
	-------------------------*/	
	sTag = "tag_player";	
	orgOffset = ( 15, 0, -10 );
	angOffset = ( 0, 0, 0 );
	level.TempTurretOrg = spawn( "script_origin", ( 0, 0, 0 ) );
	level.TempTurretOrg.angles = self.angles;
	level.TempTurretOrg linkto( self, sTag, orgOffset, angOffset );
	
	//seaknight_player_mount_gun();
}

seaknight_fire_turret()
{
	level endon( "player_off_turret" );
	
	iFireTime = weaponfiretime( "seaknight_mark19" );
	while ( true )
	{
		self waittill( "turret_fire" );
		self fireWeapon();
		self thread seaknight_turret_anim();
		earthquake( 0.25, .13, level.player.origin, 200);
		
		if (self.turretOverheat == true)
		{
			self.turret_heat_status += int(self.turret_heat_max / self.turret_heat_maxshots);
			thread seaknight_overheat_overheated( self );
			thread seaknight_overheat_hud_update();
		}
	}
}

seaknight_overheat_enable()
{
	self.turret_heat_status = 1;
	self.turretOverheat = true;
	thread seaknight_overheat_hut();
}

seaknight_overheat_disable()
{
	self.turretOverheat = false;
	level notify ("disable_overheat");
	level.savehere = undefined;
	
	waittillframeend;
	
	if (isdefined(level.overheat_bg))
		level.overheat_bg destroy();
	if (isdefined(level.overheat_status))
		level.overheat_status destroy();
	if (isdefined(level.overheat_status2))
		level.overheat_status2 destroy();
	if (isdefined(level.overheat_flashing))
		level.overheat_flashing destroy();
}

seaknight_overheat_overheated( eVehicle )
{
	level endon ("disable_overheat");
	if (self.turret_heat_status <= self.turret_heat_max)
		return;
	
	level.savehere = false;
	level.player thread play_sound_on_entity ("smokegrenade_explode_default");
	eVehicle thread seaknight_overheat_fx();
	thread seaknight_overheat_fx();
	
	level.overheat_flashing.alpha = 1;
	level.overheat_status.alpha = 0;
	level.overheat_status2.alpha = 0;
	
	level notify ("stop_overheat_drain");
	self.turret_heat_status = self.turret_heat_max;
	thread seaknight_overheat_hud_update();
	
	for (i=0;i<4;i++)
	{
		level.overheat_flashing fadeovertime(0.5);
		level.overheat_flashing.alpha = 0.5;
		wait 0.5;
		level.overheat_flashing fadeovertime(0.5);
		level.overheat_flashing.alpha = 1.0;
	}
	level.overheat_flashing fadeovertime(0.5);
	level.overheat_flashing.alpha = 0.0;
	level.overheat_status.alpha = 1;
	wait 0.5;
	
	thread seaknight_overheat_hud_drain();
	
	wait 2;
	level.savehere = undefined;
	eVehicle notify("stop_overheatfx");
}

seaknight_overheat_fx()
{
	level endon ("disable_overheat");
	self endon ("stop_overheatfx");
	for (;;)
	{
		playfxOnTag( getfx( "turret_overheat_haze" ), self, "tag_flash");
		playfxOnTag( getfx( "turret_overheat_smoke" ), self, "tag_flash");
		wait .05;
	}
}

seaknight_overheat_hud_update()
{
	level endon ("disable_overheat");
	level notify ("stop_overheat_drain");
	
	if ( (self.turret_heat_status > 1) && ( isdefined( level.overheat_status.alpha ) ) )
		level.overheat_status.alpha = 1;
	
	if (isdefined(level.overheat_status2))
	{
		level.overheat_status2.alpha = 1;
		level.overheat_status2 setShader("white", 10, int(self.turret_heat_status));
		level.overheat_status scaleovertime( 0.05, 10, int(self.turret_heat_status));
	}
	
	//set color of bar
	seaknight_overheat_setColor(self.turret_heat_status);
	
	wait 0.05;
	if (isdefined(level.overheat_status2))
		level.overheat_status2.alpha = 0;
	if (self.turret_heat_status < self.turret_heat_max)
		thread seaknight_overheat_hud_drain();
}

seaknight_overheat_setColor(value, fadeTime)
{
	level endon ("disable_overheat");
	
	//define what colors to use
	color_cold = [];
	color_cold[0] = 1.0;
	color_cold[1] = 0.9;
	color_cold[2] = 0.0;
	color_warm = [];
	color_warm[0] = 1.0;
	color_warm[1] = 0.5;
	color_warm[2] = 0.0;
	color_hot = [];
	color_hot[0] = 0.9;
	color_hot[1] = 0.16;
	color_hot[2] = 0.0;
	
	//default color
	SetValue = [];
	SetValue[0] = color_cold[0];
	SetValue[1] = color_cold[1];
	SetValue[2] = color_cold[2];
	
	//define where the non blend points are
	cold = 0;
	warm = (self.turret_heat_max / 2);
	hot = self.turret_heat_max;
	
	iPercentage = undefined;
	difference = undefined;
	increment = undefined;
	
	if ( (value > cold) && (value <= warm) )
	{
		iPercentage = int(value * (100 / warm));
		for ( colorIndex = 0 ; colorIndex < SetValue.size ; colorIndex++ )
		{
			difference = (color_warm[colorIndex] - color_cold[colorIndex]);
			increment = (difference / 100);
			SetValue[colorIndex] = color_cold[colorIndex] + (increment * iPercentage);
		}
	}
	else if ( (value > warm) && (value <= hot) )
	{
		iPercentage = int( (value - warm) * (100 / (hot - warm) ) );
		for ( colorIndex = 0 ; colorIndex < SetValue.size ; colorIndex++ )
		{
			difference = (color_hot[colorIndex] - color_warm[colorIndex]);
			increment = (difference / 100);
			SetValue[colorIndex] = color_warm[colorIndex] + (increment * iPercentage);
		}
	}
	
	if (isdefined(fadeTime))
		level.overheat_status fadeOverTime(fadeTime);
	
	level.overheat_status.color = (SetValue[0], SetValue[1], SetValue[2]);
	level.overheat_status2.color = (SetValue[0], SetValue[1], SetValue[2]);
}

seaknight_overheat_hud_drain()
{
	level endon ("disable_overheat");
	level endon ("stop_overheat_drain");
	
	waitTime = 1.0;
	for (;;)
	{
		if ( (self.turret_heat_status > 1) && ( isdefined( level.overheat_status.alpha ) ) )
			level.overheat_status.alpha = 1;
		
		value = self.turret_heat_status - self.turret_cooldownrate;
		thread seaknight_overheat_status_rampdown(value, waitTime);
		if (value < 1)
			value = 1;
		level.overheat_status scaleovertime( waitTime, 10, int(value) );
		seaknight_overheat_setColor(self.turret_heat_status, waitTime);
		wait waitTime;
		
		if (self.turret_heat_status <= 1)
			level.overheat_status.alpha = 0;
	}
}

seaknight_overheat_status_rampdown(targetvalue, time)
{
	level endon ("disable_overheat");
	level endon ("stop_overheat_drain");
	
	frames = (20 * time);
	difference = (self.turret_heat_status - targetvalue);
	frame_difference = (difference / frames);
	
	for (i=0;i<frames;i++)
	{
		self.turret_heat_status -= frame_difference;
		if (self.turret_heat_status < 1)
		{
			self.turret_heat_status = 1;
			return;
		}
		wait 0.05;
	}
}

seaknight_overheat_hut()
{
	level endon ("disable_overheat");
	if (!isdefined(level.overheat_bg))
	{
		level.overheat_bg = newhudelem();
		level.overheat_bg.alignX = "right";
		level.overheat_bg.alignY = "bottom";
		level.overheat_bg.horzAlign = "right";
		level.overheat_bg.vertAlign = "bottom";
		level.overheat_bg.x = 2;
		level.overheat_bg.y = -120;
		level.overheat_bg setShader("hud_temperature_gauge", 35, 150);
		level.overheat_bg.sort = 4;
	}
	
	barX = -10;
	barY = -152;
	
	//status bar
	if (!isdefined(level.overheat_status))
	{
		level.overheat_status = newhudelem();
		level.overheat_status.alignX = "right";
		level.overheat_status.alignY = "bottom";
		level.overheat_status.horzAlign = "right";
		level.overheat_status.vertAlign = "bottom";
		level.overheat_status.x = barX;
		level.overheat_status.y = barY;
		level.overheat_status setShader("white", 10, 0);
		level.overheat_status.color = (1,.9,0);
		level.overheat_status.alpha = 0;
		level.overheat_status.sort = 1;
	}
	
	//draw fake bar to cover up a hitch
	if (!isdefined(level.overheat_status2))
	{
		level.overheat_status2 = newhudelem();
		level.overheat_status2.alignX = "right";
		level.overheat_status2.alignY = "bottom";
		level.overheat_status2.horzAlign = "right";
		level.overheat_status2.vertAlign = "bottom";
		level.overheat_status2.x = barX;
		level.overheat_status2.y = barY;
		level.overheat_status2 setShader("white", 10, 1);
		level.overheat_status2.color = (1,.9,0);
		level.overheat_status2.alpha = 0;
		level.overheat_status.sort = 2;
	}
	
	if (!isdefined(level.overheat_flashing))
	{
		level.overheat_flashing = newhudelem();
		level.overheat_flashing.alignX = "right";
		level.overheat_flashing.alignY = "bottom";
		level.overheat_flashing.horzAlign = "right";
		level.overheat_flashing.vertAlign = "bottom";
		level.overheat_flashing.x = barX;
		level.overheat_flashing.y = barY;
		level.overheat_flashing setShader("white", 10, self.turret_heat_max);
		level.overheat_flashing.color = (.8,.16,0);
		level.overheat_flashing.alpha = 0;
		level.overheat_status.sort = 3;
	}
}


seaknight_player_mount_gun( lerp )
{
	//flag_wait( "difficulty_initialized" );
	//thread player_invulnerable_time_tweak();
	
	level.mortarMaxInterval = 1;
	level.mortar_max_dist = 4000;
	level.mortarWithinFOV = "35";
	
	self.turretOverheat = false;
	self.turret_heat_status = 1;
	self.turret_heat_max = 114;
	self.turret_heat_maxshots = 114;
	self.turret_cooldownrate = 5;
	level.allCarsDamagedByPlayer = true;
	level.dontReviveHud = true;
	level.mortarWithinFOV = undefined;
	level.playerMortarFovOffset = ( 0, 40, 0 );
	level.traceHeight = 50;
	level.grenadeToggle = 0;
	level.playerInSeaknight = false;
	level.zpuBlastRadius = 384;
	level.section = undefined;
	level.onMark19 = false;
	level.physicsSphereRadius = 300;
	level.physicsSphereForce = 1.0;
	level.CannonRange = 5000;
	level.CannonRangeSquared = level.CannonRange * level.CannonRange;
	level.crewchiefRange = 256;
	level.crewchiefRangeSquared = level.crewchiefRange * level.crewchiefRange;
	level.hitsToDestroyT72 = 4;
	level.hitsToDestroyBMP = 2;
	level.cosine = [];
	level.cosine[ "15" ] = cos( 15 );
	level.cosine[ "20" ] = cos( 20 );
	level.cosine[ "25" ] = cos( 25 );
	level.cosine[ "30" ] = cos( 30 );
	level.cosine[ "35" ] = cos( 35 );
	level.cosine[ "40" ] = cos( 40 );
	level.cosine[ "45" ] = cos( 45 );
	level.cosine[ "55" ] = cos( 55 );
	
	level thread seaknight_overheat_enable();
	
	level.onMark19 = true;
	thread hud_hide( true );
	
   	level.player allowprone( false );
   	level.player allowcrouch( false );
	
    thread shotFired();
    thread view_kick_change();
    
    if( isdefined( lerp ) )
    {
    	level.player disableWeapons();
    	self lerp_player_view_to_tag( "tag_player", 1, 1, 0,0,0,0 );
    }

	self useby( level.player );
	self thread seaknight_fire_turret();   	

	tagAngles = self gettagangles( "tag_player" );
	level.player setplayerangles(tagAngles + ( 0, 0, 0 ) );

}

view_kick_change()
{
	old_bg_viewKickScale = getdvar( "bg_viewKickScale" ); 	//0.8
	old_bg_viewKickMax = getdvar( "bg_viewKickMax" );		//90
	old_bg_viewKickMin = getdvar( "bg_viewKickMin" );		//5
	old_bg_viewKickRandom = getdvar( "bg_viewKickRandom" );	//0.4

	setsaveddvar( "bg_viewKickScale", 0.3 );
	setsaveddvar( "bg_viewKickMax", "20" );
	
	level waittill( "player_off_turret" );

	setsaveddvar( "bg_viewKickScale", old_bg_viewKickScale );
	setsaveddvar( "bg_viewKickMax", old_bg_viewKickMax );
	setsaveddvar( "bg_viewKickMin", old_bg_viewKickMin );
	setsaveddvar( "bg_viewKickRandom", old_bg_viewKickRandom );	
}

shotFired()
{
	level endon( "player_off_turret" );
	for (;;)
	{
		self waittill( "projectile_impact", weaponName, position, radius );
		if ( getdvar( "ragdoll_deaths" ) == "1" )
			thread shotFiredPhysicsSphere( position );
		wait 0.05;
	}
}

shotFiredPhysicsSphere( center )
{
	wait 0.1;
	physicsExplosionSphere( center, level.physicsSphereRadius, level.physicsSphereRadius / 2, level.physicsSphereForce );
}

hud_hide( state )
{
	wait 0.05;
	if ( state )
	{
		setsaveddvar( "ui_hidemap", 1 );
		SetSavedDvar( "hud_showStance", "0" );
		SetSavedDvar( "compass", "0" );
		SetSavedDvar( "ammoCounterHide", "1" );
	}
	
	else
	{
		setsaveddvar( "ui_hidemap", 0 );
		setSavedDvar( "hud_drawhud", "1" );	
		SetSavedDvar( "hud_showStance", "1" );
		SetSavedDvar( "compass", "1" );
		SetSavedDvar( "ammoCounterHide", "0" );
	}
}

seaknight_player_dismount_gun()
{

	level.mortarMaxInterval = undefined;
	level.mortar_max_dist = undefined;
	level.mortarWithinFOV = undefined;
	level.playerInSeaknight = false;
	level.onMark19 = false;
		
	thread hud_hide( false );
	level notify( "player_off_turret" );
	level thread seaknight_overheat_disable();

	self useby (level.player);
	level.player unlink();
	level.player playerlinktodelta( self, "tag_player", 1, 50, 50, 30, 45 );
	wait .05;
	self seaknight_turret_reset();
	self lerp_player_view_to_tag( "tag_turret_exit", 1, 0.9, 25, 25, 45, 0 );
    level.player unlink();
    level.player enableWeapons();

	//level.player DisableInvulnerability();
   	level.player allowprone( true );
   	level.player allowcrouch( true );
   	//thread seaknight_player_triggers();
	level notify ( "player_dismounted_from_gun" );
}

seaknight_turret_reset()
{
	angles = self gettagangles( "tag_player" );
	forward = anglestoforward( angles );
	vec = vectorscale( forward, 5000 );
	self SetTurretTargetVec( vec );
}

/***************************************************************************************************************
***************************************************************************************************************
		seaknight anims
***************************************************************************************************************
***************************************************************************************************************/

#using_animtree( "vehicles" );
seaknight_anims()
{
	level.scr_anim[ "seaknight" ][ "idle" ][ 0 ] 				= %sniper_escape_ch46_idle;
	level.scr_anim[ "seaknight" ][ "landing" ] 					= %sniper_escape_ch46_land;
	level.scr_anim[ "seaknight" ][ "take_off" ] 				= %sniper_escape_ch46_take_off;
	level.scr_anim[ "seaknight" ][ "rotors" ]					= %sniper_escape_ch46_rotors;
	level.scr_anim[ "seaknight" ][ "turret_settle_anim" ]		= %ch46_turret_idle;
	level.scr_anim[ "seaknight" ][ "turret_fire_anim" ]			= %ch46_turret_fire;
	level.scr_anim[ "seaknight" ][ "doors_open" ]				= %ch46_doors_open;
	
	
	level.scr_animtree[ "seaknight" ] 							= #animtree;
}

seaknight_turret_anim_init()
{
	self useanimtree( #animtree );
	self setanim( %ch46_turret_idle );
	self setanim( %ch46_doors_close );
	
}

seaknight_turret_anim()
{
	self endon ( "death" );
	self endon ( "turret_fire" );
	self useanimtree( #animtree );
	self setanimknobrestart( %ch46_turret_fire, 1, 0, 1 );
}

seaknight_open_doors()
{
	self useanimtree( #animtree );
	self playsound ( "seaknight_door_open" );
	self setanimknobrestart( %ch46_doors_open, 1, 0, 1 );
	//self thread maps\_vehicle_aianim::setanimrestart_once( %ch46_doors_open, false );
}
	
seaknight_close_doors()
{
	self useanimtree( #animtree );
	self playsound ( "seaknight_door_close" );
	self setanimknobrestart( %ch46_doors_close, 1, 0, 1 );
	//self thread maps\_vehicle_aianim::setanimrestart_once( %ch46_doors_close, false );
}





all help is appreciated, i have place this script on its on gsc and plan to later release it like so just gotta work out that hud kink. any help greatly appreciated.

edited on Apr. 22, 2011 11:19 am by voidsource
Share |
voidsource
General Member
Since: May 5, 2007
Posts: 1513
Last: Sep 1, 2013
[view latest posts]
Level 8
Category: CoD4 SP Mapping
Posted: Friday, Apr. 22, 2011 03:41 pm
anyone tested the script?[confused]
Share |
Pablo_Abruzzi
General Member
Since: Jan 30, 2010
Posts: 93
Last: Aug 10, 2011
[view latest posts]
Level 3
Category: CoD4 SP Mapping
Posted: Sunday, Apr. 24, 2011 07:07 am
I didn't test it, cause i'm busy, but i think u can try add this to ur map:

Code:
precacheShader( "hud_temperature_gauge" );


For minigun it was important. Try it.
Share |
voidsource
General Member
Since: May 5, 2007
Posts: 1513
Last: Sep 1, 2013
[view latest posts]
Level 8
Category: CoD4 SP Mapping
Posted: Sunday, Apr. 24, 2011 11:09 am
that is already added in there when i added the minigun so thats fine.
Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Call of Duty 4 : CoD4 SP Mapping

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»