How do you use the unhide unit function?

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

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.

How do you use the unhide unit function?

Postby Partizan » September 20th, 2017, 4:45 pm

I know the question has been asked (and answered) before, but I don't seem to be able to make the hide/unhide unit functions work. How are they supposed to work? Do they generate a hidden unit, or just hide a unit that already exists, and how do I unhide the unit that's already there?
Partizan
 
Posts: 8
Joined: August 9th, 2017, 7:02 pm

Re: How do you use the unhide unit function?

Postby Sapient » September 20th, 2017, 5:48 pm

It may help if you give more detail about what you are trying to do and why. Perhaps you intended to give a unit the hides ability, for example. Without more details it's hard to say.
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
User avatar
Sapient
Developer
 
Posts: 4360
Joined: November 26th, 2005, 7:41 am

Re: How do you use the unhide unit function?

Postby zookeeper » September 20th, 2017, 6:15 pm

When you don't know how a given tag works, you do check its documentation first, right? Because the descriptions of [hide_unit] and [unhide_unit] seem pretty straightforward. If you can't get them to work, then just post your code and what you want/expect it to do.
User avatar
zookeeper
WML Wizard
 
Posts: 9604
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: How do you use the unhide unit function?

Postby Partizan » September 29th, 2017, 8:59 pm

To start off with, no, they're not straightforward unless you already know what you need to do. For me, I need to know how it works, and what I need to do to make it work. One tells me what I can do with it, and what I can to do to prove whether the problem lies with code segment A, or code segment B, while the other tells me what I have to do to make it work. Basically, I don't have enough of an idea of how to use this function to create code for the function.



As for what I'm trying to do...I want to have a scenario where a legion of ghosts are summoned to slay a city's garrison, and then banished (much to the summoners' frustration). I can get the ghosts to generate, and once they generate, I can get them to kill the garrison just fine...but only if I start with them already placed, which I don't want to be the case. My solution seems to be to hide the units...but when I try to hide them, they either don't generate, or I can't reveal them. Since I don't have any clear idea or example of how to use the hide/unhide functions, that means that I'm sort of stuck.

Honestly, a lot of the commands and functions given in the wiki are like this--they tell you why it's important, but not how to actually use it. I can sometimes find examples of a function in the core campaigns, or in add-ons, but to do so I have to spend a good many hours searching through said campaigns, even if I've played enough to have a basic idea of where to look. For the hide/unhide function, and many others, I have literally no idea where to look, and my searches have not yielded fruit. Any help y'all can give would be appreciated. I like to create a plan for how I wish to use a function (and for the scenario as a whole) before I start coding it in, so I can more quickly eliminate the potential problems in the logic before I actually start coding, and thus reduce the work involved in debugging...but right now, I don't know enough to do so, and I can't find any examples to extrapolate from. Hence the question. Since I hate debugging with the burning passion of a thousand suns, I'm not exactly eager to start coding at random and hoping that I can pick it up as I go, so...I asked the experts.
Partizan
 
Posts: 8
Joined: August 9th, 2017, 7:02 pm

Re: How do you use the unhide unit function?

Postby Ravana » September 29th, 2017, 9:22 pm

Hide and unhide unit are visual changes - unit is still there, and can act.

You might want [unit] or [unstore_unit].
User avatar
Ravana
Moderator
 
Posts: 1450
Joined: January 29th, 2012, 12:49 am
Location: Estonia


Return to WML Workshop

Who is online

Users browsing this forum: No registered users and 5 guests