build village
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.
build village
I hope use [set_menu_item] add a "use 14 gold build village on map any" and "have build village",but WML is not work
use village WML in build.cfg and ANL.cfg(use ANL define)
edit:
and i hope player can any time(only need in player turn) give other player village,but I have absolutely no idea how to do it.(Alliances_Mod not have reference)
use village WML in build.cfg and ANL.cfg(use ANL define)
edit:
and i hope player can any time(only need in player turn) give other player village,but I have absolutely no idea how to do it.(Alliances_Mod not have reference)
- Attachments
-
- ProWesnothStart-modf.zip
- (1.79 KiB) Downloaded 48 times
- beetlenaut
- Developer
- Posts: 2827
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: build village
Did you post all your files? I don't see an event tag that activates the code in build.cfg. The [set_menu_item] tag must go inside an [event] tag. You can use a prestart event for this. Also, you have $x, $y, and $side in build.cfg, but I don't see any place where these variables were defined.
In the future, please don't tell us that "the WML doesn't work." Tell us what you want to happen, and what actually happens.
In the future, please don't tell us that "the WML doesn't work." Tell us what you want to happen, and what actually happens.
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
Re: build village
in mian cfg start:beetlenaut wrote: ↑January 6th, 2024, 6:46 am Did you post all your files? I don't see an event tag that activates the code in build.cfg. The [set_menu_item] tag must go inside an [event] tag. You can use a prestart event for this. Also, you have $x, $y, and $side in build.cfg, but I don't see any place where these variables were defined.
In the future, please don't tell us that "the WML doesn't work." Tell us what you want to happen, and what actually happens.
{~add-ons/ProWesnothStart-modf/ANL.cfg}
{~add-ons/ProWesnothStart-modf/ability.cfg}
{~add-ons/ProWesnothStart-modf/build.cfg}
i try use $x $y $side get player's side and hex,or is need other WML?
add [event] can not work,and game report bug:
[if] didn't find any [then],[elseif],or [else] children.
i know the report is expected(use change Gold/V WML)
not have other bug info.
For the needs behind "edit", I need similar WML reference,i don't know how do it.
- beetlenaut
- Developer
- Posts: 2827
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: build village
This line adds the code to your project, but it doesn't run that code. The code must be in an [event]. Otherwise, the code will never run.
This is not related to a new event, it is a problem with every [event] in main. The simplest [if] tag must look like this:
Code: Select all
[if]
# condition
[then]
# commands to run when the condition is true
[/then]
[/if]
_main.cfg
run without errors first, then you need to make the menu item appear. When that works correctly, you can focus on the next problems.The side currently playing is stored in $side_number, not $side. Inside [set_menu_item], the hex the user selected in stored in $x1 and $y1, not $x and $y. But, this information is not useful until you get the menu item to appear.
Edit: I should also mention that the code for the sliders is going to do nonsensical things, even if you fix the errors so that
_main.cfg
can run. You should probably just remove the slider events for now so you can focus on the menu item. That is the easier problem to fix.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
Re: build village
beetlenaut wrote: ↑January 6th, 2024, 7:55 amThis line adds the code to your project, but it doesn't run that code. The code must be in an [event]. Otherwise, the code will never run.This is not related to a new event, it is a problem with every [event] in main. The simplest [if] tag must look like this:I know you have other problems, but you need to makeCode: Select all
[if] # condition [then] # commands to run when the condition is true [/then] [/if]
_main.cfg
run without errors first, then you need to make the menu item appear. When that works correctly, you can focus on the next problems.
The side currently playing is stored in $side_number, not $side. Inside [set_menu_item], the hex the user selected in stored in $x1 and $y1, not $x and $y. But, this information is not useful until you get the menu item to appear.
Code: Select all
#define BUILD_V
{MODIFY_TERRAIN_OVERLAY "^Vh" $x1 $y1}
[capture_village]
x=$x1
y=$y1
side=$side_number
[/capture_village]
# The Flag for the village will be added immediately.
# The then macro will explicitely cause delays for half a second to play sounds.
# Redrawing here, so that the terrain will be redrawn at the same time when the flag is placed.
[redraw][/redraw]
#enddef
[event]
name=prestart
first_time_only=no
id=BV
[set_menu_item]
id=build_v
description=_"Build V"
#[filter_location]
#[/filter_location]
[command]
[if]
[variable]
name=gold
Greater_than_equal_to=14
[/variable]
[then]
[gold]
amount=-14
side=$side_number
[/gold]
{BUILD_V}
[/then]
[else]
[message]
speaker=narrator
message=_"You don't have enough gold to build V."
[/message]
[/else]
[/if]
[/command]
[/set_menu_item]
[/event]
and auto delete forest,if have forest in hex,i hope only add villvge
Re: build village
Greater_than_equal_to is not recognized key of [variable].
Re: build village
you sure?wiki have
https://wiki.wesnoth.org/ConditionalAct ... ariable.5D
if it,how check gold >= 14?
Re: build village
That one has greater_than_equal_to but no Greater_than_equal_to.
You also need to somehow fill variable of gold, possibly by storing.
You also need to somehow fill variable of gold, possibly by storing.
Re: build village
How get play gold?use value=$side_number.gold in event not work.
- beetlenaut
- Developer
- Posts: 2827
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: build village
You should go to the wiki and read the list of the tags that are available on the right side of the screen. That works better than guessing, which seems to be your current method. One of the tags in the list is [store_gold]. You can use something like this:
Code: Select all
[store_gold]
side=$side_number
variable=current_sides_gold
[/store_gold]
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
Re: build village
Ok,is work,but auto delete forest,if have forest in build hex,i hope only add villvge.beetlenaut wrote: ↑January 7th, 2024, 4:34 am You should go to the wiki and read the list of the tags that are available on the right side of the screen. That works better than guessing, which seems to be your current method. One of the tags in the list is [store_gold]. You can use something like this:Code: Select all
[store_gold] side=$side_number variable=current_sides_gold [/store_gold]
- beetlenaut
- Developer
- Posts: 2827
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: build village
Wouldn't a person cut down trees to build a house?
You seem to want one hex to be forest and village at the same time, which can't happen in the game. There must be separate terrains in each hex. If you mean that you want to see a building with trees surrounding it very close to its walls, you would need to draw that yourself, and create terrain codes for it too. I don't think anyone has done this before because it would be a lot of work: There would be thousands of possibilities of tree and building types mixed together, and it wouldn't really benefit the game very much.
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
Re: build village
I use code check variable ovwerbeetlenaut wrote: ↑January 7th, 2024, 5:48 amWouldn't a person cut down trees to build a house?
You seem to want one hex to be forest and village at the same time, which can't happen in the game. There must be separate terrains in each hex. If you mean that you want to see a building with trees surrounding it very close to its walls, you would need to draw that yourself, and create terrain codes for it too. I don't think anyone has done this before because it would be a lot of work: There would be thousands of possibilities of tree and building types mixed together, and it wouldn't really benefit the game very much.
var GVL:
Code: Select all
[store_locations]
x=$x1
y=$y1
variable=GVL
[/store_locations]
Code: Select all
[variable]
name=side_number
numerical_equals=$GVL.owner_side
[/variable]
I'm read wiki [store_locations] and [if] but can not fix.
- beetlenaut
- Developer
- Posts: 2827
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: build village
The code you posted works. The error must be somewhere else. If you post the whole scenario, we will probably be able to find it.
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
Re: build village
This full add-on file,BUG code in give.cfgbeetlenaut wrote: ↑January 7th, 2024, 8:17 am The code you posted works. The error must be somewhere else. If you post the whole scenario, we will probably be able to find it.
- Attachments
-
- ProWesnothStart-modf.zip
- (3.55 KiB) Downloaded 28 times