Hide HP-XP-overlays with lua
Moderator: Forum Moderators
Hide HP-XP-overlays with lua
Is there a way to hide the energy bars, XP, orbs and overlays, the same way this WML code does?
To be able to apply it more generally in more situations with lua, not only on
To be able to apply it more generally in more situations with lua, not only on
[animate_unit] with_bars=no
, which is the only way in all WML that I can do that.
Code: Select all
[animate_unit]
[filter]
x,y=$x1,$y1
[/filter]
flag=healed
with_bars=no
[/animate_unit]
- Celtic_Minstrel
- Developer
- Posts: 2207
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: Hide HP-XP-overlays with lua
I think the only way to hide the bars is animating the unit. In Lua that would mean you use wesnoth.units.create_animator, build up a set of animations, and then run them.
Does that satisfy what you need, or not? I'm not sure if you could permanently hide the bars with this method, if that's what you're going for.
Does that satisfy what you need, or not? I'm not sure if you could permanently hide the bars with this method, if that's what you're going for.
Re: Hide HP-XP-overlays with lua
This is not Lua...
Maybe use [unit_type] to create duplicate units, then change the bar_offset_x, bar_offset_y to put the bars so far off the map that they are not visible, and also turn off halo, ellipse or whatever.
Also, if you simply want a unit standing on the map without their information features visible, you could place their basic unit_standing.PNG on the map like an item.
Maybe use [unit_type] to create duplicate units, then change the bar_offset_x, bar_offset_y to put the bars so far off the map that they are not visible, and also turn off halo, ellipse or whatever.
Also, if you simply want a unit standing on the map without their information features visible, you could place their basic unit_standing.PNG on the map like an item.
Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
Re: Hide HP-XP-overlays with lua
I wanted it to be changeable manually, with a shortcut or right-click menu. That won't be possible, unless I have a way to automatically replace the game animations with my edited version, too complex.Celtic_Minstrel wrote: ↑February 1st, 2023, 2:53 pm Does that satisfy what you need, or not? I'm not sure if you could permanently hide the bars with this method, if that's what you're going for.
That gave me hope, but unfortunately it didn't work. What you say is only applicable if I replace the units one by one or creating a unit specifically. But it does not serve to modify existing units without significantly altering them.
I tried this and it is not possible to do it, it has no effect. And there is no other way to change these values to already existing units. [modify_unit_type] only works if I specify the unit id and only in the [campaign] [era] and [modification] tags, not "on-the-fly".
Code: Select all
[modify_unit]
[filter]
[/filter]
bar_offset_x=99999
bar_offset_y=99999
[/modify_unit]
Re: Hide HP-XP-overlays with lua
I think Celtric Mistrel is right. Overlays are not shown, when a unit is moving or when it is animated. So one idea could be to make an constant idle with the same unit picture as the standard standing unit (not quite sure it will work, but maybe worth a try). Or making the unit breath in and out all the time, like in a fighting game.
The future belongs to those, who believe in the beauty of their dreams.
Developer of: Trapped, Five Fates, Strange Legacy, Epical, UR Epic Era
Dungeonmasters of Wesnoth, Wild Peasants vs Devouring Corpses, Dwarf Dwarfson Dwarvenminer
Developer of: Trapped, Five Fates, Strange Legacy, Epical, UR Epic Era
Dungeonmasters of Wesnoth, Wild Peasants vs Devouring Corpses, Dwarf Dwarfson Dwarvenminer
Re: Hide HP-XP-overlays with lua
Overlays are displayed when the unit is attacking too. Only movement animation makes it disappear as far as I know
Re: Hide HP-XP-overlays with lua
Ok, I think I understood you better. You say to create an animation with Lua without with_flag that acts all the time while the unit is stopped, right? Although my intention is actually to avoid overlays during attacks as well, and it would not work for that case
Re: Hide HP-XP-overlays with lua
Hello!
You could try with
and
Inside unit or unit_type tags. Should also work with modify_unit
You can create a macro that applies modify_unit on any unit when you need it
You could then call something like
You might also want a macro to {SHOW_BARS} using the default scaling values. You can find the default values here
Alternatively you can edit xp and hp bar scaling for the WHOLE game on this file on your wesnoth root folder
wesnoth/data/game_config.cfg
Hopefully that solves your issue somehow
You could try with
Code: Select all
hp_bar_scaling=0.0
Code: Select all
xp_bar_scaling=0.0
You can create a macro that applies modify_unit on any unit when you need it
You could then call something like
Code: Select all
{HIDE_BARS unit}
Alternatively you can edit xp and hp bar scaling for the WHOLE game on this file on your wesnoth root folder
wesnoth/data/game_config.cfg
Hopefully that solves your issue somehow
Practice makes perfect, why don't we practice helping others?
Re: Hide HP-XP-overlays with lua
I've tried it and it still shows little white lines 1 pixel wide where the start of the XP and HP bars should be. We talked about this on Discord, they're probably going to change that in the future so that 0 really means 0.
Re: Hide HP-XP-overlays with lua
Another thing I've tried and it didn't work either, besides using hp_bar_scaling to 0, is editing or deleting bar-energy.png file and editing the line energy="misc/bar-energy.png" in wesnoth\data\game_config.cfg. This did not change the appearance of the bars at all.