Search found 1227 matches

by Spannerbag
Yesterday, 11:03 am
Forum: Forum Games
Topic: Word association
Replies: 1339
Views: 290940

Re: Word association

by Spannerbag
September 13th, 2026, 11:40 am
Forum: Forum Games
Topic: Word association
Replies: 1339
Views: 290940

Re: Word association

walker
by Spannerbag
September 10th, 2026, 1:54 pm
Forum: WML Workshop
Topic: regen with filter not working
Replies: 9
Views: 96

Re: regen with filter not working

I think I have it working. :D

I had to ensure that the unit vars had the correct value when the ability filter saw them plus, as they are static values I didn't need to use unit variables.
I wanted this code to work with variables and this seems to work:

First, make the coordinates explicit values ...
by Spannerbag
September 10th, 2026, 1:21 pm
Forum: WML Workshop
Topic: regen with filter not working
Replies: 9
Views: 96

Re: regen with filter not working

@gnombat,Soliton

Thanks for your posts, been prioritising another issue that's now (I think :fingers_crossed: ) resolved.

Update
:inspect shows that the actual filter (for unit and location) doesn't see the unit variable; i.e. x="" and y="".
My bad; should've looked there first - checked the ...
by Spannerbag
September 10th, 2026, 1:09 pm
Forum: WML Workshop
Topic: regen with filter not working
Replies: 9
Views: 96

Re: regen with filter not working


To access a container you can try: wml_vars.__children['return_guardian'][0].__attributes['return_x']

I suggest to test these things interactively on the formula console (press f) in-game first. (i.e. my_leader.wml_vars will print a representation of wml_vars of the current side's leader ...
by Spannerbag
September 10th, 2026, 12:49 pm
Forum: Lua Labs
Topic: Feasibility of customising return guardian micro ai
Replies: 23
Views: 350

Re: Feasibility of customising return guardian micro ai


...So this is always going to happen eventually.


Thanks for that last info-nugget, it helped. :D

Based on somewhat sparse testing I think I have two working return_guardian variants. :shock:

return_guardian_u , only uses unit variables for return co-ordinates.
return_guardian_ur as above ...
by Spannerbag
September 8th, 2026, 11:27 pm
Forum: Forum Games
Topic: Word association
Replies: 1339
Views: 290940

Re: Word association

claws
by Spannerbag
September 8th, 2026, 11:25 pm
Forum: Lua Labs
Topic: Feasibility of customising return guardian micro ai
Replies: 23
Views: 350

Re: Feasibility of customising return guardian micro ai


What about if they don't have any moves remaining?

Is it possible for the same unit to be processed multiple times by a micro ai?
If so then yes I suppose it could happen.
Bit doubtful tho' TBH because this issue only arises when I use the version that doesn't have return_x, return_y keys inside ...
by Spannerbag
September 8th, 2026, 11:18 pm
Forum: WML Workshop
Topic: regen with filter not working
Replies: 9
Views: 96

Re: regen with filter not working


I suspect this would work better if you just used simple scalar variables instead of container variables, since Wesnoth tends to get confused if you try to do complicated stuff with container variables.


Good point: that'll be my plan B if I can't get this to work with unit variables - but it'll ...
by Spannerbag
September 8th, 2026, 11:15 pm
Forum: WML Workshop
Topic: regen with filter not working
Replies: 9
Views: 96

Re: regen with filter not working


You say you want location dependent ability, but your test is about variable dependent one.


Ah... my mistake.
I thought:
[filter]
formula="x = wml_vars.return_guardian.return_x and y = wml_vars.return_guardian.return_y"
[/filter]

Would dynamically test if the unit's current x,y location ...
by Spannerbag
September 8th, 2026, 11:03 pm
Forum: Lua Labs
Topic: Feasibility of customising return guardian micro ai
Replies: 23
Views: 350

Re: Feasibility of customising return guardian micro ai



I guess this is complaining that line 12: if guardian_u.variables.return_guardian then references an empty guardian_u ?


Yes, AH.get_units_with_moves() might not return any units. In that case guardian_u will be nil . You need to check for this before trying to do anything with guardian_u ...
by Spannerbag
September 8th, 2026, 6:12 pm
Forum: WML Workshop
Topic: regen with filter not working
Replies: 9
Views: 96

regen with filter not working

Am setting up a location dependent regen ability but it doesn't work. :annoyed:

Here's the ability definition:

#define ABILITY_WOODWARD_REGENERATES AMOUNT
[regenerate]
[filter]
formula="x = wml_vars.return_guardian.return_x and y = wml_vars.return_guardian.return_y"
[/filter]
value={AMOUNT ...
by Spannerbag
September 8th, 2026, 4:07 pm
Forum: Lua Labs
Topic: Feasibility of customising return guardian micro ai
Replies: 23
Views: 350

Re: Feasibility of customising return guardian micro ai

Baffled again. :annoyed:

Plan was to simplify working version of return_guardian_uv to only use unit vars, partly as a lua exercise.
However I'm stuck.

Edit: using v1.19.27 on windows.

Here's the working code:

mai_return_guardian_uv.lua
--[[ mai_return_guardian_uv.lua

Modified return ...
by Spannerbag
September 4th, 2026, 10:16 am
Forum: Lua Labs
Topic: Feasibility of customising return guardian micro ai
Replies: 23
Views: 350

Re: Feasibility of customising return guardian micro ai


...So instead of writing this:


return_loc_uv[1], return_loc_uv[2] = guardian_uv.variables.return_guardian.return_x, guardian_uv.variables.return_guardian.return_y


You could write this:


return_loc_uv = { guardian_uv.variables.return_guardian.return_x, guardian_uv.variables.return_guardian ...
by Spannerbag
September 3rd, 2026, 4:26 pm
Forum: Lua Labs
Topic: Feasibility of customising return guardian micro ai
Replies: 23
Views: 350

Re: Feasibility of customising return guardian micro ai

Well, got it working much quicker (and more easily) than expected. ^_^

Not exhaustively tested but seems to work as expected plus no errors. :shock:

Only niggle was lua didn't like testing for the nonexistence of a variable inside a nonexistent container (fair enough I suppose) so I just tested ...