Bitrons WML Questions

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

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
Bitron
Moderator
Posts: 438
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: [Ability] - Inspiration

Post by Bitron » November 23rd, 2015, 2:27 pm

I have another question for another weapon_special.

Is this valid code ? : multiply=$((($second_unit.max_hitpoints - $second_unit.hitpoints)/$second_unit.max_hitpoints)*2)

it should say 2*((MaxHP-HP)/MaxHP)

what it should do:

Example: Attack: 10-2
Opponent with 50% hitpoints: Damage 10-2 (50*2 = 100%)
Opponent with 80% hitpoints: Damage 4-2 (20*2 = 40%)
Opponent with 20% hitpoints: Damage 16-2 (80*2 = 160%)

User avatar
beetlenaut
Developer
Posts: 2190
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: [Ability] - Inspiration

Post by beetlenaut » November 23rd, 2015, 4:05 pm

You need to put everything to the right of the equals sign in quotes for this type of expression. Usually, that's optional, but not in this case. Also, multiply isn't correct. That's to multiply the previously-named variable by this amount, which is not what you are doing. You probably want value or damage depending on exactly where this is.
Campaigns: Dead Water
The Founding of Borstep
Secrets of the Ancients

User avatar
Bitron
Moderator
Posts: 438
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: [Ability] - Inspiration

Post by Bitron » November 23rd, 2015, 4:44 pm

here's the whole thing:

Code: Select all

#define WEAPON_SPECIAL_EXECUTE
    [damage]
        id=execute
        name= _ "Execute"
        name_inactive=_ "Execute"
        description= _ "the lower the acutal HP of the enemy is, the higher is the damage of this attack (only offensive)"
        multiply="$((($second_unit.max_hitpoints - $second_unit.hitpoints)/$second_unit.max_hitpoints)*2)"
        apply_to=defender
        active_on=offense
    [/damage]
#enddef
why are the quotes neccessary in this case ?

User avatar
Dugi
Posts: 4822
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: [Ability] - Inspiration

Post by Dugi » November 23rd, 2015, 4:54 pm

I don't think that any formulas are accepted inside weapon specials.

User avatar
Bitron
Moderator
Posts: 438
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: [Ability] - Inspiration

Post by Bitron » November 23rd, 2015, 6:40 pm

formulas ? ..

User avatar
Dugi
Posts: 4822
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: [Ability] - Inspiration

Post by Dugi » November 23rd, 2015, 6:59 pm

The $(blablabla) part is called formula.

User avatar
Bitron
Moderator
Posts: 438
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: [Ability] - Inspiration

Post by Bitron » November 23rd, 2015, 7:01 pm

oh okay. then I'll try rewrite it as an event.

User avatar
Bitron
Moderator
Posts: 438
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: [Ability] - Inspiration

Post by Bitron » November 29th, 2015, 11:22 am

Good Morning guys.

I hava another little problem. I'm working on the first campaign, and i wrote an event, in wich the attacked unit flees and hides in a forest, using [hide_unit]. The problem is, if this event triggers, instead of the one unit i want to hide, all other units get hide and the unit i want to hide is still visible. I tried several filter-variations .. nothing worked like i want it to.

here es is the event:

Code: Select all

[event]
        name=attack end
        [filter]
            side=1
        [/filter]
        [filter_second]
            id=Karga
        [/filter_second]
        [message]
            speaker=Karga
            message= _ "Arrgh, ihr Maden! (flüsternd) Ich versteck mich vielleicht doch lieber."
        [/message]
        
       # moving Karga
        {MOVE_UNIT id=Karga 17 3}
        [hide_unit]
            [filter]
               id=Karga
            [/filter]
        [/hide_unit]
        [modify_unit]
            [filter]
                id=Karga
            [/filter]
            max_moves=0
        [/modify_unit]
    [/event]
Yes, messages are in german .. ill change it as soon as i have the english translations.

User avatar
Ravana
Moderator
Posts: 1815
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: [Ability] - Inspiration

Post by Ravana » November 29th, 2015, 11:24 am

Try without [filter].

User avatar
Bitron
Moderator
Posts: 438
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: [Ability] - Inspiration

Post by Bitron » November 29th, 2015, 11:30 am

Ravana wrote:Try without [filter].
like this ?

Code: Select all

[...]
# moving Karga
        {MOVE_UNIT id=Karga 17 3}
        [hide_unit]
        [/hide_unit]
[...]
that doesnt work. still the same all get hide except the unit i want to hide

User avatar
James_The_Invisible
Posts: 456
Joined: October 28th, 2012, 1:58 pm
Location: Somewhere in the Northlands, fighting dark forces

Re: [Ability] - Inspiration

