A way to make some units or all units unable to conquer?

The place to post your WML questions and answers.

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.
Post Reply
Fosprey
Posts: 254
Joined: January 25th, 2008, 8:13 am

A way to make some units or all units unable to conquer?

Post by Fosprey »

In my era i want that only some units or no units (depending on what´s easier) to be able to change the side of a village terrain.
I want to make something like a modified version of a new land. Where you build terrain tiles and they are of your own. But i don´t want the opponent or anyone to be able to conquer it. I can´t figure a way because i want the tile to be counted as a village, but i don´t want player interaction to change who owns the village. I hope I made myself clear.
User avatar
beetlenaut
Developer
Posts: 2825
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: A way to make some units or all units unable to conquer?

Post by beetlenaut »

Possible, I think, but complicated. You can use owner_side in [filter_location] to create a list of who owns each village. Then, on each capture event, you can use [capture_village] to immediately give the village back to its previous owner. That should work. You could also filter the capture event to only fire for some units.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Re: A way to make some units or all units unable to conquer?

Post by Sapient »

Code: Select all

[event]
 name="side turn"
 first_time_only=no
 [store_villages]
  [not]
    owner_side=$side_number
  [/not]
  variable=unowned_villages
 [/store_villages]
[/event]

[event]
 name="capture"
 first_time_only=no
 [filter]
  type=BadUnitType # CHANGE THIS
  [filter_location]
    find_in=unowned_villages
  [/filter_location]
 [/filter]
 {FOREACH unowned_villages i}
  [if]
   [variable]
    name=unowned_villages[$i].x
    equals=$x1
   [/variable]
   [variable]
    name=unowned_villages[$i].y
    equals=$y1
   [/variable]
   [then]
    [capture_village]
     x,y=$x1,$y1
     side=$unowned_villages[$i].owner_side
    [/capture_village]
   [/then]
  [/if]
 {NEXT i}
[/event]
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
Fosprey
Posts: 254
Joined: January 25th, 2008, 8:13 am

Re: A way to make some units or all units unable to conquer?

Post by Fosprey »

I didn´t test it yet but thank you very much for the extense reply
Post Reply