Modifying unit and other questions by Elmor

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
Elmor
Posts: 152
Joined: May 5th, 2010, 8:19 am

Modifying unit and other questions by Elmor

Post by Elmor »

Hello, I`m trying to solve my problems with WML and it would be nice if I can have some advice.
I want to modify unit and here what exactly I need:
1) Add specials from variable or simply add specials.
2) Modify unit`s image.
3) Subtract damage from attack.

How can I do it in most easy way?

And where I can find all unit`s standart variables, which I can use when I store him to variable?

Also, I got prooblem with this part of code:

Code: Select all

    [event]
        name=last breath
        first_time_only=yes
        [filter_second]
            id=Bandit Leader
            side=2
        [/filter_second]
        [message]
            speaker=Bandit Leader
            message= _ "You won!"
        [/message]
        [endlevel]
            result=victory
        [/endlevel]
    [/event]
It must be "last breath" event", but it fires like "attack".

P.S.
Sorry for my english.
Last edited by Elmor on March 20th, 2014, 8:16 pm, edited 1 time in total.
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Modifying unit and other questions by Elmor

Post by Dugi »

For now I got this, but it does
Coordinates $x and $y are wrong, use $x1 and $y1 instead (or $x2 and $y2 depends on the event where you use it).
Also, I got prooblem with this part of code:
You've mistaken [filter] and [filter_second], your event fires when the bandit leader kills somebody.
Elmor
Posts: 152
Joined: May 5th, 2010, 8:19 am

Re: Modifying unit and other questions by Elmor

Post by Elmor »

Thank You, Dugi. I solved that, but its still open question about variables.

Also I realised that I don`t know how to use english in WML with arithmetic. I need to subtract damage, but I don`t know how to do it.
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Modifying unit and other questions by Elmor

Post by Dugi »

It isn't obvious how to use mathematical functions in WML, because there aren't many examples. But, here are the basics.

Code: Select all

{VARIABLE x 3} # Sets x to 3
{VARIABLE_OP x sub 1} # Subtracts 1 from x, resulting in x=2
{VARIABLE_OP x add 20} # Adds 20 to x, resulting in x=22
{VARIABLE_OP x multiply 3} # Multiplies x by 3, resulting in x=66
{VARIABLE_OP x divide 6} # Divides x by 6, resulting in x=11
{VARIABLE_OP x rand (1..10)} # Sets a random number between 1 and 10 to x

# You can also do this instead:
{VARIABLE x "$($second_unit.hitpoints-20+$unit.resistance.fire*73/)"}
Elmor
Posts: 152
Joined: May 5th, 2010, 8:19 am

Re: Modifying unit and other questions by Elmor

Post by Elmor »

Now I got this problem:

In that part of code I want make message to show options, which will show next options. But second options must be shown only if variable match filter. For now second options are always shown.

Code: Select all

			[command]
				[message]
					speaker=Elmor
					[option]
						message="message"
						[command]
							[if]
								[variable]
									name=variable
									not_equal="status"
								[/variable]
								[then]
									[message]
										speaker=Elmor
										[option]
											message="show info"
											[command]
												[message]
													message="info"
												[/message]
											[/command]
										[/option]
									[/message]
								[/then]
							[/if]
						[/command]
					[/option]
				[/message]
			[/command]
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Modifying unit and other questions by Elmor

Post by zookeeper »

It's not_equals, not not_equal.
Post Reply