Bitrons WML Questions

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.
User avatar
Ravana
Forum Moderator
Posts: 3003
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: [Ability] - Inspiration

Post by Ravana »

I meant conditions if $x1= and $y1=

I do not see where you define X and Y.
User avatar
Bitron
Developer
Posts: 453
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: [Ability] - Inspiration

Post by Bitron »

x,y=X,Y <-- those are placeholder for the acutal coordinates of a village.

Depends on wich Village Ysedda will reach, she will tell a variable name. (:
User avatar
Bitron
Developer
Posts: 453
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: [Ability] - Inspiration

Post by Bitron »

And once again I desperately need your help.

in one scenario, i want the opponent team not to move at first. thats why I set the ai_special from all of them to guardian with {MODIFY_UNIT side=2 ai_special guardian}

But there is a point in the game, I wan't them to move again, of course. But i have no clue how to take away the guardian status from the opponent team :/

hope you can help me out with it and best wishes

- Bitron
User avatar
Ravana
Forum Moderator
Posts: 3003
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: [Ability] - Inspiration

Post by Ravana »

Why not just remove all mp where needed?

Or when doing so each turn is too slow, then modify max_mp.
User avatar
Bitron
Developer
Posts: 453
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: [Ability] - Inspiration

Post by Bitron »

The point of changing the behavior is variable. it could be second turn, it also could be the 20th turn.
It depends on when you get cought by the orcs, which you don't want to.

And if i'd take the maximum movementpoints of all units, it's quite hard to give them those specific points back.

Well, i could use a variable for filtering if they discovered me or not.
User avatar
Bitron
Developer
Posts: 453
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: [Ability] - Inspiration

Post by Bitron »

Who does the {MODIFY_UNIT side=2 moves 0} work in event name=side 2 turn 1 but not in event name=side 2 turn 2 ?

Code: Select all

    #
    # Morgals army moves 1
    #
    [event]
        name=side 2 turn 1
        
        {MOVE_UNIT id=Agser'revs 13 5}
        {MOVE_UNIT id=Grumok 13 6}
        {MOVE_UNIT id=Brok 16 4}
        {MOVE_UNIT id=Vurk 17 4}
        {MOVE_UNIT id=Rasha 17 5}
        {MOVE_UNIT id=Vurga 17 6}
        {MOVE_UNIT id=Knargal 16 6}
        {MOVE_UNIT id=Vurgash 15 5}
        {MOVE_UNIT id=Norol 16 5}
        {MOVE_UNIT id=Narrak 14 5}
        
        {MODIFY_UNIT side=2 moves 0}
    [/event]
    
    #
    # Grumok moves back 1
    #
    [event]
        name=side 2 turn 2
        
        {MOVE_UNIT id=Grumok 6 7}
                
        {MODIFY_UNIT side=2 moves 0}       
    [/event]
somehow the orcish units are not moving in turn 1, but do move in turn 2.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: [Ability] - Inspiration

Post by zookeeper »

You must modify their moves in a turn refresh type event. The game fills movement points after the normal turn type events, but before turn refresh type events. So use "side 2 turn <number> refresh" instead.
User avatar
Ravana
Forum Moderator
Posts: 3003
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: [Ability] - Inspiration

Post by Ravana »

That turn 1-2 difference is from how income is calculated. I am not quite sure why it was chosen to make turn 1 special that way.
it's quite hard to give them those specific points back.
Create variable in each unit that says how many it should have, and when its time then iterate over them and restore. Or if they are all nonmodified then can restore them just based on unit type.
User avatar
Bitron
Developer
Posts: 453
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: [Ability] - Inspiration

Post by Bitron »

That turn 1-2 difference is from how income is calculated.
What has the income to so with the movementpoints of those units?
You must modify their moves in a turn refresh type event.
Thanks for the hint, I'll try it. (:
User avatar
Ravana
Forum Moderator
Posts: 3003
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: [Ability] - Inspiration

Post by Ravana »

turn refresh
Like side turn, triggers just before a side is taking control but after healing, calculating income, and restoring unit movement and status.
Note that the turn refresh event does occur on turn 1, even though healing, income and unit refreshing do not.
User avatar
Bitron
Developer
Posts: 453
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: [Ability] - Inspiration

Post by Bitron »

And here I am, with another little Question.
Has anything changed with the name=moveto events ? Somehow some of them are not working anymore in my campaign. It's about those which would end a scenario.

here are two examples:

Code: Select all

    #
    # VICTORY
    #
    [event]
        name=moveto
        [filter]
            x=29
            y=1
            id=Denvan
        [/filter]
        [message]
            speaker=Ysedda
            message= _ "We did it!"
        [/message]        
        [endlevel]
            result=victory
            bonus=yes
            {NEW_GOLD_CARRYOVER 40}
        [/endlevel]
    [/event]

Code: Select all

    [event]
        name=moveto
        [filter]
            id=Denvan
            [and]
                id=Ysedda
            [/and]
            x,y=41,0
            radius=3
        [/filter]
        [...]
    [/event]
somehow it doesn't trigger if I move Denvan (and Ysedda in the second example) to the specific position.
User avatar
Bitron
Developer
Posts: 453
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: [Ability] - Inspiration

Post by Bitron »

I kinda solved the first one (or it solved itself), but I still have problems with the second one. How can I write it that two specific Units have to be in one specific area to trigger the event?

this doesn't work, however.

Code: Select all

#define TEST_EVENT  
    [event]
        name=moveto
        first_time_only=yes       
        [filter]
            id=Johan
            [and]
                id=Ysedda
            [/and]
            x=23-24
            y=15-16
        [/filter]
        
        [message]
            speaker=Ysedda
            message= _ "Done!"
        [/message]
    [/event]   
#enddef
User avatar
beetlenaut
Developer
Posts: 2825
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: [Ability] - Inspiration

Post by beetlenaut »

What you wrote looks for a unit that has an id of Ysedda AND Johan which is impossible. Instead, use [or] in the filter part to select the two units, then use an [if] with [have_unit] to specify the locations. The [have_unit] tag will use an [and] in it to include both units. (With this method, the [filter] is actually optional, but should make the code a bit faster.) You will also have to put first_time_only=no in the event because the [if] statement will have to be checked every time either unit moves.

Edit: Or what Ravana said would be a little shorter. I just like [if] statements.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
User avatar
Ravana
Forum Moderator
Posts: 3003
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: [Ability] - Inspiration

Post by Ravana »

It looks for unit that has id that equals both of them. Use [filter_condition] with two [have_unit].
User avatar
Bitron
Developer
Posts: 453
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: [Ability] - Inspiration

Post by Bitron »

Like that ?

Code: Select all

#define TEST_EVENT  
    [event]
        name=moveto
        first_time_only=no  
        [filter_condition]
            [have_unit]
                id=Ysedda
                x,y=23-24,14-15
            [/have_unit]
            [and]
                [have_unit]
                    id=Johan
                    x,y=23-24,14-15
                [/have_unit]
            [/and]
        [/filter_condition]       
        [message]
            speaker=Ysedda
            message= _ "Done!"
        [/message]
    [/event]   
#enddef
Post Reply