UGX-Mods

Call of Duty 5: World at War => Tutorial Desk => Scripting => Topic started by: HitmanVere on May 25, 2016, 08:18:19 am

Title: [Tutorial] "Custom" iPrintLnBold using HUD elements + randomized print function
Post by: HitmanVere on May 25, 2016, 08:18:19 am
Got bored, decided to release this, as some people might find it useful. Yes, I know its easy to do yourself. Yes, I know there are better ways.
Just something better to use rather than using non-fading iPrintLnBold, that a lot of people use

Text itself in use in 8 seconds:


Code Snippet
Plaintext
/*
level.iprint_1 = false; // Need these 3 in init
level.iprint_2 = false;
level.iprint_3 = false;
self thread randomizing_partprint(); // Calling it on player
*/

At the bottom of your script:

Code Snippet
Plaintext
randomizing_partprint()
{
text_1 = "Picked up One Thing"; // Change to whatever you like
text_2 = "Picked up Anything";
text_3 = "Picked up Something";

defined_text = undefined;
rand = randomInt(3);
if(rand == 0)
{
if(level.iprint_1 == false)
{
defined_text = text_1;
level.iprint_1 = true;
self thread new_text_function(defined_text);
}
else
{
self thread randomizing_partprint();
}
}
else if(rand == 1)
{
if(level.iprint_2 == false)
{
defined_text = text_2;
level.iprint_2 = true;
self thread new_text_function(defined_text);
}
else
{
self thread randomizing_partprint();
}
}
else if(rand == 2)
{
if(level.iprint_3 == false)
{
defined_text = text_3;
level.iprint_3 = true;
self thread new_text_function(defined_text);
}
else
{
self thread randomizing_partprint();
}
}
}

new_text_function(defined_text)
{
screen_text = newClientHudElem(self);
screen_text.foreground = true;
screen_text.sort = 1;
screen_text.hidewheninmenu = false;
screen_text.alignX = "center";
screen_text.alignY = "bottom";
screen_text.horzAlign = "center";
screen_text.vertAlign = "bottom";
screen_text.fontscale = 8;
screen_text.color = (1, 1, 1);
screen_text.x = 0;
screen_text.y = -265;
screen_text.alpha = 0;
screen_text SetText(defined_text);

screen_text FadeOverTime(1);
screen_text.alpha = 1;
wait 2;

screen_text FadeOverTime(2);
screen_text ScaleOverTime(2, 0, 0);
screen_text.alpha = 0;

wait 2;

screen_text destroy_hud();
}
Title: Re: [Tutorial] "Custom" iPrintLnBold using HUD elements + randomized print function
Post by: Scobalula on May 25, 2016, 08:33:06 am
Nice, +1.
Title: Re: [Tutorial] "Custom" iPrintLnBold using HUD elements + randomized print function
Post by: pmr4 on August 30, 2016, 09:35:05 pm
What are the benefits of this?
Title: Re: [Tutorial] "Custom" iPrintLnBold using HUD elements + randomized print function
Post by: HitmanVere on August 31, 2016, 06:07:30 pm
What are the benefits of this?

Looks better than iPrintLnBold + if you have same model for buildable parts and just want different names each time you pick one part up, then my function adds up on that. Its like in Ghosts, except in Ghosts you had to scavenge from toolboxes and then saw the model for the part while mine is like simpler version of it