Multiple Units of the Same Name

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
Duke Guillermo
Posts: 127
Joined: October 25th, 2005, 9:32 pm

Multiple Units of the Same Name

Post by Duke Guillermo »

Is it possible to have multiple units of the same name? If so, how can I do it?
In summation, you're wrong.
User avatar
Elvish_Pillager
Posts: 8137
Joined: May 28th, 2004, 10:21 am
Location: Everywhere you think, nowhere you can possibly imagine.
Contact:

Post by Elvish_Pillager »

yes.

[unit]
type=Elvish Fighter
x=2
y=2
side=2
[/unit]
[unit]
type=Elvish Fighter
x=2
y=2
side=2
[/unit]

and voila! two units with the same (empty) name!
It's all fun and games until someone loses a lawsuit. Oh, and by the way, sending me private messages won't work. :/ If you must contact me, there's an e-mail address listed on the website in my profile.
User avatar
Ranger M
Art Contributor
Posts: 1965
Joined: December 8th, 2005, 9:13 pm
Location: England

Post by Ranger M »

or you could try.

Code: Select all

[unit] 
type=Elvish Fighter 
description=andy1
user_description=andy
x=2 
y=2 
side=2 
[/unit] 
[unit] 
type=Elvish Fighter
description=andy2
user_description=andy
x=2 
y=2 
side=2 
[/unit]
because user_description is the name as it appears, so as long as they have different descriptions (the bit you don't see) then you should be fine.
User avatar
turin
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas
Contact:

Post by turin »

Or you could just do

Code: Select all

[unit] 
type=Elvish Fighter 
description=andy
x=2 
y=2 
side=2 
[/unit] 
[unit] 
type=Elvish Fighter
description=andy
x=2 
y=2 
side=2 
[/unit]
Descriptions do not have to be unique. :roll: (However, I don't know what will happen if you try to have a message with description=andy. It probably won't work. So, if you want two characters with the same name, you should do what ranger m said. However, if all you want is a generic name, like "conscript", to give to a bunch of created units, mine will work.)
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
User avatar
Elvish_Pillager
Posts: 8137
Joined: May 28th, 2004, 10:21 am
Location: Everywhere you think, nowhere you can possibly imagine.
Contact:

Post by Elvish_Pillager »

turin wrote:However, I don't know what will happen if you try to have a message with description=andy. It probably won't work.
it will - it uses the one to the top left.
It's all fun and games until someone loses a lawsuit. Oh, and by the way, sending me private messages won't work. :/ If you must contact me, there's an e-mail address listed on the website in my profile.
Duke Guillermo
Posts: 127
Joined: October 25th, 2005, 9:32 pm

Post by Duke Guillermo »

I was actually refering to when creating custom units, sorry for the confusion.
In summation, you're wrong.
User avatar
Ranger M
Art Contributor
Posts: 1965
Joined: December 8th, 2005, 9:13 pm
Location: England

Post by Ranger M »

so long as the id is different then they can have the same name.
Duke Guillermo
Posts: 127
Joined: October 25th, 2005, 9:32 pm

Post by Duke Guillermo »

Thank you! That worked perfectly.
In summation, you're wrong.
Post Reply