[SOLVED] No Lifebar or Movement Orb + Label that follows the Unit + Ellipse on selected Unit only

The place to post your WML questions and answers.

Moderator: Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Retributive
Posts: 47
Joined: February 20th, 2009, 12:45 pm
Location: Bordeaux, FRANCE.

[SOLVED] No Lifebar or Movement Orb + Label that follows the Unit + Ellipse on selected Unit only

Post by Retributive »

Hello to all.
I would like to use Wesnoth as a RPG helper and thus:
1- I would like to get rid of the lifebar (since I would be doing the life and death of the units with cheats).
2- I would like to have one side (out of two) to be completely invisible in the game (since I will be handling all the unit on one side).

How can I achieve that ?
(mostly 1, because to hide the side two hero I just can create it in a remote part of the map...)

If any of you has any hint/advice/way to do it, please feel free to answer this post.
Thank you for reading me.

Friendly yours,
Retributive.
Last edited by Retributive on July 12th, 2019, 10:48 am, edited 1 time in total.
User avatar
Ravana
Forum Moderator
Posts: 2949
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Getting rid of the Lifebar.

Post by Ravana »

1) use bar_offset_x, bar_offset_y with large enough value to have bar out of screen.
2) if you want to hide side, hidden=yes. If you want to hide unit, [hides]
Retributive
Posts: 47
Joined: February 20th, 2009, 12:45 pm
Location: Bordeaux, FRANCE.

Re: Getting rid of the Lifebar.

Post by Retributive »

Perfect, Ravana, thank you very much.

"use bar_offset_x, bar_offset_y" works perfectly

I put "hidden=yes" in the <unit name>.cfg file, but it doesn't work, and I don't know how/where to use the "[hides]" tag.

Same question for the focus circle under the unit, how can I hide it ?
Shiki
Developer
Posts: 348
Joined: July 13th, 2015, 9:53 pm
Location: Germany

Re: Getting rid of the Lifebar.

Post by Shiki »

The "hiddes" Ravana mentioned is for hiding the side from the status table (which you see with alt + s). In a scenario, you set it inside the [side] tag.
(mostly 1, because to hide the side two hero I just can create it in a remote part of the map...)
A side can also have no hero for a side at all. For the AI side, I recommend to use a few more options for the [side] tag:

Code: Select all

[side]
    side=2
    controller=ai
    hidden=yes
    # not specifying a type means no leader since wesnoth 1.14
    defeat_condition=no_units_left # because default is no_leader_left. never / always are other options
    controller_lock=yes # so no leader can be set by players for this side either
    allow_player=no # hides the side in the pre-game screen (if any)
    disallow_observers=yes # observers see only what players see
    color=lightblue # if you want, you can even give multiple sides the same color
[hides] is actionWML, and belongs into an event instead. E.g.

Code: Select all

[event]
    name=prestart
    
    [hides]
        id=someunit
However, reading your original question again, if you really want no battles and just one side…set victory_when_enemies_defeated=no inside the [scenario] or [multiplayer] tag. One feature which you can only get by using multiple sides is using different colors for different units.
Same question for the focus circle under the unit, how can I hide it ?
Setting ellipse=none. This can be done in the [unit_type], or when placing a unit (and thus also working with units from core). E.g.
{UNIT 2 Peasant 20 5 ellipse=none} # places unit for side 2 at x,y=20,5 — this macro belongs into events or [side] definitions.
Try out the dark board theme.
User avatar
Ravana
Forum Moderator
Posts: 2949
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Getting rid of the Lifebar.

Post by Ravana »

[hides] is AbilitiesWML. [hide_unit] is ActionWML. They work differently too, action only hides unit image, while ability pretends unit does not exist (ambush ability).
Retributive
Posts: 47
Joined: February 20th, 2009, 12:45 pm
Location: Bordeaux, FRANCE.

Re: Getting rid of the Lifebar.

Post by Retributive »

Thank you very much to both of you:

ellipse=none -> works perfectly in the [unit_type] definition.

[event] name=prestart [hides] id=<unit-id> -> doesn't work for me, but that's fine I will just put the Unit/side in a remote aera of the map...

...and since I became greedy :D I'm looking for a way to disable all ellipses at once, and to displace all lifebars at once, now... ;)
User avatar
beetlenaut
Developer
Posts: 2814
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: Getting rid of the Lifebar.

Post by beetlenaut »

