Building a new unit

Asked by Kyran Jackson

I'm having a little problem trying to get a unit to build a new structure.

I've made two new units, which are just copies of the peasant and the townhall.

I can get the copy-townhall unit to train the copy-peasant fine, however, I can't get the copy-peasant to build the copy-townhall. It's button doesn't show up.

The follow is the LUA script relative to copy-peasant:

DefineButton( { Pos = 1, Level = 1, Icon = "icon-farm",
 Action = "build", Value = "unit-farm",
 Key = "f", Hint = "BUILD ~!FARM",
 ForUnit = {"unit-caanoo-pioneer"} } )

DefineButton( { Pos = 2, Level = 1, Icon = "icon-human-barracks",
 Action = "build", Value = "unit-human-barracks",
 Key = "b", Hint = "BUILD ~!BARRACKS",
 ForUnit = {"unit-caanoo-pioneer"} } )

DefineButton( { Pos = 3, Level = 1, Icon = "icon-town-hall",
 Action = "build", Value = "unit-caanoo-townhall",
 Key = "h", Hint = "BUILD TOWN ~!HALL",
 ForUnit = {"unit-caanoo-pioneer"} } )

The farm and barracks both show up and can be constructed. The copy-townhall however doesn't so it can't.

I'm assuming there is something else I need to add to make this unit constructable, but I've got no idea. I've even made a spell to summon the copy-townhall, which worked fine.

Question information

Language:
English Edit question
Status:
Solved
For:
Wargus Edit question
Assignee:
No assignee Edit question
Solved by:
Joris Dauphin
Solved:
Last query:
Last reply:
Revision history for this message
Best Joris Dauphin (joris-dauphin) said :
#1

Make sure:
- buttons doesn't superpose (else one hides the other)
- unit is allowed (see upgrade.lua and DefineAllow / DefineDependency)

Revision history for this message
Kyran Jackson (erstmap) said :
#2

Thanks Joris Dauphin, that solved my question.

Revision history for this message
Kyran Jackson (erstmap) said :
#3

Ah yes!

I'd tried DefineAllow("unit-caanoo-townhall", AllowAll) but not DefineAllow("unit-caanoo-townhall", "AAAAAAAAAAAAAAAA").