dabber's questions: vision to location
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.
dabber's questions: vision to location
Maybe these are more design questions than WML questions, but I feel like I'm missing something, so I'll ask anyway. Is there an easy way to set a side's current gold to a specific value, instead of adding to it? I seem to have figured out how to do it below, but I'm surprised there isn't a more direct way to do this.
This came up because I end up significantly in negative gold, which makes an an early finish bonus largely useless. So I'm thinking of forcing current gold to be >0 in the victory event. Am I missing something in code, or does no one ever want this sort of thing because my problem is really a scenario design failure?
This came up because I end up significantly in negative gold, which makes an an early finish bonus largely useless. So I'm thinking of forcing current gold to be >0 in the victory event. Am I missing something in code, or does no one ever want this sort of thing because my problem is really a scenario design failure?
Code: Select all
#define ZERO_GOLD SIDE
[store_gold]
side={SIDE}
variable=gold
[/store_gold]
[set_variable]
name=gold
multiply=-1
[/set_variable]
[gold]
side={SIDE}
amount=$gold
[/gold]
{CLEAR_VARIABLE gold}
#enddef
#define ZERO_NEGATIVE_GOLD SIDE
[store_gold]
side={SIDE}
variable=gold
[/store_gold]
[if]
[variable]
name=gold
greater_than=0
[/variable]
[then]
{ZERO_GOLD {SIDE}}
[/then]
[/if]
{CLEAR_VARIABLE gold}
#enddef
Last edited by dabber on January 23rd, 2024, 9:41 am, edited 21 times in total.
Re: dabber's questions: set gold, useless bonus
You can set a side's gold with [modify_side].
Re: dabber's questions: set gold, useless bonus
Well I feel dumb.
Re: dabber's questions: split recall list
What is the best way to go about splitting the recall list into two separate parts, selected by the user? The only method I can come up with is to create a dummy scenario with a fixed amount of gold, where the player recalls troops from the full list. The troops recalled become group 1 and the troops not recalled become group 2. But the dummy scenario seems, well, dumb.
Again this isn't exactly a WML question, but where else would I ask it?
Again this isn't exactly a WML question, but where else would I ask it?
Re: dabber's questions: split recall list
Well, that would depend on how you need things to work. If you need to have group A for scenario X and group B for scenario X+1, then the simplest way may be to make everyone not recalled in X available in X+1; that's how it's done in The South Guard.dabber wrote:What is the best way to go about splitting the recall list into two separate parts, selected by the user? The only method I can come up with is to create a dummy scenario with a fixed amount of gold, where the player recalls troops from the full list. The troops recalled become group 1 and the troops not recalled become group 2. But the dummy scenario seems, well, dumb.
Eh, I think this is as good a place as any.dabber wrote:Again this isn't exactly a WML question, but where else would I ask it?
Re: dabber's questions: leader stay in keep
I'm now spent over an hour reading AI documentation, and I'm both excited and brain fogged by the possibilities. But I didn't find what I'm after...
How do I let a side leader move and attack, but always stay inside his castle? I don't want him to be passive, because he's a bad dude, but I also want him to stop being an idiot and walking out into the open when he's got a 60% defense castle he could attack from.
How do I let a side leader move and attack, but always stay inside his castle? I don't want him to be passive, because he's a bad dude, but I also want him to stop being an idiot and walking out into the open when he's got a 60% defense castle he could attack from.
Re: dabber's questions: leader stay in castle
The simplest way to do that would be to manipulate movement costs so that the leader can't leave the castle on their own turn. Example from DiD in 1.11.16, where Darken Volk only gets to move inside his own castle and an adjacent village, all other surrounding terrain being flat:
I'm not sure what it was, but there was some reason for why it was better to do it like that instead of as proper AI behavior.
Code: Select all
# This helps prevent Darken from getting himself killed easily by preventing
# him from leaving his castle
[event]
name=side 2 turn refresh
first_time_only=no
[modify_unit]
[filter]
id=Darken Volk
[/filter]
[movement_costs]
flat=99
[/movement_costs]
[/modify_unit]
[event]
name=side turn end
[modify_unit]
[filter]
id=Darken Volk
[/filter]
[movement_costs]
flat=1
[/movement_costs]
[/modify_unit]
[/event]
[/event]
-
- Inactive Developer
- Posts: 2461
- Joined: August 15th, 2008, 8:46 pm
- Location: Germany
Re: dabber's questions: leader stay in castle
An extremely easy way is putting max_moves=1 into the leader definition (usually in the [side] tag).
That probably doesn't allow the leader to heal but works very well for that it is so simple. AI leaders also generally move back to their keep after an attack, so if there are 6 castle tiles around the keep, the leader should never leave 60% def.
I think I've never seen an AI leader attacking in a consecutive turn, after moving out of the keep, and not just because there was gold for recruitment.
Works generally better than passive_leader etc too, those settings are too bug-prone.
That probably doesn't allow the leader to heal but works very well for that it is so simple. AI leaders also generally move back to their keep after an attack, so if there are 6 castle tiles around the keep, the leader should never leave 60% def.
I think I've never seen an AI leader attacking in a consecutive turn, after moving out of the keep, and not just because there was gold for recruitment.
Works generally better than passive_leader etc too, those settings are too bug-prone.
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
Re: dabber's questions: leader go off to fight
How can I get a leader to finish recruiting and then follow his last wave of recruits into battle? He's a level 3 fighter, he doesn't have enough income to ever get back to positive gold, but he sits in his keep instead of joining battle. Sure he'll launch out occasionally for one attack, but then he returns to the keep.
Do I have to kill him and create another unit with the same name? Only thing I've thought of. Would it even work?
Do I have to kill him and create another unit with the same name? Only thing I've thought of. Would it even work?
Re: dabber's questions: leader go off to fight
Setting the leader's aggression high using the [ai] tag will increase his likelyhood of attacking. But I don't know of anything that will make a leader follow his troops into battle after recruiting. You could simulate that action by giving the leader some move to goals, again using the [ai] tag.
-=FL=-
-=FL=-
Wesnoth stole my summer . . . again.
- James_The_Invisible
- Posts: 538
- Joined: October 28th, 2012, 1:58 pm
- Location: Somewhere in the Northlands, fighting dark forces
- Contact:
Re: dabber's questions: leader go off to fight
If you are on Wesnoth 1.11.x, you can you use leader_ignores_keep. But you should set it to yes after he recruits the last wave else he would recruit only in first turn. Like this (not tested):
Code: Select all
[modify_side]
side=2 # change this to the right side if needed
[ai]
leader_ignores_keep=yes
[/ai]
[/modify_side]
Last edited by James_The_Invisible on August 17th, 2014, 3:29 pm, edited 1 time in total.
My content: For Power series
Ports: Danse Macabre Story of the Wose
Guides: How to translate your UMC
Ports: Danse Macabre Story of the Wose
Guides: How to translate your UMC
Re: dabber's questions: leader go off to fight
You can modify him asdabber wrote:Do I have to kill him and create another unit with the same name?
canrecruit=no
in a certain event, instead of killing him.Fate of a Princess/feedback thread: "What is in own heart that is the most important, not who you are."
Drake Campaign: Brave Wings/feedback thread, Naga Campaign: Return of the Monster, Saurian Campaign: Across the Ocean
Northern Forces - now on 1.12 server
Drake Campaign: Brave Wings/feedback thread, Naga Campaign: Return of the Monster, Saurian Campaign: Across the Ocean
Northern Forces - now on 1.12 server
Re: dabber's questions: leader go off to fight
I did the canrecruit=no modification first, but it didn't work.
James, thanks! That sounds like exactly what I want. The new AI options melted my brain last week so I didn't notice that one.
James, thanks! That sounds like exactly what I want. The new AI options melted my brain last week so I didn't notice that one.
Re: dabber's questions: leader go off to fight
I must be missing something obvious here, but how do I make a scenario end once all the enemies are dead, not just their leaders? I can set victory_when_enemies_defeated=no but then the scenario never ends.
- James_The_Invisible
- Posts: 538
- Joined: October 28th, 2012, 1:58 pm
- Location: Somewhere in the Northlands, fighting dark forces
- Contact:
Re: dabber's questions: leader go off to fight
I did this in my campaign this way:
(victory_when_enemies_defeated must be set to no for this to work.)
Code: Select all
[event]
name=die
first_time_only=no
[filter]
side=3
[/filter]
[if]
[have_unit]
side=3
[/have_unit]
[else]
[endlevel]
result=victory
bonus=yes
{NEW_GOLD_CARRYOVER 40}
[/endlevel]
[/else]
[/if]
[/event]
My content: For Power series
Ports: Danse Macabre Story of the Wose
Guides: How to translate your UMC
Ports: Danse Macabre Story of the Wose
Guides: How to translate your UMC