[closed] How to use "unit.attacks.attack_name"

Discussion of Lua and LuaWML support, development, and ideas.

Moderator: Forum Moderators

Post Reply
User avatar
ZombieKnight
Posts: 163
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

[closed] How to use "unit.attacks.attack_name"

Post by ZombieKnight »

How to use "unit.attacks.attack_name" https://wiki.wesnoth.org/LuaAPI/types/unit when the attack_name is two words long(throwing knives)?
Last edited by ZombieKnight on March 31st, 2024, 12:33 pm, edited 1 time in total.
I had saurian in profile before, but I've merged my discord profile with forum one...
User avatar
ZombieKnight
Posts: 163
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: How to use "unit.attacks.attack_name"

Post by ZombieKnight »

And how to use "unit.attacks.attack_name" when I don't know the attack_name but I have it stored in variable(wml.variables["weapon.name"])?
For context: I'm trying to modify "weapon special name" of the weapon I have stored in wml.variables["weapon.name"] (after some filtering so I know that my special is there)?
I had saurian in profile before, but I've merged my discord profile with forum one...
User avatar
Ravana
Forum Moderator
Posts: 3017
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: How to use "unit.attacks.attack_name"

Post by Ravana »

unit.attacks["throwing knives"]

Then iterate over attacks and compare data.
User avatar
ZombieKnight
Posts: 163
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: How to use "unit.attacks.attack_name"

Post by ZombieKnight »

Idk, why I haven't responded...
Thanks!!! that's what I've been looking for.
I had saurian in profile before, but I've merged my discord profile with forum one...
Post Reply