Uhh, i used the commands u provided but both of them set turn number or turn limit number to 1 regardless of what value i put in it.
for example i use turn [8] in debug mode but it sets turn number to 1. using turn_limit [50] sets turn limit to 1.
@enclave thanks for the alternate method but i find ravana's lua suggestions simpler. I'm just starting out so set_menu_item stuff goes over my head for now

You can call every actionwml tag from lua with wesnoth.wml_actions.tag_name{key=value,key2=value2}. But using Lua to call WML to do something that Lua can do directly is not really useful.

You mean that instead of :lua wesnoth.fire("modify_turns", { add=5 })
Sudipta could just write this: :lua wesnoth.wml_actions.modify_turns { add=5 }
and it would be massively shorter and more simple?
I will actually try to compare performance of these 2 methods with 5k cycle just for curiosity.

Ps. i only offered to try this method since there seems to be a problem with proper lua method for Sudipta..

Uhh, i used the commands u provided but both of them set turn number or turn limit number to 1 regardless of what value i put in it.
for example i use turn [8] in debug mode but it sets turn number to 1. using turn_limit [50] sets turn limit to 1.

Both Ravana's and enclave's code works. I'm not gonna argue theory since it's results i care about

Do you mean the example above is working fine now, or did you have to modify it somehow?

The two lua commands Ravana posted first worked perfectly for me and got the job done. Then Shiki gave me a link of the CommandsWiki(thanks for that) and at first those debug commands didn't work because i included the [ ]. It was later pointed out to me where i was making a mistake and now that works perfectly too. Then enclave posted Lua+WML commands and those work too. So now i know 3 fundamentally different ways of changing turns and turn_limits

Now i'm a believer of the KISS principle, so i prefer using the shortest debug commands, but its good to know the alternate techniques. Hopefully that clears it up.

It is the mark of an educated mind to be able to entertain a thought without accepting it.
Playing Wesnoth since 2010, still there is so much left to play

I'm trying to use a Thunder macro to damage all units of the players side, but it doesn't work properly. Short version- the player fights a powerful elf lord, and when you reduce the Lord's hp to 0, he uses a powerful magic to almost kill all the player's units. It triggers in a last breath event. the code of the Thunder macro is

Basically it leaves all units alive with 1 hp left. But when i run it, i get some lua error messages, and then the scenario ends triggering the victory event. In the previous coding style, i used a modify unit tag to set all unit HP to 1 and that worked. But since harm_unit's looks a lot cooler i wanna use this instead.

i think the error is in the amount attribute. Please advise.

Attachments

this is what shows when the event occurs

It is the mark of an educated mind to be able to entertain a thought without accepting it.
Playing Wesnoth since 2010, still there is so much left to play

Another thing. How do i stop a unit from dying after its last breath event is triggered? In the above example, after the magic sequence the Elf Lord dies but he shouldn't. I tried using modify unit and and changing the HP but that doesn't prevent his death. I could use a store_unit tag and kill attribute but i wonder if there's a more elegant solution ?

It is the mark of an educated mind to be able to entertain a thought without accepting it.
Playing Wesnoth since 2010, still there is so much left to play