unit.flying does not appear.
Moderator: Forum Moderators
unit.flying does not appear.
unit.flying does not appear.
Units that fly, according to [movetype] flying = yes [/movetype], should have a unit.flying variable.
For me, in this circumstance, it does not appear. The code below triggers with gryphons, bats, gliders.
And "unit.flying" never appears.
Units that fly, according to [movetype] flying = yes [/movetype], should have a unit.flying variable.
For me, in this circumstance, it does not appear. The code below triggers with gryphons, bats, gliders.
And "unit.flying" never appears.
Code: Select all
local function add_object(unit)
if not unit.flying then
wesnoth.interface.add_chat_message("not flying "..wesnoth.as_text(unit.flying))
end
end
on_event("recruit, recall", function (ctx)
local unit = wesnoth.get_unit(ctx.x1, ctx.y1)
if unit then
add_object(unit)
end
end)
Re: unit.flying does not appear.
I figured it. OUT.
YOU MUST ACCESS unit.__cfg.flying INSTEAD OF unit.flying
CHECK WITH unit.__cfg.flying == true. BECAUSE unit.flying WON'T BE REAL
YOU MUST ACCESS unit.__cfg.flying INSTEAD OF unit.flying
CHECK WITH unit.__cfg.flying == true. BECAUSE unit.flying WON'T BE REAL
- Celtic_Minstrel
- Developer
- Posts: 2371
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: unit.flying does not appear.
Are you using version 1.18.x? If I recall correctly, unit.flying was added in 1.19.x.
-
- Posts: 1456
- Joined: August 26th, 2018, 11:46 pm
- Location: A country place, far outside the Wire
Re: unit.flying does not appear.
I think you're right. I though for sure OP would need to use unit.__cfg, but I tested it (on 1.19) and it worked for me.Celtic_Minstrel wrote: ↑November 6th, 2024, 6:56 pm Are you using version 1.18.x? If I recall correctly, unit.flying was added in 1.19.x.
Speak softly, and carry Doombringer.