Search found 1274 matches

by white_haired_uncle
Yesterday, 6:41 pm
Forum: Lua Labs
Topic: [solved] units on the recall list
Replies: 12
Views: 307

Re: units on the recall list

What I wonder is should there be a difference in .valid between the two? I was looking for the answer to the in the above quoted documentation, but didn't see/understand it. __cfg just returns WML. It doesn't know that it's a unit anymore, it's just an arbitrary untyped chunk of data formatted acco...
by white_haired_uncle
Yesterday, 5:31 pm
Forum: WML Workshop
Topic: new campaign's questions and ideas
Replies: 15
Views: 425

Re: new campaign's questions and ideas

lhybrideur wrote: Yesterday, 5:05 pm You could store xp in a variable in an attack event (start of the attack) and compare it to the xp in the attack_end even.
Then you reduce the xp by the difference and gives it to the leader.
I think it was determined that xp is granted after attack end.
by white_haired_uncle
Yesterday, 2:54 pm
Forum: Lua Labs
Topic: [solved] units on the recall list
Replies: 12
Views: 307

Re: units on the recall list

Ravana wrote: Yesterday, 2:42 pm None of https://wiki.wesnoth.org/LuaAPI/wml work on userdata (unit).
That sounds like the top of that page really needs a comment to that effect, but I do not know how to word it.

However, several of those functions such as wml.literal and wml.parsed mention userdata as input.
by white_haired_uncle
Yesterday, 1:41 pm
Forum: Lua Labs
Topic: [solved] units on the recall list
Replies: 12
Views: 307

Re: units on the recall list

I'm reasonably sure that I need to serialize at some point, and AFAIK there's no list of exactly what is available from just unit vs unit.__cfg (what do you call that anway?). It's kind of become a habit since the performance hit, which I've never been able to notice, is nothing compared to the amou...
by white_haired_uncle
Yesterday, 2:05 am
Forum: Lua Labs
Topic: [solved] units on the recall list
Replies: 12
Views: 307

Re: units on the recall list

Code: Select all

        local unit = wesnoth.units.find({ id = unit_id})[1].__cfg
        local unit2 = wesnoth.units.find({ id = unit_id})[1]


unit.valid == nil
unit2.valid == map|recall
by white_haired_uncle
Yesterday, 1:59 am
Forum: Lua Labs
Topic: [solved] units on the recall list
Replies: 12
Views: 307

Re: units on the recall list

This seems to work, but now I'm nervous about it breaking in the future. As the valid documentation explained, you want if unit.valid == 'recall' . Right, but I'm getting nil for both units on the recall and on the map, and while the doc explains when I would see that, it doesn't make any sense to ...
by white_haired_uncle
Yesterday, 12:55 am
Forum: Lua Labs
Topic: [solved] units on the recall list
Replies: 12
Views: 307

Re: units on the recall list

So, both units on the map and on the recall return nil. I looked into unit.valid: A unit can be either visible on the map (#wesnoth.get_units, #wesnoth.put_unit), or on a recall list (#wesnoth.get_recall_units, #wesnoth.put_recall_unit), or private to the Lua code (#wesnoth.create_unit, #wesnoth.cop...
by white_haired_uncle
Yesterday, 12:34 am
Forum: Lua Labs
Topic: [solved] units on the recall list
Replies: 12
Views: 307

[solved] units on the recall list

It looks like wesnoth.units.get(id) will only find units on the map, correct? If this is the intended behaviour I'll add a comment to the wiki. So I switched to using wesnoth.units.find because I want to look at map and recall. Now when I'm done messing with the unit and I want to "put it back&...
by white_haired_uncle
May 16th, 2024, 4:02 pm
Forum: Scenario & Campaign Development
Topic: Compatibility of previous add-ons with the current version
Replies: 6
Views: 262

Re: Compatibility of previous add-ons with the current version

Assuming this campaign has been abandoned, and I have no idea how to determine that, you might find a lot of good info here:

viewtopic.php?t=55180

You did notice that it is MP, so you won't find it under Campaigns, right?
by white_haired_uncle
May 16th, 2024, 3:34 pm
Forum: Lua Labs
Topic: [unsolvable] Access event content
Replies: 9
Views: 288

Re: [unsolvable] Access event content

I don't know, I've never used them. But for those I was thinking about your question about 'how to notice when it's fired'. If you want to erase them (the events) and recreate them, you could: 1) Since you want to do this from lua, just write them in lua in the first place, save them as variables, a...
by white_haired_uncle
May 16th, 2024, 3:13 pm
Forum: WML Workshop
Topic: multiple objects, overlapping effects
Replies: 2
Views: 102

Re: multiple objects, overlapping effects

You mean it will use whichever comes last?
by white_haired_uncle
May 16th, 2024, 2:39 pm
Forum: WML Workshop
Topic: multiple objects, overlapping effects
Replies: 2
Views: 102

multiple objects, overlapping effects

If a unit possesses two objects, say abilities.leadership.value=15 and abilities.leadership.value=20, which one is selected? What about abilities.leadership.value=-15 and abilities.leadership.value=-20? Or abilities.leadership.value=-15 abilities.leadership.value=20? Does it make any difference who ...
by white_haired_uncle
May 16th, 2024, 2:09 pm
Forum: Scenario & Campaign Development
Topic: Compatibility of previous add-ons with the current version
Replies: 6
Views: 262

Re: Compatibility of previous add-ons with the current version

Depends what you mean by "make it playable". You want to edit the code to bring it up to 1.18 compatibility, or just download the 1.14 version to your 1.18 install and hope it works? You might ask over here, though it doesn't seem to have seen much (un)life recently: https://forums.wesnoth...
by white_haired_uncle
May 16th, 2024, 1:35 pm
Forum: Lua Labs
Topic: [unsolvable] Access event content
Replies: 9
Views: 288

Re: [unsolvable] Access event content

Hi, How to access event content via Lua? I'm pretty sure I don't understand what you are asking, but if you mean you want to access (read) events you've written in WML from lua, could the answer be as simple as just writing them in lua in the first place? Or some combination of wesnoth.game_events....
by white_haired_uncle
May 16th, 2024, 8:35 am
Forum: Lua Labs
Topic: [resolution] problems
Replies: 4
Views: 134

Re: [resolution] problems

You can't use side 1 turn 1, or turn refresh, or one of those?