Apply AMLA effect to other unit

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
User avatar
WhiteWolf
Forum Moderator
Posts: 769
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Apply AMLA effect to other unit

Post by WhiteWolf »

Hello,

I wish create an [advancement], that has it's effect not on the advancing unit, but some other units when it selected.
I see that [effect] accepts a [filter] argument, but doesn't seem to work - the advancement seems to force its effects only on the advancing unit, so using a filter with another unit means it won't match and nothing happens.

So I thought I'd make the advancement a dummy choice, and I'd use a post advance event. However, how do I filter in the event for the chosen advancement (there are lots of available options)?

Code: Select all

[event]
    name=post advance
    [filter]
        id=the_advancing_unit
        ????? -> Only if the advancement with "dummy_adv_foo_id" had been chosen
    [/filter]
[/event]
What goes to the ??? part? :D I couldn't figure it out yet. Thanks!
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
User avatar
Ravana
Forum Moderator
Posts: 2949
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Apply AMLA effect to other unit

Post by Ravana »

Advancement could add dummy new_ability, and filter based on that.
gfgtdf
Developer
Posts: 1432
Joined: February 10th, 2013, 2:25 pm

Re: Apply AMLA effect to other unit

Post by gfgtdf »

Note that your solution might add the bo uses again the next time the unit advances oven if the player chooses a different advancement at that time. So in your post advance event you need to add some code to remember that the effects are already applied. But ravanas solution is probably what if also do. ( Or use an effect that sets a variable)
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
User avatar
WhiteWolf
Forum Moderator
Posts: 769
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: Apply AMLA effect to other unit

Post by WhiteWolf »

Perfect, thanks :)

The modifications to the other unit are done through an object with an ID and take_only_once=yes, that should prevent it from getting stacked up. :)
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
User avatar
Celtic_Minstrel
Developer
Posts: 2166
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Apply AMLA effect to other unit

Post by Celtic_Minstrel »

Setting take_only_once=yes on the object probably won't do what you want - it will mean that the effect happens only the first time a unit of that type chooses that advancement. Using an ID probably won't have the correct effect, either, assuming the idea is to affect units near the advancing unit - it'll mean that any given unit can receive the benefit of the effect exactly once.

If the unit with this advancement is a unique hero unit though, none of that matters; all of the above assumes there could be more than one of the unit on the field.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
Post Reply