Error concerning variable comparison
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.
Error concerning variable comparison
The following code is supposed to replace villages when moved upon by opponents and - when a certain number have been replaced - make you lose.
For some reason, though, the scenario is lost the very first time the event is triggered.
I'm looking for an explanation to this problem. Any help is appreciated.
For some reason, though, the scenario is lost the very first time the event is triggered.
Code: Select all
[event]
name=prestart
{VARIABLE villages_destroyed 0}
#ifdef EASY
{VARIABLE maximum_villages_destroyed 14}
#endif
#ifdef NORMAL
{VARIABLE maximum_villages_destroyed 12}
#endif
#ifdef HARD
{VARIABLE maximum_villages_destroyed 10}
#endif
[/event]
[event]
name=moveto
first_time_only=no
[filter]
type=Red Mage
terrain=*^V
[/filter]
[terrain]
x,y=$x1,$y1
terrain=Rb
[/terrain]
[if]
[variable]
name=villages_destroyed
numerical_equals=0
[/variable]
[then]
[/then]
[/if]
{VARIABLE_OP (villages_destroyed) add (1)}
[if]
[variable]
name=villages_destroyed
greater_than=maximum_villages_destroyed
[/variable]
[then]
[endlevel]
result=defeat
[/endlevel]
[/then]
[/if]
[/event]
My campaigns: Princess Nilwyn (available) & Home of the Undead (available)
- Pentarctagon
- Project Manager
- Posts: 5564
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: Error concerning variable comparison
greater_than=maximum_villages_destroyed
should be greater_than=$maximum_villages_destroyed
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
take one down, patch it around
-2,147,483,648 little bugs in the code
Re: Error concerning variable comparison
Your moveto event filter also includes terrain= which means nothing in a StandardUnitFilter unless wrapped in a [filter_location] tag (which is what you want to do there).
Re: Error concerning variable comparison
I changed both of these, the location filter doesn't seem to work, though. Probably did something wrong. Here's my code:
Code: Select all
[event]
name=moveto
first_time_only=no
[filter]
type=Red Mage
[/filter]
[filter_location]
terrain=*^V
[/filter_location]
[terrain]
x,y=$x1,$y1
terrain=Rb
[/terrain]
[/event]
My campaigns: Princess Nilwyn (available) & Home of the Undead (available)
- beetlenaut
- Developer
- Posts: 2825
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: Error concerning variable comparison
[filter_location] is not part of [event]. It is part of the standard unit filter, so it goes inside the [filter] tag. It's a good idea to use the wiki to confirm that your tags are in the right place. That's what zookeeper was hinting at when he provided you with a link.
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