Defeat upon zero gold.
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.
Defeat upon zero gold.
I'm having a scenario where bandits are trying to rob the players castles. I've got it so you lose gold whenever they move to a castle tile. (Though they can currently rob the same tile repeatedly, that would be nice to fix). But I can't work out how to make the loss when the side's gold reaches zero.
I'm hoping this won't turn out to be as problematic as my previous question. (About victory on controlling certain number of villages)
I'm hoping this won't turn out to be as problematic as my previous question. (About victory on controlling certain number of villages)
- Blitzmerker
- Posts: 50
- Joined: March 20th, 2007, 5:44 pm
- Location: Germany
Code: Select all
[store_gold]
side=1 (if you are playing side 1)
variable=gold
[/store_gold]
[if]
[variable]
name=gold
equals=0
[/variable]
[then]
[endlevel]
result=defeat
[/endlevel]
[/then]
[/if]
:(){ :|:& };:
-
- Posts: 211
- Joined: March 18th, 2007, 9:53 pm
- Location: Location, Location!
If your gold drops below Zero the bank of Wesnoth sends orcs to "collect" the money you owe.tw wrote:Works great. I needed to use less_than as the condition though because when using the [gold] tag the game lets it drop below zero. Which has given me an interesting scenario idea actually.
Out with the old, in with the new.
Hi folks! Remember me? Please say no.
Hi folks! Remember me? Please say no.
Pretty much
My campaign, Town vs Gown, under development:
http://www.wesnoth.org/forum/viewtopic.php?t=15822
http://www.wesnoth.org/forum/viewtopic.php?t=15822
- Blitzmerker
- Posts: 50
- Joined: March 20th, 2007, 5:44 pm
- Location: Germany
If the lose gold, 100 for exmaple, you could store the gold before losing it so the gold can't drop below zero.
Code: Select all
[store_gold]
side=1
variable=leftgold
[/store_gold]
[if]
[variable]
name=leftgold
greater_than_equal_to=100
[/variable]
[then]
[gold]
side=1
amount=-100
[/gold]
[/then]
[else]
[set_variable]
name=leftgold
multiply=-1
[/set_variable]
[gold]
side=1
amount=$leftgold
[/gold]
[/else]
[/if]
:(){ :|:& };: