[closed] WML table navigation
Moderator: Forum Moderators
- ZombieKnight
- Posts: 282
- Joined: June 27th, 2022, 2:26 pm
- Location: Czech Republic
[closed] WML table navigation
Hi,
I'm using
Whats the path to weapon (name=weapon_name), specials with index [index], specials id?
I'm using
Code: Select all
local u = wesnoth.units.get(wml.variables["unit.id"])
local u_table=u.__cfg
Last edited by ZombieKnight on March 31st, 2024, 12:29 pm, edited 1 time in total.
I had saurian in profile before, but I've merged my discord profile with forum one...
Working on campaign Bandits from Brown Hills
Working on campaign Bandits from Brown Hills
- Celtic_Minstrel
- Developer
- Posts: 2290
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: WML table navigation
First of all, that's completely pointless. It's roughly equivalent to:ZombieKnight wrote: ↑March 18th, 2024, 4:01 pmCode: Select all
local u = wesnoth.units.get(wml.variables["unit.id"]) local u_table=u.__cfg
Code: Select all
local u_table = wml.variables["unit"]
This is what I'd recommend for getting that information, assuming the stored unit hasn't been modified at all:ZombieKnight wrote: ↑March 18th, 2024, 4:01 pm Whats the path to weapon (name=weapon_name), specials with index [index], specials id?
Code: Select all
local u = wesnoth.units.get(wml.variables["unit.id"])
local weapon = u.attacks[weapon_name]
local special_id = weapon.specials[index].id
Code: Select all
local u_table = wml.variables["unit"]
local weapon_table = wml.find_child(u_table, "attack", {name = weapon_name})
local specials = wml.get_child(weapon_table, "specials")
local specials_id = specials[index].contents.id
.contents
probably needs to be replaced with [2]
.- ZombieKnight
- Posts: 282
- Joined: June 27th, 2022, 2:26 pm
- Location: Czech Republic
Re: WML table navigation
Thanks,
I can't use first way, becouse changing weapons special id (and name) in u didn't changed it...
Yeah, I gues Ill try that child_range.
(I've already individually found that special in weapon using 3 for cycles)
I can't use first way, becouse changing weapons special id (and name) in u didn't changed it...
Yeah, I gues Ill try that child_range.
(I've already individually found that special in weapon using 3 for cycles)
I had saurian in profile before, but I've merged my discord profile with forum one...
Working on campaign Bandits from Brown Hills
Working on campaign Bandits from Brown Hills