Post by James_The_Invisible » November 29th, 2015, 11:48 am

No, this way:

Code: Select all

[hide_unit]
    id=Karga
[/hide_unit]

User avatar
Bitron
Moderator
Posts: 438
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: [Ability] - Inspiration

Post by Bitron » November 29th, 2015, 11:56 am

oh right, that worked, thanks a lot !

User avatar
Bitron
Moderator
Posts: 438
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: [Ability] - Inspiration

Post by Bitron » December 13th, 2015, 4:32 pm

And once again I'm here with a Problem.

I'm trying to programm a moveto event with position specific messages using [have_location]. But somehow it always uses the last possible [if] Variation, in this case "des Eremiten"
My guess is the [have_location] condition, but i have no clue where the mistake is.

here's the code:

Code: Select all

    [event]
        name=moveto
        first_time_only=yes
        [filter]
            id=Ysedda
            [filter_location]
                terrain=*^V*
                # Houses within the Town
                [not]
                    x=22
                    y=15
                [/not]
                [not]
                    x=18
                    y=15
                [/not]
            [/filter_location]
        [/filter]
        
        # wich neighbour should it be
        [if]
            [have_location]
                x,y=15,25
            [/have_location]
            [then]
                {VARIABLE neighbour_is (_ "des Bäckers")}
            [/then]
        [/if]
        [if]
            [have_location]
                x,y=7,28
            [/have_location]
            [then]
                {VARIABLE neighbour_is (_ "der alten Hexe")}
            [/then]
        [/if]
        [if]
            [have_location]
                x,y=4,36
            [/have_location]
            [then]
                {VARIABLE neighbour_is (_ "des Eremiten")}
            [/then]
        [/if]        
        [unit]
            {CHARACTER_VEN}
            side=1
            x,y=$x1,$y1            
        [/unit]
        [message]
            speaker=Ysedda
            message= _ "Was machst du denn hier? Das ist das Haus $neighbour_is!"
        [/message]
        [message]
            speaker=Ven
            message= _ "Der wohnt ein Haus weiter. Das hier gehört ei-.. mir."
        [/message]            
        [message]
            speaker=Ysedda
            message= _ "Du plünderst schon wieder, statt zu kämpfen?"
        [/message]
        [message]
            speaker=Ven
            message= _ "Und wenn? Am Ende wird eh kein Kerker mehr übrig sein, in dem ich geworfen werden könnte!"
        [/message]
        [message]
            speaker=Ysedda
            message= _ "Stimmt. Um genau zu sein, können wir nicht nur keinen Kerker mitnehmen, sondern auch keine Diebe, die nur Ballast sind!"
        [/message]
        [message]
            speaker=Ven
            message= _ "Ich sehe schon, wo das hinführt. Nun gut, weil Ihr so nett darum bittet: Ich verteidige erneut mit Euch die Bewohner"
        [/message]
        
        {CLEAR_VARIABLE neighbour_is}        
    [/event]
    
    #
    # Brealla appears: Denvan version
    #
    [event]
        name=moveto
        [filter]
            id=Denvan
            x,y=7,16
        [/filter]
        [unit]
            {CHARACTER_BREALLA}
            x,y=8,16
        [/unit]
        [message]
            speaker=Brealla
            message= _ "(gespielt bestürzt) Denvan! Du kannst doch nicht einfach so in das Haus einer allein lebenden Dame stürmen! Was sollen die Leute von dir denken?"
        [/message]
        [message]
            speaker=Denvan
            message= _ "Die denken, dass ich Verstärkung hole. Wir evakuieren das Dorf, du wirst gebraucht!"
        [/message]
        [message]
            speaker=Brealla
            message= _ "((etwas) ernster) Warum sagst du das nicht gleich? Ich bin unterwegs!"
        [/message]  
    [/event]
Hope, someone can help me (:

All the best,

- Bitron

User avatar
Ravana
Moderator
Posts: 1815
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: [Ability] - Inspiration

Post by Ravana » December 13th, 2015, 4:47 pm

[have_location] only checks if such location exists on map. Effectively you check if map is large enough. You do not compare it with current event location.

User avatar
Bitron
Moderator
Posts: 438
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: [Ability] - Inspiration

Post by Bitron » December 13th, 2015, 4:52 pm

okay.
uhm...

Code: Select all

[have_unit]
    id=Ysedda
    [filter_location]
        y,x=X,Y
    [filter_location]
[/have_unit]
would this work ?

oh, or

Code: Select all

[have_location]
    x,y=X,Y
    [filter]
        id=Ysedda
    [/filter]
[/have_location]
EDIT: the second worked for me!

Thanks anyway (:

Post Reply