Retributive wrote: July 1st, 2019, 6:51 am [event] name=prestart [hides] id=<unit-id> -> doesn't work for me
That's because [hides] is only for describing the ability of a unit as Ravana mentioned. I think Shiki mixed up [hides] and [hide_unit]. [hide_unit] is the one that is actionWML and can be used directly in an event.
Retributive wrote: July 1st, 2019, 6:51 am I'm looking for a way to disable all ellipses at once
You can use the unit_placed [event] type to remove the ellipse of any unit that appears for any reason. I don't think this will work for the bar_offsets though. You would probably have to use Lua for that.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
Retributive
Posts: 47
Joined: February 20th, 2009, 12:45 pm
Location: Bordeaux, FRANCE.

Re: Getting rid of the Lifebar.

Post by Retributive »

Thank you, works fine now:
[event]
name=prestart
[hide_unit]
id=<unit_ID>
[/hide_unit]
[/event]
User avatar
josteph
Inactive Developer
Posts: 741
Joined: August 19th, 2017, 6:58 pm

Re: Getting rid of the Lifebar.

Post by josteph »

Note that with hide_unit the unit is still selectable in the UI when the event finishes. If you select its hex you'll see the red crosshair hexagon and the sidebar will show the unit stats. If you want the unit to be invisible not just during a cutscene but during play (like ambush/nightstalk) you need to use [hides]. You shouldn't just change hide_unit to hides in your code, that wouldn't work (as you have discovered) because hide_unit is AbilityWML not ActionWML. You'd need to use [modify_unit] in your event.
Retributive
Posts: 47
Joined: February 20th, 2009, 12:45 pm
Location: Bordeaux, FRANCE.

Re: Getting rid of the Lifebar.

Post by Retributive »

Its fine, I hid it AND located it in some random corner of the map on "Void" terrain....
I am looking to remove the "ellipse" in all units at once, and create an event where the selected unit will show the ellipse, while the others/deselected ones are left without one.

I am testing an "[event]name=select" right now, but I still don't have a clue on how to achieve it though.

My thinking: when an unit is selected -> ellipse=yes + unit_id stored in a variable, then when another unit is selected -> <unit_id stored in a variable if any> ellipse=no + selected unit -> ellipse=yes.
If I can disable it, replace it with a blank transparent png image.

Or else when an unit is selected, all units ellipse=no (or blank image) then selected unit -> ellipse=yes ..
But got to return to work now, will try it this evening ;-)

Friendly yours,
Retributive.
Last edited by Retributive on July 2nd, 2019, 12:42 pm, edited 1 time in total.
User avatar
josteph
Inactive Developer
Posts: 741
Joined: August 19th, 2017, 6:58 pm

Re: Getting rid of the Lifebar.

Post by josteph »

I'm curious, why do you want to hide the ellipses? The ellipses are not a game mechanic, they are part of the interface. (And players can disable the ellipses in preferences, if they wish to)
Retributive
Posts: 47
Joined: February 20th, 2009, 12:45 pm
Location: Bordeaux, FRANCE.

Re: Getting rid of the Lifebar.

Post by Retributive »

"players can disable the ellipses in preferences" didn't know that, thank you.
"why do you want to hide the ellipses?" to make the selected unit standout more on the map.
Retributive
Posts: 47
Joined: February 20th, 2009, 12:45 pm
Location: Bordeaux, FRANCE.

Re: Getting rid of the Lifebar.

Post by Retributive »

I tried this code:
[event]
name=select
first_time_only="no"

[modify_unit]
[filter]
side=1
[/filter]
ellipse=no
[/modify_unit]

[message]
message= _ "Selected Unit: $unit.id"
[/message]

[modify_unit]
[filter]
id=$unit.id
[/filter]
ellipse=yes
[/modify_unit]

[/event]
The first [modify_unit] works, all ellipses are gone.
The message works, the ID of the selected unit is shown.
The second [modify_unit] doesn't works at all, what am I missing ?
User avatar
Ravana
Forum Moderator
Posts: 2949
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Getting rid of the Lifebar.

Post by Ravana »

ellipse value is part of image filename. Check documentation for details. Or log to see which file name is expected to exist for "yes".
Retributive
Posts: 47
Joined: February 20th, 2009, 12:45 pm
Location: Bordeaux, FRANCE.

Re: Getting rid of the Lifebar.

Post by Retributive »

So "ellipse=yes/no" is not the existence of the ellipse, but the name of the png file used to draw it ?

Edit: You're right, any value affected to ellipse (including "yes") makes it disappear....
Last edited by Retributive on July 2nd, 2019, 9:21 pm, edited 1 time in total.
Post Reply