more scenario endings? [endlevel]
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.
more scenario endings? [endlevel]
Hey there!
I was wondering if it was possible to create more scenario endings then victory and defeat. I know [endlevel] result= only accepts those two, but im more interested in making the textbox say something different, like "retreat" and then be able to move on to the next scenario in the campaign. Is this possible without too much high level coding?
thx in advance!
I was wondering if it was possible to create more scenario endings then victory and defeat. I know [endlevel] result= only accepts those two, but im more interested in making the textbox say something different, like "retreat" and then be able to move on to the next scenario in the campaign. Is this possible without too much high level coding?
thx in advance!
- Spannerbag
- Posts: 505
- Joined: December 18th, 2016, 6:14 pm
- Location: Yes
Re: more scenario endings? [endlevel]
Hi,
There may be a way to hack the messages using lua (I have no idea how to do that!).
Off the top of my head the only way I can think of doing this within WML would be to change
You can optionally change the music from victory/defeat (never tried this and I'm not crystal clear how to do this after skimming through the docs but I think
If you set
So the code below might provide a starting point?
This assumes no carryover and no replay save - not sure offhand if setting
Note that as well as
( https://wiki.wesnoth.org/InterfaceActionsWML#.5Bprint.5D )
which can be used to display an end of scenario splash though I'm not sure if you could easily replicate the standard end of level display?
Might be worth experimenting?
Hope this helps, cheers,
-- Spannerbag
There may be a way to hack the messages using lua (I have no idea how to do that!).
Off the top of my head the only way I can think of doing this within WML would be to change
[endlevel]
to basically suppress everything then insert your stuff before [endlevel]
executes.You can optionally change the music from victory/defeat (never tried this and I'm not crystal clear how to do this after skimming through the docs but I think
victory_music=my_victory_music
and defeat_music=my_defeat_music
might work). IMHO it's probably best to set victory_music
to silence.ogg
and play your own music track(s) and/or sound(s) before reaching the [endlevel]
tag.If you set
carryover_report=no
and linger_mode=no
then the game shouldn't pause when the scenario ends.So the code below might provide a starting point?
This assumes no carryover and no replay save - not sure offhand if setting
replay_save=yes
(or equivalently omitting it) results in the game pausing during [endlevel]
(not in a position to easily/quickly test this right now).Code: Select all
...
... custom victory WML here
...
[endlevel]
result=victory
victory_music=silence.ogg
carryover_report=no
linger_mode=no
replay_save=no
bonus=no
carryover_add=no
carryover_percentage=0
[/endlevel]
[message]
there is [print]
( https://wiki.wesnoth.org/InterfaceActionsWML#.5Bprint.5D )
which can be used to display an end of scenario splash though I'm not sure if you could easily replicate the standard end of level display?
Might be worth experimenting?
Hope this helps, cheers,
-- Spannerbag
- beetlenaut
- Developer
- Posts: 2814
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: more scenario endings? [endlevel]
It is possible, but the answer to your question depends on whether you would consider Lua to be "high level coding." Lua has a show_dialog function, so it can be used to put up a custom dialog box. You could display one similar to the normal one, then suppress the normal one like Spannerbag said.
The whole thing would probably only take a dozen lines of Lua code, and I'm sure you could copy most of it from somewhere. You could get help with it in the Lua Labs forum too.
The whole thing would probably only take a dozen lines of Lua code, and I'm sure you could copy most of it from somewhere. You could get help with it in the Lua Labs forum too.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
Re: more scenario endings? [endlevel]
Well, I think Spannerbag is right, that is the easiest way to do that. You can trigger an event that causes the end of a level. You don't need lua for that. It could be triggered by an event or a message option. I do that a lot. I would add a "next_scenario" to the endlevel. This way you could for define which scenario you enter next - for example when you decide to retreat you will enter a different scenario in the next level, when you win you could continue normally.
Instead of {NEXT_SCENARIO} you have to add the name of the scenario you wan to enter.
However you don't receive a bonus here and the game doesn't save.
Code: Select all
[endlevel]
result=victory
next_scenario={NEXT_SCENARIO}
save=no
carryover_report=no
carryover_percentage=100
linger_mode=no
bonus=no
[/endlevel]
However you don't receive a bonus here and the game doesn't save.
The future belongs to those, who believe in the beauty of their dreams.
Developer of: Trapped, Five Fates, Strange Legacy, Epical, UR Epic Era
Dungeonmasters of Wesnoth, Wild Peasants vs Devouring Corpses, Dwarf Dwarfson Dwarvenminer
Developer of: Trapped, Five Fates, Strange Legacy, Epical, UR Epic Era
Dungeonmasters of Wesnoth, Wild Peasants vs Devouring Corpses, Dwarf Dwarfson Dwarvenminer