Unit not able to claim towns
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.
- Darker_Dreams
- Posts: 608
- Joined: February 1st, 2008, 5:26 pm
Wait... can I just get the data on the hex moveto targets? No mucking around with arrays, just check the properties of the target hex?Rhuvaen wrote:Don't do that - you'll be disappointed. The moveto event fires on hexes a unit ends its move on - and it doesn't fire on intervening hexes. So unless the player moves one hex at a time, he won't trigger an "adjacent" event first.Darker_Dreams wrote:I was trying to simply run against the terrain the unit was on, then adjacent to. They have to be adjacent before they can be on... so;
let's keep it simple:
Code: Select all
#wmllint: unbalanced-on
#define ABILITY_NO_CAPTURE
[dummy]
id=no_capture
name= _ "no capture"
description= _ "No capture:
This unit is unable to fully capture villages, though it does drive off the previous owners"
[/dummy]
[/abilities]
[event]
name=capture
[filter]
ability=no_capture
[/filter]
[capture_village]
x,y=$x,$y
[/capture_village]
[/event]
[+abilities]
#enddef
#wmllint: unbalanced-off
But you're not going to use moveto, right? Not when you have a more specific event at hand (capture).Darker_Dreams wrote:Wait... can I just get the data on the hex moveto targets? No mucking around with arrays, just check the properties of the target hex?
Really, zookeeper basically spelt it out. In the dev version, you can store all villages into an array with [store_villages]. That stores ownership for you, too (in case you wanted to keep the original owner as per the original idea). The capture event should filter on the ability, as AI's example did.
Try some Multiplayer Scenarios / Campaigns
- Darker_Dreams
- Posts: 608
- Joined: February 1st, 2008, 5:26 pm
My work on this is on hold until I can figure out why I can get Wesnoth to recognize that I've made a test-era, but not any of the files in that test-era's directory.Rhuvaen wrote:But you're not going to use moveto, right? Not when you have a more specific event at hand (capture).Darker_Dreams wrote:Wait... can I just get the data on the hex moveto targets? No mucking around with arrays, just check the properties of the target hex?
Really, zookeeper basically spelt it out. In the dev version, you can store all villages into an array with [store_villages]. That stores ownership for you, too (in case you wanted to keep the original owner as per the original idea). The capture event should filter on the ability, as AI's example did.
You need to include any directory explicitly, subdirectories won't be loaded automatically. If the directory is included, either _main.cfg or all .cfg's in the directory should be loaded.Darker_Dreams wrote: My work on this is on hold until I can figure out why I can get Wesnoth to recognize that I've made a test-era, but not any of the files in that test-era's directory.
- Darker_Dreams
- Posts: 608
- Joined: February 1st, 2008, 5:26 pm
I have included the directory and all subdirectories. (Even some I've since emptied to get extra stuff out of the way!) If I leave the .cfg setting it up external to the folder (test_era.cfg) it finds the MP settings in the internal test_era.cfg. If I try to do a _main.cfg it doesn't find it.CIB wrote:You need to include any directory explicitly, subdirectories won't be loaded automatically. If the directory is included, either _main.cfg or all .cfg's in the directory should be loaded.Darker_Dreams wrote: My work on this is on hold until I can figure out why I can get Wesnoth to recognize that I've made a test-era, but not any of the files in that test-era's directory.
At the moment, the entire era consists of the 2 .cfg's (one of which is almost entirely a copy-paste of the Loyalist faction) and an .png in a file folder, that I've made certain is correctly referenced as many ways as possible. This has included checking against the wiki, which is somewhat confusing/lacking some particular details or explanations (especially in the case where something goes wrong!). Also, I've tried comparing against several different eras which are equally confusing because they each do the same things in different ways, plus they generally do several other things too.
It's gotten particularly frustrating, because I had it working, then *something* I did when putting a new unit in to test (actually a unit using code from this discussion- and some other code I hadn't used before) the thing started spitting out errors. I got it to quit giving me errors- by removing the unit with the intent to add it back piece by piece, but it's continued to waver between not being found at all and giving "unexpected character" errors. I finally got it to quit giving errors, but it's just not finding the listed subdirectories.
short answer; if there's one thing that I'm certain of, its that all the subdirectories are listed. What I'm not sure of is if there should be some @, ~, or # included in that (I know I've seen some combination of all those characters working) or if there's some other arcane character I've managed to omit or include incorrectly (\, /, etc) or if I've completely missed the boat on something necessary to make it work.
blah.
sorry for ranting.
- Darker_Dreams
- Posts: 608
- Joined: February 1st, 2008, 5:26 pm
So, I decided to just go back to cutting into the core units and files.
This might sound insultingly basic, but please recognize that I'm asking because I actually don't know;
x,y=$x,$y
I assume this is intended to pass the x,y of the primary_unit to the [capture_village] function.
1) Does the unit in question remain the primary_unit for this event because it's calling for the event? units are deselected upon receiving their commands, so I assume it's no longer "active."
2) $x,$y calls a stored x,y value, but without defining it will it automatically call the x,y of the primary_unit (or desired unit)- or does something need to be done to store those?
This displayed the name/disc ok (both if inserted in the unit itself and if added to the abilities file and referenced thus), but it did not prevent the unit from capturing/recapturing the village. The only thing I saw was possibly a (lack of) first_time_only=no in the event... but it still didn't seem to do it.AI wrote:let's keep it simple:
This might sound insultingly basic, but please recognize that I'm asking because I actually don't know;
x,y=$x,$y
I assume this is intended to pass the x,y of the primary_unit to the [capture_village] function.
1) Does the unit in question remain the primary_unit for this event because it's calling for the event? units are deselected upon receiving their commands, so I assume it's no longer "active."
2) $x,$y calls a stored x,y value, but without defining it will it automatically call the x,y of the primary_unit (or desired unit)- or does something need to be done to store those?
reading the documentation in the Wiki, it looks like I'll need to make several arrays (an array of arrays?), picking up the villages owned by each team (and none). is there's something (I'm) missing in that description that will make it less intensive.Rhuvaen wrote:But you're not going to use moveto, right? Not when you have a more specific event at hand (capture).Darker_Dreams wrote:Wait... can I just get the data on the hex moveto targets? No mucking around with arrays, just check the properties of the target hex?
Really, zookeeper basically spelt it out. In the dev version, you can store all villages into an array with [store_villages]. That stores ownership for you, too (in case you wanted to keep the original owner as per the original idea). The capture event should filter on the ability, as AI's example did.
- Darker_Dreams
- Posts: 608
- Joined: February 1st, 2008, 5:26 pm
Neither do I (which is why I started this exercise, and was asking questions to make sure I understand what you're doing), but when grafted into the vampire bat's .cfg (or the abilities file and the ability grafted into the bat) the thing still zipped over and claimed a town like there was nothing different.AI wrote:the first_time_only=no was indeed missing.
I haven't tested it, but I don't see anything else wrong with it...
Though, it did swear the whole time it couldn't do anything of the sort so I called it a liar and hit it with a big stick.
(I've found that a vary satisfying feature about working on units- when they don't work like they're supposed to I can call them defective and beat them up for it. It's great stress relief compared to eras, which just sit there and laugh as I fail to find the problem.)