Search found 2192 matches

by Celtic_Minstrel
Today, 1:46 pm
Forum: Lua Labs
Topic: Custom dialog placement
Replies: 2
Views: 37

Re: Custom dialog placement

The dialog doesn't know anything about the map screen, so it's technically not possible. Since the sidebar is a fixed width as far as I know, you can probably get this to work with the default theme, at least; it would probably break if someone uses a different theme though. Basically, you would hav...
by Celtic_Minstrel
Yesterday, 5:41 pm
Forum: WML Workshop
Topic: [solved] Artificial Inteligence more [avoid] tags
Replies: 4
Views: 115

Re: [solved] Artificial Inteligence more [avoid] tags

Yeah, you're right, you need the empty not tag as well.
by Celtic_Minstrel
Yesterday, 1:29 pm
Forum: WML Workshop
Topic: [solved] Artificial Inteligence more [avoid] tags
Replies: 4
Views: 115

Re: Artificial Inteligence question

If you want units to avoid certain terrains only when they're not using the Goto MicroAI, that's easy. Set up the avoid tag for the avoided terrains like normal. Then add an empty avoid tag in the Goto Micro AI definition. For MicroAIs that support it, an avoid tag inside their definition overrides ...
by Celtic_Minstrel
Yesterday, 1:27 pm
Forum: WML Workshop
Topic: Clone unit in WML
Replies: 5
Views: 192

Re: Clone unit in WML

If I understand correctly, you want to make a unit that's a copy of the leader unit while avoiding ID conflicts? In that case, all you need to do is store the unit, delete the ID from the stored unit, modify anything else you want, and then unstore the unit. A stored unit is already a copy of the un...
by Celtic_Minstrel
Yesterday, 1:23 pm
Forum: WML Workshop
Topic: variable expansion
Replies: 4
Views: 160

Re: variable expansion

You can't use [set_variable] for container variables. It just won't work. There's no way to make your false example work in a similar way. You could maybe work something out with [set_variables] (note the extra S), but I have a feeling it wouldn't be that much less verbose than your first example. Y...
by Celtic_Minstrel
Yesterday, 1:18 pm
Forum: WML Workshop
Topic: [solved] [have_unit], count, recall list, WFL syntax and wildcards
Replies: 4
Views: 125

Re: [have_unit], count, recall list, WFL syntax and wildcards

Only somewhat related, can I ever use count as anything but a filter? Seems like it would be useful, if only to print a debug message. count= is part of a filter tag, so naturally you can't use it anywhere else (that I know of). Does WFL use wildcards? Seems like it should, but I can't find it on t...
by Celtic_Minstrel
Yesterday, 1:08 pm
Forum: Lua Labs
Topic: Working lua need advice deciding which method is best
Replies: 34
Views: 1078

Re: Working lua need advice deciding which method is best

Correct. Note that putting Lua in an event doesn't fully isolate it from the rest of the scenario though. It will only be executed when that event fires, but that code can change global variables, move units around, and do many other things that affect code running elsewhere in the scenario. On the ...
by Celtic_Minstrel
Yesterday, 1:04 pm
Forum: Lua Labs
Topic: [closed] remove unit from array
Replies: 11
Views: 252

Re: remove unit from array

foreach doesn't play well with removing elements of the array it is iterating over. I don't try to remember the rules, I just use for if I'm going to remove anything. You need to be careful removing elements with for, too – you could end up skipping over the next element when you remove one. The ke...
by Celtic_Minstrel
Yesterday, 12:51 pm
Forum: Lua Labs
Topic: Can add-on register key pressed while gui.show_dialog is active? e.g. >a<, >space< ...
Replies: 3
Views: 89

Re: Can add-on register key pressed? e.g. >a<, >space< ...

Try [set_menu_item].

Of course, that'll only work on the map, not in a dialog… probably.
by Celtic_Minstrel
Yesterday, 12:50 pm
Forum: WML Workshop
Topic: Ability damage %HP owner help needed
Replies: 10
Views: 1441

Re: Ability damage %HP owner help needed

Yes, but that doesn't help your specific use-case here, because the filter clears harm_unit once it's done filtering. The key is that harm_unit also fills in this_unit.
by Celtic_Minstrel
Yesterday, 12:49 pm
Forum: Lua Labs
Topic: Working lua need advice deciding which method is best
Replies: 34
Views: 1078

Re: Working lua need advice deciding which method is best

_main.cfg has no relevance to anything. You could put your scenario in _main.cfg if you really wanted to and there would be no issues. If you put the Lua code inside a scenario, it will be executed in that scenario. If you put it in a campaign, it will be executed in every scenario in that campaign...
by Celtic_Minstrel
April 12th, 2024, 1:22 pm
Forum: WML Workshop
Topic: Ability damage %HP owner help needed
Replies: 10
Views: 1441

Re: Ability damage %HP owner help needed

That's a good question, and it made me realize that you want $this_unit (which is indeed filled in by [harm_unit]) rather than $unit (which is filled in by the event, but in your case would be blank since it's a turn event).
by Celtic_Minstrel
April 11th, 2024, 1:07 pm
Forum: WML Workshop
Topic: Ability damage %HP owner help needed
Replies: 10
Views: 1441

Re: Ability damage %HP owner help needed

The way I understood use was, $self was meant as unit with ability, not the unit being harmed. Hmm, you're right. I saw that this was about an ability and thought we were talking about an ability formula and missed the fact that, in fact, there was a [harm_unit] tag involved. So, I think changing t...
by Celtic_Minstrel
April 11th, 2024, 1:02 pm
Forum: Lua Labs
Topic: Working lua need advice deciding which method is best
Replies: 34
Views: 1078

Re: Working lua need advice deciding which method is best

Let me just repeat myself: passing _G to stringx.vformat will not work . _("There is a $color $species.") I only speak American, not even English, but that looks like a pain for translators. Would they re-order $color and $species as necessary (in which case this appears to be a preferable...
by Celtic_Minstrel
April 11th, 2024, 4:37 am
Forum: WML Workshop
Topic: Ability damage %HP owner help needed
Replies: 10
Views: 1441

Re: Ability damage %HP owner help needed

amount="$($self.hitpoints*0.6)" <-------- THE PROBLEM I WANT TO SOLVE That's wrong. Delete the $ signs and you should have it working. What that actually does is look for a WML container variable called self which contains a variable called hitpoints . Failing to find one, it deletes the ...