Change unit price for one side

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.
Lorbi
Posts: 162
Joined: May 21st, 2007, 6:35 am
Contact:

Change unit price for one side

Post by Lorbi »

I wonder if that is possible in WML
I want that side X can recruit unitY for a gold instead of the nornmal price of b gold

is this possible anyway ? any ideas ?
User avatar
turin
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas
Contact:

Post by turin »

Unfortunately, it's not. Unit cost is not manipulable... this is one feature that would be really useful, though.
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
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

Nope, not possible. You'd need to create a custom version of the unit and give it a different cost.
Lorbi
Posts: 162
Joined: May 21st, 2007, 6:35 am
Contact:

Post by Lorbi »

ok .. thx for the hint
User avatar
Iris
Site Administrator
Posts: 6798
Joined: November 14th, 2006, 5:54 pm
Location: Chile
Contact:

Post by Iris »

zookeeper wrote:Nope, not possible. You'd need to create a custom version of the unit and give it a different cost.
Done in Under the Burning Suns campaign. You can take its WML as example.
Author of the unofficial UtBS sequels Invasion from the Unknown and After the Storm.
User avatar
turin
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas
Contact:

Post by turin »

It's only "done" in UTBS by duplicating the entire WML of each unit for each price desired. It's a horrible way to do it and shouldn't be replicated unless absolutely necessary.
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
CIB
Code Contributor
Posts: 625
Joined: November 24th, 2006, 11:26 pm

Post by CIB »

I wonder why this feature doesn't exist.. You even can make your own right-click options with WML, but you can't change the costs of a unit?
elricz
Posts: 194
Joined: September 7th, 2006, 8:19 pm
Location: Imrryr
Contact:

Post by elricz »

turin wrote:It's only "done" in UTBS by duplicating the entire WML of each unit for each price desired. It's a horrible way to do it and shouldn't be replicated unless absolutely necessary.
Looking at the .cfg files it doesn't look that bad:
Desert_Archer.cfg wrote: #define DESERT_ARCHER NUM COST HIDEORNOT
...
id=Desert Archer{NUM}
hide_help={HIDEORNOT}
...
cost={COST}
...
[/unit]
#enddef

{DESERT_ARCHER "" 17 false}
{DESERT_ARCHER 2 18 true}
{DESERT_ARCHER 3 19 true}
{DESERT_ARCHER 4 20 true}
{DESERT_ARCHER 5 21 true}
{DESERT_ARCHER 6 22 true}
{DESERT_ARCHER 7 23 true}
{DESERT_ARCHER 8 24 true}
{DESERT_ARCHER 9 25 true}
{DESERT_ARCHER 10 26 true}
{DESERT_ARCHER 11 27 true}
CIB
Code Contributor
Posts: 625
Joined: November 24th, 2006, 11:26 pm

Post by CIB »

You know, each of these macros gets substituted by like 200 lines o.o
(+this won't work in multiplayer, +it would not work dynamically(except by creating a unit for each possible cost))
elricz
Posts: 194
Joined: September 7th, 2006, 8:19 pm
Location: Imrryr
Contact:

Post by elricz »

CIB wrote:You know, each of these macros gets substituted by like 200 lines o.o
Ok, I see, it just didn't looked that horrible to write it :)
Drumbeat
Posts: 23
Joined: February 19th, 2006, 9:08 pm
Location: Eugene, Oregon

Post by Drumbeat »

How about an event that fires on recruitment and just adds gold back to the player's treasury? I think you would have to disable undo or write an event to decrease the player's gold when undoing a recruit action.
CIB
Code Contributor
Posts: 625
Joined: November 24th, 2006, 11:26 pm

Post by CIB »

That's even worse than in UtbS =)
Drumbeat
Posts: 23
Joined: February 19th, 2006, 9:08 pm
Location: Eugene, Oregon

Post by Drumbeat »

CIB wrote:That's even worse than in UtbS =)
It has the sole advantage of using fewer lines of code than an entire unit description. But, yes. It's ugly at best. :)
Rhuvaen
Inactive Developer
Posts: 1272
Joined: August 27th, 2004, 8:05 am
Location: Berlin, Germany

Post by Rhuvaen »

For an AI side, that would be an adequate solution. It's only the human player that will complain about the discrepancy of displayed price and special discount.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

Rhuvaen wrote:For an AI side, that would be an adequate solution. It's only the human player that will complain about the discrepancy of displayed price and special discount.
...not to mention the inability to recruit the unit if you have enough gold for the actual lowered cost but not for the original.
Post Reply