A few questions (change sides mid-scenaro, unit duplication)
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.
- Ken_Oh
- Moderator Emeritus
- Posts: 2178
- Joined: February 6th, 2006, 4:03 am
- Location: Baltimore, Maryland, USA
A few questions (change sides mid-scenaro, unit duplication)
These are for an Undead campaign that I'm working on. I'm also quite the newbie so mass excuses for my ignorance and inability.
#1. Is it possible to change combat sides mid scenario? I'd like to give the option to turn against your master. Would I be able to do that mid-scenario or should I just give that option pre-scenario?
#2. Can you change the sides of specific units mid-scenario? Think of 2 Liches fighting for the control of the minds of undead units.
#3. I want to change the Walking Corpse line to have the ability to replicate itself when on a village. Think of it as an ability to harvest townsfolk unto Walking Corpses.
I'm a beginner with WML so I'm ripping the Mermen cages from the HttT Bay of Pearls campaign.
Here's what I've got: a small bit of code (which may very well be broken) that would be specific to each map in the campaign. Consider there is a village at coords 4,5.
The next questions:
4. Did I do anything glaringly stupid? Is this just not going to work?
5. Can those filters be used for "new turn"?
6. The "new turn" event means right before your own turn starts, right?
7. I didn't see any syntax for stuff I was looking for, like "or." I'd want to filter for WCs or Soullesses. How can I do that and is there a doc that I obviously missed?
8. How can I make it choose to place the WC somewhere else if coords 4,6 are already occupied?
I'd like to think that I'm not biting off more than I can chew for my first campaign. There are just a few options I'd like to work with to make it unique. The most desired of all is to make Walking Corpses more useful.
Any help is much appreciated.
#1. Is it possible to change combat sides mid scenario? I'd like to give the option to turn against your master. Would I be able to do that mid-scenario or should I just give that option pre-scenario?
#2. Can you change the sides of specific units mid-scenario? Think of 2 Liches fighting for the control of the minds of undead units.
#3. I want to change the Walking Corpse line to have the ability to replicate itself when on a village. Think of it as an ability to harvest townsfolk unto Walking Corpses.
I'm a beginner with WML so I'm ripping the Mermen cages from the HttT Bay of Pearls campaign.
Here's what I've got: a small bit of code (which may very well be broken) that would be specific to each map in the campaign. Consider there is a village at coords 4,5.
Code: Select all
[event]
name=new turn
[filter]
side=1
x=4
y=5
type=Walking Corpse
[/filter]
[unit]
side=1
x=4
y=6
type=Walking Corpse
[/unit]
[/event]
4. Did I do anything glaringly stupid? Is this just not going to work?
5. Can those filters be used for "new turn"?
6. The "new turn" event means right before your own turn starts, right?
7. I didn't see any syntax for stuff I was looking for, like "or." I'd want to filter for WCs or Soullesses. How can I do that and is there a doc that I obviously missed?
8. How can I make it choose to place the WC somewhere else if coords 4,6 are already occupied?
I'd like to think that I'm not biting off more than I can chew for my first campaign. There are just a few options I'd like to work with to make it unique. The most desired of all is to make Walking Corpses more useful.
Any help is much appreciated.
Re: A few questions (change sides mid-scenaro, unit duplicat
All of those things (#1, #2, #3) can be done, even relatively easily. I'll write more about the details in a minute, stay tuned...
Re: A few questions (change sides mid-scenaro, unit duplicat
Yes, that can be done. Use [modify_side] to set a different team_name for one of the allied sides. Since their team_names are no longer identical, they'll become enemies.Ken Oh wrote:#1. Is it possible to change combat sides mid scenario? I'd like to give the option to turn against your master. Would I be able to do that mid-scenario or should I just give that option pre-scenario?
Grab the MODIFY_UNIT macro from the WML Utilities page, and use that in an event to change a unit or a group of units to a different side. For example to flip all vampire bats to side 3, use:Ken Oh wrote:#2. Can you change the sides of specific units mid-scenario? Think of 2 Liches fighting for the control of the minds of undead units.
Code: Select all
{MODIFY_UNIT (type=Vampire Bat) side 3}
The following would duplicate all side 2 walking corpses that are in a village at the start of side 2's turn (which I think is the most logical time). Note that you need the macros IF and IF_TERRAIN from the aforementioned page for this.Ken Oh wrote:#3. I want to change the Walking Corpse line to have the ability to replicate itself when on a village. Think of it as an ability to harvest townsfolk unto Walking Corpses.
Code: Select all
[event]
name=side turn
first_time_only=no
{IF side_number equals 2 (
[then]
[store_unit]
[filter]
side=2
type=Walking Corpse
[/filter]
variable=temp
kill=no
[/store_unit]
{FOREACH temp i}
{VARIABLE_OP spawn_x format "$temp[$i].x"}
{VARIABLE_OP spawn_y format "$temp[$i].y"}
{IF_TERRAIN $spawn_x $spawn_y AaBbDeLptUVvYZ (
[then]
[unit]
type=Walking Corpse
side=1
x=$spawn_x
y=$spawn_y
[/unit]
[/then]
)}
{NEXT i}
{CLEAR_VARIABLE temp}
[/then]
)}
[/event]
That example, obviously, only makes the spawning work for side 2. So you might want to make it a macro, which takes the side as an argument, like this:
Code: Select all
#define VILLAGES_DUPLICATE_CORPSES SIDE
# copypaste here all the above code, just replace occurrences of [i]side=2[/i] with [i]side={SIDE}[/i]
#enddef

No, new turn does not take any filters. Like the EventWML page says, new turn events always trigger when the last player finishes their turn.Ken Oh wrote:4. Did I do anything glaringly stupid? Is this just not going to work?
5. Can those filters be used for "new turn"?
In campaigns, the player practically always controls side 1, so yes.Ken Oh wrote:6. The "new turn" event means right before your own turn starts, right?
There isn't a direct "or", but you can use a [not] in [filter]s. Take a closer look at the FilterWML page, there are even a few good examples (rare!) of it's use there.Ken Oh wrote:7. I didn't see any syntax for stuff I was looking for, like "or." I'd want to filter for WCs or Soullesses. How can I do that and is there a doc that I obviously missed?
If you try to create a unit on top of another, the new unit will go to the nearest free hex instead, so you can just place it on top of the other one, like I did in the above example.Ken Oh wrote:8. How can I make it choose to place the WC somewhere else if coords 4,6 are already occupied?
- Ken_Oh
- Moderator Emeritus
- Posts: 2178
- Joined: February 6th, 2006, 4:03 am
- Location: Baltimore, Maryland, USA
OK, I spent a lot of today trying to work this out and haven't been able to make WCs duplicate themselves. I tried to build the macro like you suggested and put it into the scenario as such:
I'm just too newbie to have built something like that myself. I think I see what you did, but it's just not working for me yet. I even put down a line of AaBbDeLptUVvYZ in a map to see if it would work.
I'll keep cracking with this but I'm afraid it's a little too over my head for me to see anything obvious.
FYI, I am using v1.1.1, if that makes a difference.
Code: Select all
#define VILLAGES_DUPLICATE_CORPSES SIDE
[event]
name=side turn
first_time_only=no
{IF side_number equals {SIDE} (
[then]
[store_unit]
[filter]
side={SIDE}
type=Walking Corpse
[/filter]
variable=temp
kill=no
[/store_unit]
{FOREACH temp i}
{VARIABLE_OP spawn_x format "$temp[$i].x"}
{VARIABLE_OP spawn_y format "$temp[$i].y"}
{IF_TERRAIN $spawn_x $spawn_y AaBbDeLptUVvYZ (
[then]
[unit]
type=Walking Corpse
upkeep=full
side={SIDE}
x=$spawn_x
y=$spawn_y
[/unit]
[/then]
)}
{NEXT i}
{CLEAR_VARIABLE temp}
[/then]
)}
[/event]
#enddef
{VILLAGES_DUPLICATE_CORPSES 1}
I'll keep cracking with this but I'm afraid it's a little too over my head for me to see anything obvious.
FYI, I am using v1.1.1, if that makes a difference.