Writing to Status or top of screen text?

Discuss modding questions and implementation details.
User avatar
Ralzar
Posts: 2211
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Writing to Status or top of screen text?

Post by Ralzar »

How do you get text like, for example, being Poison creates?

The floating text saying "You feel bad" and the status information "You have been poisoned".

Is there some way to write to one or both of these?

User avatar
pango
Posts: 3347
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: Writing to Status or top of screen text?

Post by pango »

Code: Select all

DaggerfallUI.AddHUDText(message)
and variants should do for scrolling text at the top of the screen and

Code: Select all

DaggerfallUI.SetMidScreenText(message)
for middle screen text
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

User avatar
Ralzar
Posts: 2211
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Re: Writing to Status or top of screen text?

Post by Ralzar »

Thanks! That worked great :D

User avatar
Ralzar
Posts: 2211
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Re: Writing to Status or top of screen text?

Post by Ralzar »

Hm, is there a way these are usually set to delay the messages? My DaggerfallUI.AddHUDText(message) just spams me. Unlike when you are poisoned for example, where the text only appears every 10 seconds or so.

User avatar
pango
Posts: 3347
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: Writing to Status or top of screen text?

Post by pango »

Poisoned messages only appear at multiples of 5s because they're triggered by magical/effects "rounds", that's not a feature of display functions.

So you'd have to do something similar, use Unity's Time package to schedule events.
Say, maintain a counter that you increment with Time.deltaTime, and trigger a message only when it reaches the period you want.
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

User avatar
Ralzar
Posts: 2211
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Re: Writing to Status or top of screen text?

Post by Ralzar »

Ah, ok. My function allready triggers by magical rounds. So it's simply that the rounds are too short. Which is sort of what I assumed. I'll take a look at what my options are.

User avatar
Ralzar
Posts: 2211
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Re: Writing to Status or top of screen text?

Post by Ralzar »

Is there a relatively easy way to write to this?
status.png
status.png (91.93 KiB) Viewed 1399 times

User avatar
pango
Posts: 3347
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: Writing to Status or top of screen text?

Post by pango »

That's the DaggerfallMessageBox class, it's very powerful (because it can contain formatted text, buttons,...) so it all depends on what you want to do with it exactly.

DaggerfallUI.MessageBox(string message) or DaggerfallUI.MessageBox(string[] message) may be sufficient for your needs, but you can search around in the code for more advanced usage examples...
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

User avatar
Hazelnut
Posts: 3015
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Writing to Status or top of screen text?

Post by Hazelnut »

It reports any disease or poison effects on the player and is constructed in DaggerfallUI.CreateHealthStatusBox() if you want to use it. Replacing this method is not provided to mods. If you created a 'disease' effect you could probably have it appear on here, but seems a bit over the top.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
Ralzar
Posts: 2211
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Re: Writing to Status or top of screen text?

Post by Ralzar »

And that answered the "relatively easy way" question :D

Too bad really, because the game lacks these kind of places to just look up status effects. Since you are not told what is buffing/debuffing your attributes, and this box is apparently pretty custom made for just diseases and poisons (and poisons down't even use it properly).

I was hoping to use it for my Climates&Cloaks mod as a place to look up exactly how warm/cold it is instead of having to wait for it to vaguely roll across the screen.
Ah well, it works ok as it is. I just figured it was worth checking.

Post Reply