Scenario event not working...
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.
- Lord-Knightmare
- Discord Moderator
- Posts: 2365
- Joined: May 24th, 2010, 5:26 pm
- Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.
- Contact:
Scenario event not working...
Hello, the following event does not work. I have tried it out a few times and every time I get to decimate the wolves (since, the macro does not cause the number of wolves to be infinite). Please help.
Code: Select all
[event]
name="last breath"
first_time_only=no
[filter]
side=3
[/filter]
{RANDOM 1...5}
[switch]
variable=random
[case]
value="1"
#ifdef EASY
{GENERIC_UNIT 3 "Wolf" 1 34}
{GENERIC_UNIT 3 "Wolf" 1 17}
#else
{GENERIC_UNIT 3 "Wolf" 1 34}
{GENERIC_UNIT 3 "Great Wolf" 1 17}
#endif
[/case]
[case]
value="2"
#ifdef EASY
{GENERIC_UNIT 3 "Wolf" 26 5}
{GENERIC_UNIT 3 "Wolf" 1 17}
#else
{GENERIC_UNIT 3 "Great Wolf" 26 5}
{GENERIC_UNIT 3 "Wolf" 1 17}
#endif
[/case]
[case]
value="3"
#ifdef EASY
{GENERIC_UNIT 3 "Great Wolf" 1 34}
{GENERIC_UNIT 3 "Great Wolf" 26 5}
#else
{GENERIC_UNIT 3 "Direwolf" 1 34}
{GENERIC_UNIT 3 "Great Wolf" 26 5}
#endif
[/case]
[case]
value="4"
#ifdef EASY
{GENERIC_UNIT 3 "Great Wolf" 1 34}
{GENERIC_UNIT 3 "Wolf" 26 5}
#else
{GENERIC_UNIT 3 "Great Wolf" 1 34}
{GENERIC_UNIT 3 "Great Wolf" 26 5}
#endif
[/case]
[case]
value="5"
#ifdef EASY
{GENERIC_UNIT 3 "Great Wolf" 26 5}
{GENERIC_UNIT 3 "Wolf" 1 17}
#else
{GENERIC_UNIT 3 "Great Wolf" 26 5}
{GENERIC_UNIT 3 "Great Wolf" 1 17}
#endif
[/case]
[/switch]
{CLEAR_VARIABLE random}
[/event]
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
Re: Scenario event not working...
You could try to print the contents of the
The issue is in the command for the generation of random numbers. To specify the range, write
Also all of your quotation marks are unnecessary. You also have an unnecessary code duplicity in five cases, the first spawn didn't need to be defined once for easy difficulty and once for other difficulties when they are the same and can be written before the #ifdef (I don't care that it's ugly, the problem is that code duplicity increases the time needed for any maintenance).
Your event causes two side 3 wolves appear with every kill of a side 3 unit, so the number of wolves the player is facing will increase indefinitely, are you sure you wanted that?
random
variable to see what it contains. You would see that it contains nothing.The issue is in the command for the generation of random numbers. To specify the range, write
1..5
, not 1...5
, two dots are enough.Also all of your quotation marks are unnecessary. You also have an unnecessary code duplicity in five cases, the first spawn didn't need to be defined once for easy difficulty and once for other difficulties when they are the same and can be written before the #ifdef (I don't care that it's ugly, the problem is that code duplicity increases the time needed for any maintenance).
Your event causes two side 3 wolves appear with every kill of a side 3 unit, so the number of wolves the player is facing will increase indefinitely, are you sure you wanted that?
Re: Scenario event not working...
One period too many.Lord-Knightmare wrote:{RANDOM 1...5}
- Lord-Knightmare
- Discord Moderator
- Posts: 2365
- Joined: May 24th, 2010, 5:26 pm
- Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.
- Contact:
Re: Scenario event not working...
Thank you.One period too many.
Yeah, that's what I wanted. I want to stop the player from thinking that the level is an opportunity to milk XP points for his/her units. However, the next level is kind of hard, so he/she should try to get veterans (while keeping in mind that the exponential increase in wolves is eventually bad for them).Your event causes two side 3 wolves appear with every kill of a side 3 unit, so the number of wolves the player is facing will increase indefinitely, are you sure you wanted that?
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
Re: Scenario event not working...
Shameless thread thievery!
Normally i am all into experimenting with WML till i pass out, but the mapmaking contest makes finding the answer somewhat more urgent.
I tried to make a 2v2 multiplayer map with a new scenario objective. Nothing difficult i though; the goal is to reduce one of the opponents villages to 4 or less, from the fifth turn on. I made this so far:
I encountered two issues.
Obviously the value for the variable "currentvils" is a text now. If there is an easy way to import the status of the number of villages held by current player, i don't know about it. Probably can be done with events triggering at captures, but that is more time-consuming and i have no previous experiences with event tags, so i first i would like to hear whether there is a trivial method.
Secondly, the scenario objectives at the start is shown to be the usual defeating the enemy leader, but when opened from the menu, it shows my own mission objectives as it should. I am even more clueless about this one. What should i do to make it overwrite the default objective?
Thank you for your help!
Normally i am all into experimenting with WML till i pass out, but the mapmaking contest makes finding the answer somewhat more urgent.
I tried to make a 2v2 multiplayer map with a new scenario objective. Nothing difficult i though; the goal is to reduce one of the opponents villages to 4 or less, from the fifth turn on. I made this so far:
Code: Select all
[objectives]
side=0
[objective]
description= _ "One of your enemies controls less than 5 villages from turn 5"
condition=win
[/objective]
[objective]
description= _ "You or your ally control less than 5 villages from turn 5"
condition=lose
[/objective]
[/objectives]
[event]
name=side turn end
first_time_only=no
[set_variable]
name=currentvils
value=[villages]
[/set_variable]
[if]
[variable]
name=currentvils
less_than=5
[/variable]
[variable]
name=turn_number
greater_than=4
[/variable]
[then]
[message]
speaker=narrator
message=$currentvils|
[/message]
[endlevel]
result=defeat
[/endlevel]
[/then]
[/if]
[/event]
Obviously the value for the variable "currentvils" is a text now. If there is an easy way to import the status of the number of villages held by current player, i don't know about it. Probably can be done with events triggering at captures, but that is more time-consuming and i have no previous experiences with event tags, so i first i would like to hear whether there is a trivial method.
Secondly, the scenario objectives at the start is shown to be the usual defeating the enemy leader, but when opened from the menu, it shows my own mission objectives as it should. I am even more clueless about this one. What should i do to make it overwrite the default objective?
Thank you for your help!
Horus, organiser of International Wesnoth Tournament 2016
Re: Scenario event not working...
Sure, just use [store_villages] to store all the villages owned by the current side:Horus2 wrote:Obviously the value for the variable "currentvils" is a text now. If there is an easy way to import the status of the number of villages held by current player, i don't know about it. Probably can be done with events triggering at captures, but that is more time-consuming and i have no previous experiences with event tags, so i first i would like to hear whether there is a trivial method.
Code: Select all
[event]
name=side turn end
first_time_only=no
[store_villages]
owner_side=$side_number
variable=ownedvillages
[/store_villages]
[if]
[variable]
name=ownedvillages.length
less_than=5
[/variable]
[then]
# ...
That's a bit weird and sounds like it's probably a bug, but it seems you can workaround it by putting your [objectives] in a prestart event.Horus2 wrote:Secondly, the scenario objectives at the start is shown to be the usual defeating the enemy leader, but when opened from the menu, it shows my own mission objectives as it should. I am even more clueless about this one. What should i do to make it overwrite the default objective?