scenario_end event

The place to post your WML questions and answers.

Moderator: Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Post Reply
vghetto
Posts: 755
Joined: November 2nd, 2019, 5:12 pm

scenario_end event

Post by vghetto »

Hi,
I'm looking at Sceptre_of_Fire: 1_A_Bargain_is_Struck.cfg and there is an event called scenario_end.
I was unable to find any documentation about it in the wiki (EventWML,ScenarioWML).
Could you please add if this is a synced event or not on the EventWML page. I'm guessing it's not.
User avatar
Ravana
Forum Moderator
Posts: 2949
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: scenario_end event

Post by Ravana »

User avatar
octalot
General Code Maintainer
Posts: 783
Joined: July 17th, 2010, 7:40 pm
Location: Austria

Re: scenario_end event

Post by octalot »

Thanks for pointing that out, the wiki is also missing local_victory and local_defeat.

scenario_end fires immediately after victory or defeat, and its synchronisation is the same. However, EventWML#Multiplayer_safety suggests that, since 1.13.10, all of those events are synced and the documentation on that page for victory and defeat is wrong.
vghetto
Posts: 755
Joined: November 2nd, 2019, 5:12 pm

Re: scenario_end event

Post by vghetto »

Yes it is synced afterall. One of the issues that I've been having is not knowing where is the best place to remove_object and remove_unit_overlay from units.
I recently had an issue with the replays when I did that in the victory event: "error replay: found dependent command in replay while is_synced=false"
I think I could have used scenario_end for doing those?
and thank you both
vghetto
Posts: 755
Joined: November 2nd, 2019, 5:12 pm

Re: scenario_end event

Post by vghetto »

octalot wrote: December 18th, 2019, 6:29 pm Thanks for pointing that out, the wiki is also missing local_victory and local_defeat.

scenario_end fires immediately after victory or defeat, and its synchronisation is the same. However, EventWML#Multiplayer_safety suggests that, since 1.13.10, all of those events are synced and the documentation on that page for victory and defeat is wrong.
I seem to have misunderstood you, is it synced or like victory and defeat not synced?
over here it says that it is https://github.com/wesnoth/wesnoth/comm ... 2b2ba8df7c
sorry english is not my first language.
User avatar
octalot
General Code Maintainer
Posts: 783
Joined: July 17th, 2010, 7:40 pm
Location: Austria

Re: scenario_end event

Post by octalot »

I recently had an issue with the replays when I did that in the victory event: "error replay: found dependent command in replay while is_synced=false"
Are you working on 1.12? The behavior changed between 1.12 and 1.14. The important commit seems to be 084dfc9887c96b3bc1f238123a97356af1659751, which the Wiki hasn't been updated for (but I now know enough to update it).

The current version of playsingle_controller.cpp seems to have all of scenario_end, victory and defeat synced:
https://github.com/wesnoth/wesnoth/blob ... #L302-L307
vghetto
Posts: 755
Joined: November 2nd, 2019, 5:12 pm

Re: scenario_end event

Post by vghetto »

Thank you for clearing it up.

The error happened on 1.14.5 debian. I had a lot of things going in my victory event; remove object and overlay, clear variables and a "Horray we won" message by side 1 leader. I didn't narrow down which one of those things was giving the error exactly, I expected it to be the overlay one, but I could be wrong, many sources are pointing a finger at [message], I don't know.
I solved the problem by removing all name=victory and name=defeat events from my code and firing a custom cleanup event right before I call an [endlevel] block from either enemies defeated or time over events. The [message] was moved over to there as well.
User avatar
Celtic_Minstrel
Developer
Posts: 2166
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: scenario_end event

Post by Celtic_Minstrel »

Why do you need to [remove_object] at scenario end? Wouldn't it be sufficient to just add duration=scenario to the [object]?
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
vghetto
Posts: 755
Joined: November 2nd, 2019, 5:12 pm

Re: scenario_end event

Post by vghetto »

Hi,

They were added incidentally and just stayed.
It started with me trying to remove the effect of overlay from the units that used an object.

Code: Select all

[effect]
 apply_to=overlay
 add="misc/holy-water-overlay.png"
[/effect]
duration=scenario didn't remove the image, my units that drank potions still had the icon in the recall list in the next scenario.
I read somewhere (either forum or wiki) that a remove object would take care of removing the image. I added that and that didn't work either as promised.
In the end I dropped apply to overlay effect, called regular unit_overlay and remove_unit_overlay and kept the code for remove_object. I didn't expect it to do any harm.

Edit:
I'm revisiting that part of my code and see that I'm doing something wrong. I didn't include id={ID} to the [object], so the remove_object calls are worthless. I'm going to test it and get back to you.

Edit:
Even with the correct id, remove_object removed the effect but didn't remove the unit.overlay. Since I clearly had it wrong in the first place and they weren't doing anything, i commented out remove_object but kept remove_unit_overlay
gfgtdf
Developer
Posts: 1432
Joined: February 10th, 2013, 2:25 pm

Re: scenario_end event

Post by gfgtdf »

There are known problems with removing objects that add images in 1.14, those were fixed in wesnoth 1.15 though.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
User avatar
octalot
General Code Maintainer
Posts: 783
Joined: July 17th, 2010, 7:40 pm
Location: Austria

Re: scenario_end event

Post by octalot »

gfgtdf wrote: December 19th, 2019, 5:41 pm There are known problems with removing objects that add images in 1.14, those were fixed in wesnoth 1.15 though.
gfgtdf, please could you clarify whether victory is synced in 1.14? I think it is, but the error message reported earlier suggests that it isn't.
gfgtdf
Developer
Posts: 1432
Joined: February 10th, 2013, 2:25 pm

Re: scenario_end event

Post by gfgtdf »

I'm quite sure that victory is synced, it was iirc unsynced in wesnoth 1.12 and earlier though
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
vghetto
Posts: 755
Joined: November 2nd, 2019, 5:12 pm

Re: scenario_end event

Post by vghetto »

Hi,

I uploaded the replays if you would like to have a look. They are all on 1.14.5 and playing the campaign 'Vaelia Random Adventures'

VRA-error_OOS_victory-15.gz will say on turn 15 'error replay: found dependent command in replay while is_synced=false'

The following is after I removed all name=victory events. There are no replay errors on these two.
VRA-enemies_defeated-19.gz enemies_defeated event on turn 19
VRA-time_over-21.gz time_over event on turn 21 out of 20. time_over is a victory in VRA.

On the error replay, right after my unit says Die villain and the Ogre says his line, my leader was supposed to say something, but it never got to that.

Thanks
Attachments
VRA-enemies_defeated-19.gz
(53.22 KiB) Downloaded 376 times
VRA-time_over-21.gz
(42.19 KiB) Downloaded 374 times
VRA-error_OOS_victory-15.gz
(54.04 KiB) Downloaded 371 times
gfgtdf
Developer
Posts: 1432
Joined: February 10th, 2013, 2:25 pm

Re: scenario_end event

Post by gfgtdf »

did you play this game on the official mp server?
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
gfgtdf
Developer
Posts: 1432
Joined: February 10th, 2013, 2:25 pm

Re: scenario_end event

Post by gfgtdf »

ok was able to reproduce this and made a report https://github.com/wesnoth/wesnoth/issues/4667 . This seems to be an engine bug, i'd reccomend that you just ignore it.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
Post Reply