Counting event difficulties
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.
Counting event difficulties
Hi all,
As some of you know, I am trying to revive the Orbivm project. So far, this has meant bugfixes for the Imperial Era and porting some campaigns 1.8. I am currently fixing up the campaign "Up from Slavery". I am having problems with a scenario where you have to kill a specific number of enemy units and I can't figure out how to fix it. Below is the code that seems to be the problem:
The event is firing because Gravirus says "one more!" every time I kill an enemy. However units_slain does not seem to get incremented. Using debug, I checked the current values of the variable and it is always 0 regardless of how many units I kill.
Thanks for any help
Note: if you need more code let me know. The campaign isn't on the addons server yet.
2nd note: This code is for Wesnoth 1.8 if that wasn't clear from above.
As some of you know, I am trying to revive the Orbivm project. So far, this has meant bugfixes for the Imperial Era and porting some campaigns 1.8. I am currently fixing up the campaign "Up from Slavery". I am having problems with a scenario where you have to kill a specific number of enemy units and I can't figure out how to fix it. Below is the code that seems to be the problem:
Code: Select all
[event]
name=die
first_time_only=no
[filter]
side=2
[/filter]
[message]
id=Grarivus
message= _ "one more!"
[/message]
[set_variable]
variable=units_slain
add=1
[/set_variable]
[/event]
Thanks for any help
Note: if you need more code let me know. The campaign isn't on the addons server yet.
2nd note: This code is for Wesnoth 1.8 if that wasn't clear from above.
Current maintainer of the Orbivm project (as of February 2011)
Orbivm Forums
Orbivm Forums
-
- Developer
- Posts: 546
- Joined: January 12th, 2011, 2:18 am
- Location: Pennsylvania, USA
Re: Counting event difficulties
Code: Select all
[set_variable]
name=units_slain
add=1
[/set_variable]
Also you could use the macro VARIABLE_OP as follows instead of the above:
{VARIABLE_OP units_slain add 1}
Co-Author of Winds of Fate
My Add-ons: Random Campaign, Custom Campaign, Ultimate Random Maps, Era of Legends, Gui Debug Tools
Erfworld: The comic that lead me to find Wesnoth.
My Add-ons: Random Campaign, Custom Campaign, Ultimate Random Maps, Era of Legends, Gui Debug Tools
Erfworld: The comic that lead me to find Wesnoth.
Re: Counting event difficulties
here's something quite similar (HTTT, scenario 23):
i'd prefer [print] - it doesn't interrupt like [message] does...
Code: Select all
[event]
name=last breath
first_time_only=no
[filter]
side=2,3,4,5
[/filter]
{VARIABLE_OP units_to_slay add -1}
[if]
[variable]
name=units_to_slay
numerical_equals=0
[/variable]
[then]
[message]
speaker=Delfador
message= _ "We are routing their forces! Let's see if the Clan has had enough. Their help in guarding our flanks will be invaluable."
[/message]
{BONUS_VICTORY}
[/then]
[else]
[print]
text= _ "Still $units_to_slay clan members to defeat!"
size=18
red,green,blue=255,255,255
[/print]
[/else]
[/if]
[/event]
Re: Counting event difficulties
Thanks guys! It works now. Your ideas and suggestions have helped me clean up some of the logic for the scenario as well
Current maintainer of the Orbivm project (as of February 2011)
Orbivm Forums
Orbivm Forums