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
Unit not able to claim towns
Various discussions of bats and blitz-claims of towns lead me to wonder if it was possible to make units unable to claim towns... I've got another idea for a unit for which the inability to claim towns would be both interesting and appropriate...
so, is this possible?
so, is this possible?
- Darker_Dreams
- Posts: 608
- Joined: February 1st, 2008, 5:26 pm
- Darker_Dreams
- Posts: 608
- Joined: February 1st, 2008, 5:26 pm
*blinks and goes to check again*AI wrote:you can assign village ownership through WML, and villages are only captured by moving *into* a village.
I see how to set starting villages in the scenarios, but I don't see a "give village" in either the wiki nor any of the scenarios I can think of. I don't really want to go line by line through every scenario I've got in hopes someone used it somewhere I've forgotten or haven't gotten to, do you happen to know where that tag would be used?
I couldn't care less about that part- you can move through a village without stopping, so I assume if you're targeting it with movement you're planning on stopping for healing or otherwise.AI wrote:So, you should be able to make this an ability, I'm just not sure if you can *not* have the move into the village take up all your remaining MP.
Another idea:
Instead of placing normal villages, just place the image as an item.
Then, whenever only the leader (or whatever you wanna use) stands on that item (tile, use moveto with the x,y filter), you modify the terrain tile into a village. That way, villages will only be captured when you want it to happen.
Another way of doing the same:
If you want to keep the village defense properties (60% of protection), but not the healing and income bonus, you can create a terrain that looks like a village (use aliasof when creating it, and disable healing and income), that way you will have the defense but not the other bonuses.
And when the leader (or whatever you use) reaches that tile, you change the terrain into a real village and give the player control of it (there is more than one tag to make this happen, check the wiki).
Hope this helps ;D
Instead of placing normal villages, just place the image as an item.
Then, whenever only the leader (or whatever you wanna use) stands on that item (tile, use moveto with the x,y filter), you modify the terrain tile into a village. That way, villages will only be captured when you want it to happen.
Another way of doing the same:
If you want to keep the village defense properties (60% of protection), but not the healing and income bonus, you can create a terrain that looks like a village (use aliasof when creating it, and disable healing and income), that way you will have the defense but not the other bonuses.
And when the leader (or whatever you use) reaches that tile, you change the terrain into a real village and give the player control of it (there is more than one tag to make this happen, check the wiki).
Hope this helps ;D
- Darker_Dreams
- Posts: 608
- Joined: February 1st, 2008, 5:26 pm
I don't want *all* the units to be unable to capture. I'm just considering a category of units which would be unlikely to "hold" a village or which are useful, but pariah among civilizations and unlikely to "conqure" the village. It's a unit *type* that I can see used across several scenarios.
-thus, I want the feature as an "ability" of the unit, not the scenario.
-thus, I want the feature as an "ability" of the unit, not the scenario.
What you need to make certain units (unit x) unable to capture villages is:
1. A side turn event which stores all villages into a variable and also records the info on who controls each village, every side turn (or at least on every side turn of every side which has unit x). The bold part is the annoying one; you'll have to create a big nested [if] checking whether the owner is side 1, if it's side 2, if it's side 3, etc.
2. A capture event for when unit x captures a village. Retrieve the previous owner side (or 0 if none) from the variables recorded in step 1. and set it as the village owner.
That's the best possible way according to my knowledge. Full undoability of moves except when unit x captures a village (since canceling the capture does necessarily invalidate undo).
1. A side turn event which stores all villages into a variable and also records the info on who controls each village, every side turn (or at least on every side turn of every side which has unit x). The bold part is the annoying one; you'll have to create a big nested [if] checking whether the owner is side 1, if it's side 2, if it's side 3, etc.
2. A capture event for when unit x captures a village. Retrieve the previous owner side (or 0 if none) from the variables recorded in step 1. and set it as the village owner.
That's the best possible way according to my knowledge. Full undoability of moves except when unit x captures a village (since canceling the capture does necessarily invalidate undo).
- Darker_Dreams
- Posts: 608
- Joined: February 1st, 2008, 5:26 pm
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;zookeeper wrote:What you need to make certain units (unit x) unable to capture villages is:
1. A side turn event which stores all villages into a variable and also records the info on who controls each village, every side turn (or at least on every side turn of every side which has unit x). The bold part is the annoying one; you'll have to create a big nested [if] checking whether the owner is side 1, if it's side 2, if it's side 3, etc.
2. A capture event for when unit x captures a village. Retrieve the previous owner side (or 0 if none) from the variables recorded in step 1. and set it as the village owner.
All I have to do is an array for the location and owner of the adjacent villages, when it finds any (in case the unit finds itself on a map has closely packed villages).
Because it checks current hex first, if it finds that it's on a village, it references the array from the previous hex, finds out who owned the village, and gives it back.
While I can filter for villages, I haven't yet found how to determine ask if a village is claimed or not- then I have to figure out arrays. (I am sooo not a programmer.)
This does, of course, happen for each step- so possibly too intensive.
Alternately, it only has to array the hexes of villages within it's movement radius- not the whole map before it moves.
It'd be easier to make the unit simply unclaim the village. I assume that I'd just have to do
[capture_village]
x,y
side=0
[/capture_village]
(unless there's some other "null" value for village ownership?)
Of course, I still have to figure out how to make the unit tell the macro where it is currently.
I was thinking about something similar to that, but I thought full undoability simply allowed the action to be undone, didn't force it. Even if it did force it, while that might be useful to prevent entry, it wouldn't allow a unit to move in and sit there.zookeeper wrote:That's the best possible way according to my knowledge. Full undoability of moves except when unit x captures a village (since canceling the capture does necessarily invalidate undo).
Question on the [capture_village] tag- I obviously haven't gotten everything together to make something to test- but the [capture_village] is listed as a scenario tag. Will this make the game choke, or are the pieces to WML fairly interchangable?
you're making this a lot harder than it is, zook.
the capture event already detects if you are truly making a capture
the capture event already detects if you are truly making a capture
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
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;
Try some Multiplayer Scenarios / Campaigns
Well, I am using a capture event to detect if the unit is making a capture, am I not? I just can't reset the village back to the original owner in the capture event, because the information about the previous owner is nowhere to be found unless I've stored it earlier.Sapient wrote:you're making this a lot harder than it is, zook.
the capture event already detects if you are truly making a capture
That said, I wouldn't indeed need anything more than a single capture event if the unit always removed all ownership of the village it moves into (except own/friendly villages, I guess), instead of doing nothing, which is what my way does (move into enemy village and the enemy doesn't lose control of it).