Jump to content
Sign in to follow this  
tambovskya

RscText - Display Units : Health

Recommended Posts

Hi.

Is it possible to use RscText and write a command to display the 'unit_health', 'time' ?


		class gameTime: AS_PLO_RscText
		{
			idc = 1000;
			text = " [b][u]displayTime[/u][/b]";
			x = -.665;
			y = -.147;
			w = 0.21438;
			h = 0.0477125;
			colorText[] = {1,1,1,1};
			style = ST_CENTER;
		};

Edited by tambovskya

Share this post


Link to post
Share on other sites
https://community.bistudio.com/wiki/ctrlSetText

Use the alternative syntax:

((findDisplay 123) displayCtrl 1000) ctrlSetText format["%1%2", round((1 - (damage player)) * 100), "%"];

assuming the idd of the dialog is 123 and idc of the RscText is 1000.

Thanks! What about coordinates? Do you know that?

I'm also confused on how to compile the code.. could you write it the way I did? I'm not that deep with gui.

How would I edit this

 
class gameTime: AS_PLO_ctrlSetText
		{
			idc = 1000;
			text = "";  
			x = -.666;
			y = -.147;
			w = 0.21438;
			h = 0.0477125;
			colorText[] = {1,1,1,1};
			style = ST_LEFT;
		};

 
class AS_PLO_ctrlSetText
{
access = 0;
type = 0;
idc = -1;
colorBackground[] = {0,0,0,0};
colorText[] = {0.8784,0.8471,0.651,1};
text = "";
fixedWidth = 0;
x = 0;
y = 0;
h = 0.037;
w = 0.3;
style = 0;
shadow = 2;
font = "Zeppelin32";
SizeEx = 0.03921;

Do you have Skype or Steam? If you could add me on one of them it would be awesome.

Skype: tambovskya

Steam: tambovskya

Edited by tambovskya

Share this post


Link to post
Share on other sites

The code deadfast posted should be ran after you create your dialog or cutrsc.

If your using this like a hud, then you could put this in a loop and have it update the hud every second or two.

---------- Post added at 02:40 PM ---------- Previous post was at 02:37 PM ----------

Also you should take off those AS_PLO prefix tags, you should come up with and use your own prefix. Otherwise you will have compatibility problems if you try and use another gui with those same prefix's on the base classes.

Share this post


Link to post
Share on other sites

Yeah, I will take off the tags. I'm just finishing the code then doing the "details". I still don't get it... What do you mean run after dialog, cutrsc im confused.

Edit: Also, if I change the resolution the placement of the text changes and everything messes up. How do I make the text fixed so when it's on 2560x1440 or 1280x720 its always in the same place. So like down-scaled.

My .paa file that is the background for the gui isn't being displayed in full-resolution. Anyway to fix it?

Edited by tambovskya

Share this post


Link to post
Share on other sites

When you create your ui element, you use a command

Either createDialog for a dialog or

CutRsc for a resource.

A dialog stops the users interface(control) of the game, like the map.

A resource is just an overlay, and can not be interacted with by the player, like the compass.

Before you call either one of those, the. Ui element does no exist, its just defined in the description.ext so you can't interact by scripting commands with it untill you create it for the user.

Share this post


Link to post
Share on other sites
When you create your ui element, you use a command

Either createDialog for a dialog or

CutRsc for a resource.

A dialog stops the users interface(control) of the game, like the map.

A resource is just an overlay, and can not be interacted with by the player, like the compass.

Before you call either one of those, the. Ui element does no exist, its just defined in the description.ext so you can't interact by scripting commands with it untill you create it for the user.

Okay. But, where do I paste it?

Share this post


Link to post
Share on other sites
Okay. But, where do I paste it?

You would do it in a script. Usually people use the onLoad feature to load a scirpt when ever the dialog is called.

class WF_main_dlg {
idd = 1775;
movingEnable = true;
[color=#ff0000]onLoad = "// The code in here will be called every time your ui element is loaded or created. ";[/color]
objects[] = {};
class controlsBackground {

But if you are using this as a hud of sorts, In the same script you call the ui element right after you create the ui element I would spawn another thread and have your loop in there. Since you will never close the ui element since its a hud.

Share this post


Link to post
Share on other sites

I might have a similar problem, does anyone have simple example that displays a HUD item on screen after the script is called? So far I only got dialogs working but they block player movement when they are called.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×