[closed] Where is current attack weapon stored/how it's marked?

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

Moderator: Forum Moderators

User avatar
Ravana
Forum Moderator
Posts: 3313
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Where is current attack weapon stored/how it's marked?

Post by Ravana »

my_unit_stored_from_map name suggests it wont work, Lua unit API is designed around proxy units, not stored units.

If my_unit_stored_from_map is WML table (__cfg), then you need to adjust it with wml.x methods and unstore in the end.

If my_unit_stored_from_map is proxy unit, you can use Lua API, my_unit_stored_from_map:transform("Ghoul").
User avatar
ZombieKnight
Posts: 371
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: Where is current attack weapon stored/how it's marked?

Post by ZombieKnight »

Sorry, what does proxy unit mean?
What are wml.x methods?
User avatar
Ravana
Forum Moderator
Posts: 3313
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Where is current attack weapon stored/how it's marked?

Post by Ravana »

Proxy unit means variable of type userdata, which you create by using few LuaAPI functions such as wesnoth.units.get. Any change done to proxy is also done to unit map.

By wml.x I mean https://wiki.wesnoth.org/LuaAPI/wml. For example as table.insert(cfg.attack, wml.tag.attack{})
User avatar
ZombieKnight
Posts: 371
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: Where is current attack weapon stored/how it's marked?

Post by ZombieKnight »

So I can change maps on map directly using lua with wesnoth.units.get and then modifiing some values in it?
Post Reply