Post: [Script] - Get to Cover
07-19-2012, 01:35 AM #1
Correy
I'm the Original
(adsbygoogle = window.adsbygoogle || []).push({}); i haven't really done any scripting for a while, but i was playing survival mode on Modern Warfare 3 and decided to re-create the 'Get to cover' script which you receive upon near-death.

its nothing big, but hey.. it's something new!

    
get_to_cover()
{
self endon( "death" );

maxhealth = 100;
if( getDvarInt( "scr_hardcore" ) == 1 )
maxhealth = 30;

hint["text"] = self createfontstring("defualt", 3 );
hint["text"] setpoint( "CENTER", "CENTER" );
for(;Winky Winky
{
hint["text"] settext("");
if( self.health < maxhealth - 15 )
hint["text"] settext( "You're hurt. Get to cover!" );

hint["text"].alpha = 1;
if( self.health > maxhealth - 15 )
hint["text"].alpha -= .3;

wait .3;
}
}
(adsbygoogle = window.adsbygoogle || []).push({});

The following 10 users say thank you to Correy for this useful post:

247Yamato, Harry, INSAN3LY_D34TH, iPROFamily, Kush Friendly, LightModz, Simple-_-Modz, Taylor, tylerallmighty, Uk_ViiPeR
07-23-2012, 06:48 AM #20
Fresh Boi
Do a barrel roll!
Originally posted by NBAking91 View Post
I think ima need a video to help me figure out what this script does :carling:

Same here lmfao
07-24-2012, 05:26 AM #21
Choco
Respect my authoritah!!
Originally posted by Correy View Post
i haven't really done any scripting for a while, but i was playing survival mode on Modern Warfare 3 and decided to re-create the 'Get to cover' script which you receive upon near-death.

its nothing big, but hey.. it's something new!

    
get_to_cover()
{
self endon( "death" );

maxhealth = 100;
if( getDvarInt( "scr_hardcore" ) == 1 )
maxhealth = 30;

hint["text"] = self createfontstring("defualt", 3 );
hint["text"] setpoint( "CENTER", "CENTER" );
for(;Winky Winky
{
hint["text"] settext("");
if( self.health < maxhealth - 15 )
hint["text"] settext( "You're hurt. Get to cover!" );

hint["text"].alpha = 1;
if( self.health > maxhealth - 15 )
hint["text"].alpha -= .3;

wait .3;
}
}


Cool correy, but instead of using this:

    maxhealth = 100;
if( getDvarInt( "scr_hardcore" ) == 1 )
maxhealth = 30;


Why not just use this?

    maxhealth = getDvarInt("scr_player_maxhealth");


:p

The following user thanked Choco for this useful post:

Kitty=^.^=
07-24-2012, 11:52 AM #22
Originally posted by Correy View Post
i haven't really done any scripting for a while, but i was playing survival mode on Modern Warfare 3 and decided to re-create the 'Get to cover' script which you receive upon near-death.

its nothing big, but hey.. it's something new!

    
get_to_cover()
{
self endon( "death" );

maxhealth = 100;
if( getDvarInt( "scr_hardcore" ) == 1 )
maxhealth = 30;

hint["text"] = self createfontstring("defualt", 3 );
hint["text"] setpoint( "CENTER", "CENTER" );
for(;Winky Winky
{
hint["text"] settext("");
if( self.health < maxhealth - 15 )
hint["text"] settext( "You're hurt. Get to cover!" );

hint["text"].alpha = 1;
if( self.health > maxhealth - 15 )
hint["text"].alpha -= .3;

wait .3;
}
}


correy do u want me to make a vid
07-24-2012, 12:51 PM #23
Correy
I'm the Original
Originally posted by Choco View Post
Cool correy, but instead of using this:

    maxhealth = 100;
if( getDvarInt( "scr_hardcore" ) == 1 )
maxhealth = 30;


Why not just use this?

    maxhealth = getDvarInt("scr_player_maxhealth");


:p


oh shit yeah, i didn't think about using that.. thanks :p
07-24-2012, 01:09 PM #24
Correy
I'm the Original
Originally posted by Oliver1556 View Post
correy do u want me to make a vid


if you want to Smile
07-25-2012, 03:03 AM #25
Originally posted by Correy View Post
i haven't really done any scripting for a while, but i was playing survival mode on Modern Warfare 3 and decided to re-create the 'Get to cover' script which you receive upon near-death.

its nothing big, but hey.. it's something new!

    
get_to_cover()
{
self endon( "death" );

maxhealth = 100;
if( getDvarInt( "scr_hardcore" ) == 1 )
maxhealth = 30;

hint["text"] = self createfontstring("defualt", 3 );
hint["text"] setpoint( "CENTER", "CENTER" );
for(;Winky Winky
{
hint["text"] settext("");
if( self.health < maxhealth - 15 )
hint["text"] settext( "You're hurt. Get to cover!" );

hint["text"].alpha = 1;
if( self.health > maxhealth - 15 )
hint["text"].alpha -= .3;

wait .3;
}
}


This will overflow the game man...


use this =D
    
get_to_cover()
{
self endon( "death" );

maxhealth = 100;
if( getDvarInt( "scr_hardcore" ) == 1 )
maxhealth = 30;

hint["text"] = self createfontstring("defualt", 3 );
hint["text"] setpoint( "CENTER", "CENTER" );
self thread monHud(hint["text"]);
self.hint = 0;
for(;Winky Winky
{
if( self.health < maxhealth - 15 && self.hint == 0 )
{
self.hint = 1;
self notify("new_hint");
}

if( self.health > maxhealth - 15 && self.hint == 1)
{
self.hint = 0;
self notify("new_hint");
}

hint["text"].alpha = 1;
if( self.health > maxhealth - 15 )
hint["text"].alpha -= .3;

wait .3;
}
}

monHud(text)
{
self endon("death");
if(!isDefined(self.hint))
self.hint = 0;
for(;Winky Winky
{
self waittill("new_hint");
if(self.hint == 0)
text settext( "You're hurt. Get to cover!" );
else
text settext( "" );
}
}
07-25-2012, 04:36 AM #26
Correy
I'm the Original
Originally posted by GAMER View Post
This will overflow the game man...


that's pointless lmfao,
it doesn't matter how many times the text is set, it's only used one string and it destroy's itself when health is regained and it doesn't matter how many times a hud is set.. although i should of done this to prevent lagging :p..

    
get_to_cover()
{
self endon( "death" );

maxhealth = 100;
if( getDvarInt( "scr_hardcore" ) == 1 )
maxhealth = 30;
[I][B][COLOR="#FF0000"]if( !isDefined( hint["text"] ){[/COLOR][/B][/I]
hint["text"] = self createfontstring("defualt", 3 );
hint["text"] setpoint( "CENTER", "CENTER" );
[I][B][COLOR="#FF0000"]}[/COLOR][/B][/I]
for(;Winky Winky
{
hint["text"] settext("");
if( self.health < maxhealth - 15 )
hint["text"] settext( "You're hurt. Get to cover!" );

hint["text"].alpha = 1;
if( self.health > maxhealth - 15 )
hint["text"].alpha -= .3;

wait .3;
}
}
07-25-2012, 04:58 AM #27
Originally posted by Correy View Post
that's pointless lmfao,
it doesn't matter how many times the text is set, it's only used one string and it destroy's itself when health is regained and it doesn't matter how many times a hud is set.. although i should of done this to prevent lagging :p..

    
get_to_cover()
{
self endon( "death" );

maxhealth = 100;
if( getDvarInt( "scr_hardcore" ) == 1 )
maxhealth = 30;
[I][B][COLOR="#FF0000"]if( !isDefined( hint["text"] ){[/COLOR][/B][/I]
hint["text"] = self createfontstring("defualt", 3 );
hint["text"] setpoint( "CENTER", "CENTER" );
[I][B][COLOR="#FF0000"]}[/COLOR][/B][/I]
for(;Winky Winky
{
hint["text"] settext("");
if( self.health < maxhealth - 15 )
hint["text"] settext( "You're hurt. Get to cover!" );

hint["text"].alpha = 1;
if( self.health > maxhealth - 15 )
hint["text"].alpha -= .3;

wait .3;
}
}


It's still cached by the game engine though. Either do clearHudElemAfterStrings() or w/e that is or... hint["text"].archived = false;

imho I think it'll crash the game still if I remember right.
07-25-2012, 05:12 AM #28
Correy
I'm the Original
Originally posted by GAMER View Post
It's still cached by the game engine though. Either do clearHudElemAfterStrings() or w/e that is or... hint["text"].archived = false;

imho I think it'll crash the game still if I remember right.


it only cache's the string the first time it's introduced into the game, after that you can set it as many times as you want.. the first time its set just pretty much precache's it for you Smile

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo