If anyone remembers the Gambit's Empire Builder mod, I'm in the process of updating, modifying, and refining it because I personally enjoy playing it. (Even if most other people don't like it.) I'm having an issue with summoning add-on units for various parts of the games (buying them from villages, courtyards (elvish castle tiles), etc. Summoning core units works just fine, summoning units that came with the add-on do not. (It all worked fine in Wesnoth 1.8...or 1.6....it's been a while I dont remember for sure which one.) It throws a "unknown unit type" error in the game.
Other notes:
Unit file works.I put it in the core unit files and it'll spawn in debug mode just fine, but still not from the aforementioned village menu option.
Core units that you can buy on the menu option from the villages and such work fine.
It can find the units in the add-on, enough to complain about some non-functioning abilities when you try to load the multiplayer screen on startup. (these units where then removed and will be fixed later)
Its not a typo issue, the macro sends it looking for, in one particular case, a unit with "Cow" unit ID, and I verified the correct spelling. Paths all look good (as I said, it can follow the paths fine when it's complaining about broken units, but not when trying to spawn the good ones.
K code dump:
_main.cfg:
macros folder:
_general.cfg macro
Spoiler:
Code: Select all
#define GEB_TEAMS
1,2,3,4
#enddef
#define GEB_Builders
Peasant
#enddef
#define GEB_Officers
Mage
#enddef
#define PRIVATE_MESSAGE MESSAGE
[message]
speaker=narrator
message= _ {MESSAGE}
side_for=$side_number
image=wesnoth-icon.png
[/message]
#enddef
#define RCHECK GC FC WC
[variable]
name=goldamount
greater_than_equal_to={GC}
[/variable]
[variable]
name=food_$side_number
greater_than_equal_to={FC}
[/variable]
[variable]
name=wood_$side_number
greater_than_equal_to={WC}
[/variable]
#enddef
#define RTRANSACTION GC FC WC
[set_variable]
name=wood_$side_number
add=-{WC}
[/set_variable]
[set_variable]
name=food_$side_number
add=-{FC}
[/set_variable]
[gold]
side=$side_number
amount=-{GC}
[/gold]
#enddef
#define RTRANSACTION2 GC FC WC
[set_variable]
name=wood_$side_number
add={WC}
[/set_variable]
[set_variable]
name=food_$side_number
add={FC}
[/set_variable]
[gold]
side=$side_number
amount={GC}
[/gold]
#enddef
#define GENERIC_BUILD MESSAGE IMAGE GC FC WC MOP MOVES SOUND1 SOUND2 TERRAIN
[option]
message= _ {MENU_IMG_TXT {IMAGE} {MESSAGE}} + " -{GC}gold -{FC}food -{WC}wood"
[command]
[if]
{RCHECK {GC} {FC} {WC}}
[then]
[set_variable]
name=worker.moves
{MOP}={MOVES}
[/set_variable]
{RTRANSACTION {GC} {FC} {WC}}
[sound]
name={SOUND1}
[/sound]
[sound]
name={SOUND2}
[/sound]
[terrain]
x=$x1
y=$y1
terrain={TERRAIN}
[/terrain]
[capture_village]
side=$side_number
x=$x1
y=$y1
[/capture_village]
[/then]
[else]
[sound]
name=leave.wav
[/sound]
[/else]
[/if]
[unstore_unit]
variable=worker
[/unstore_unit]
[/command]
[/option]
#enddef
#define GENERIC_HARVEST MESSAGE IMAGE GC FC WC SOUND1 SOUND2 TERRAIN
[option]
message= _ {MENU_IMG_TXT {IMAGE} {MESSAGE}} + " +{GC}gold +{FC}food +{WC}wood"
[command]
[set_variable]
name=worker.moves
value=0
[/set_variable]
{RTRANSACTION2 {GC} {FC} {WC}}
[sound]
name={SOUND1}
[/sound]
[sound]
name={SOUND2}
[/sound]
[terrain]
x=$x1
y=$y1
terrain={TERRAIN}
[/terrain]
[unstore_unit]
variable=worker
[/unstore_unit]
[/command]
[/option]
#enddef
#define MOD_UNIT_GENERIC MESSAGE IMAGE GC FC WC CONFIRM TRAIT OP VALUE SOUND1 SOUND2
[option]
message= _ {MENU_IMG_TXT {IMAGE} {MESSAGE}} + " {GC}gold {FC}food {WC}wood"
[command]
[if]
{RCHECK {GC} {FC} {WC}}
[then]
[set_variable]
name=worker.moves
value=0
[/set_variable]
{RTRANSACTION {GC} {FC} {WC}}
[sound]
name={SOUND1}
[/sound]
[sound]
name={SOUND2}
[/sound]
[set_variable]
name=worker.{TRAIT}
{OP}={VALUE}
[/set_variable]
{PRIVATE_MESSAGE {CONFIRM}}
[/then]
[else]
[sound]
name=leave.wav
[/sound]
[/else]
[/if]
[unstore_unit]
variable=worker
[/unstore_unit]
[/command]
[/option]
#enddef
#define MOD_UNIT_OVERLAY MESSAGE IMAGE GC FC WC TRAIT OP VALUE SOUND1 SOUND2 OVERLAY
[option]
message= _ {MENU_IMG_TXT {IMAGE} {MESSAGE}} + " {GC}gold {FC}food {WC}wood"
[command]
[if]
{RCHECK {GC} {FC} {WC}}
[then]
{RTRANSACTION {GC} {FC} {WC}}
[sound]
name={SOUND1}
[/sound]
[sound]
name={SOUND2}
[/sound]
[set_variable]
name=worker.{TRAIT}
{OP}={VALUE}
[/set_variable]
[set_variable]
name=worker.overlays
value="misc/blank-hex.png"
[/set_variable]
[set_variable]
name=worker.overlays
value={OVERLAY}
[/set_variable]
[/then]
[else]
[sound]
name=leave.wav
[/sound]
[/else]
[/if]
[unstore_unit]
variable=worker
[/unstore_unit]
[/command]
[/option]
#enddef
#define GENERIC_SUMMON MESSAGE IMAGE GC FC WC CONFIRM SOUND TYPE TERRAIN
[option]
message= _ {MENU_IMG_TXT {IMAGE} {MESSAGE}} + " -{GC}gold -{FC}food -{WC}wood"
[command]
[if]
{RCHECK {GC} {FC} {WC}}
[then]
[set_variable]
name=worker.moves
value=0
[/set_variable]
{RTRANSACTION {GC} {FC} {WC}}
[sound]
name={SOUND}
[/sound]
[terrain]
x,y=$x1,$y1
terrain={TERRAIN}
[/terrain]
[unit]
x=$x1
y=$y1
side=$side_number
type={TYPE}
[/unit]
{PRIVATE_MESSAGE {CONFIRM}}
[/then]
[else]
[sound]
name=leave.wav
[/sound]
[/else]
[/if]
[unstore_unit]
variable=worker
find_vacant=yes
[/unstore_unit]
[/command]
[/option]
#enddef
#define GENERIC_MENU ID NAME TERRAIN
[set_menu_item]
id={ID}
description=_ "Do Something ({NAME})"
[show_if]
[have_unit]
side=$side_number
x,y=$x1,$y1
type={GEB_Builders}
[filter_location]
terrain={TERRAIN}
[/filter_location]
[not]
[filter_wml]
moves=0
[/filter_wml]
[/not]
[/have_unit]
[/show_if]
[command]
[store_unit]
[filter]
x=$x1
y=$y1
[/filter]
kill=yes
mode=replace
variable=worker
[/store_unit]
[store_gold]
side=$side_number
variable=goldamount
[/store_gold]
[message]
speaker=narrator
message= _ "`@What should I do? Wood: $wood_$side_number Food: $food_$side_number Gold: $goldamount"
#enddef
#define FREE_MENU ID NAME TERRAIN
[set_menu_item]
id={ID}
description=_ "Do Something ({NAME})"
[show_if]
[have_unit]
side=$side_number
x,y=$x1,$y1
type={GEB_Builders}
[filter_location]
terrain={TERRAIN}
[/filter_location]
[/have_unit]
[/show_if]
[command]
[store_unit]
[filter]
x=$x1
y=$y1
[/filter]
kill=yes
mode=replace
variable=worker
[/store_unit]
[store_gold]
side=$side_number
variable=goldamount
[/store_gold]
[message]
speaker=narrator
message= _ "`@What should I do? Wood: $wood_$side_number Food: $food_$side_number Gold: $goldamount"
#enddef
#define TYPE_MENU ID NAME TYPE TERRAIN
[set_menu_item]
id={ID}
description=_ "Do Something ({NAME})"
[show_if]
[have_unit]
side=$side_number
x,y=$x1,$y1
type={TYPE}
[filter_location]
terrain={TERRAIN}
[/filter_location]
[not]
[filter_wml]
moves=0
[/filter_wml]
[/not]
[/have_unit]
[/show_if]
[command]
[store_unit]
[filter]
x=$x1
y=$y1
[/filter]
kill=yes
mode=replace
variable=worker
[/store_unit]
[store_gold]
side=$side_number
variable=goldamount
[/store_gold]
[message]
speaker=narrator
message= _ "`@What should I do? Wood: $wood_$side_number Food: $food_$side_number Gold: $goldamount"
#enddef
#define NOLEADER_MENU ID NAME TERRAIN
[set_menu_item]
id={ID}
description=_ "Do Something ({NAME})"
[show_if]
[have_unit]
side=$side_number
x,y=$x1,$y1
canrecruit=no
[filter_location]
terrain={TERRAIN}
[/filter_location]
[not]
[filter_wml]
moves=0
[/filter_wml]
[/not]
[/have_unit]
[/show_if]
[command]
[store_unit]
[filter]
x=$x1
y=$y1
[/filter]
kill=yes
mode=replace
variable=worker
[/store_unit]
[store_gold]
side=$side_number
variable=goldamount
[/store_gold]
[message]
speaker=narrator
message= _ "`@What should I do? Wood: $wood_$side_number Food: $food_$side_number Gold: $goldamount"
#enddef
#define GENERIC_MENU_CLOSE
[option]
message= _ "Nothing"
[command]
[unstore_unit]
variable=worker
[/unstore_unit]
[/command]
[/option]
[/message]
[/command]
[/set_menu_item]
#enddef
#define RECRUITER MESSAGE IMAGE GC FC WC TYPE
[option]
message= _ {MENU_IMG_TXT {IMAGE} {MESSAGE}} + " -{GC}gold -{FC}food -{WC}wood"
[command]
[if]
{RCHECK {GC} {FC} {WC}}
[then]
{RTRANSACTION {GC} {FC} {WC}}
[unit]
name=$worker.user_description
type={TYPE}
x=$worker.x
y=$worker.y
side=$side_number
[/unit]
[/then]
[else]
[sound]
name=leave.wav
[/sound]
[unstore_unit]
variable=worker
[/unstore_unit]
[/else]
[/if]
[/command]
[/option]
#enddef
#define ALE MESSAGE IMAGE GC FC WC ALIGN CONFIRM
[option]
message= _ {MENU_IMG_TXT {IMAGE} {MESSAGE}} + " -{GC}gold -{FC}food -{WC}wood"
[command]
[if]
{RCHECK {GC} {FC} {WC}}
[then]
[set_variable]
name=worker.moves
value=0
[/set_variable]
[set_variable]
name=worker.alignment
value={ALIGN}
[/set_variable]
[set_variable]
name=worker.experience
value=0
[/set_variable]
[set_variable]
name=worker.status.poisoned
value=yes
[/set_variable]
[sound]
name=dwarf-laugh.wav
[/sound]
{PRIVATE_MESSAGE {CONFIRM}}
{RTRANSACTION {GC} {FC} {WC}}
[/then]
[else]
[sound]
name=leave.wav
[/sound]
[/else]
[/if]
[unstore_unit]
variable=worker
[/unstore_unit]
[/command]
[/option]
#enddef
#define SPECIAL_SUMMON MESSAGE IMAGE GC FC WC CONFIRM SOUND TYPE
[option]
message= _ {MENU_IMG_TXT {IMAGE} {MESSAGE}} + " -{GC}gold -{FC}food -{WC}wood"
[command]
[if]
{RCHECK {GC} {FC} {WC}}
[then]
{RTRANSACTION {GC} {FC} {WC}}
[sound]
name={SOUND}
[/sound]
[unit]
x=$x1
y=$y1
side=$side_number
type={TYPE}
[/unit]
{PRIVATE_MESSAGE {CONFIRM}}
[/then]
[else]
[sound]
name=leave.wav
[/sound]
[/else]
[/if]
[unstore_unit]
variable=worker
find_vacant=yes
[/unstore_unit]
[/command]
[/option]
#enddef
#define SPECIAL_SUMMON2 MESSAGE IMAGE GC FC WC TYPE
[option]
message= _ {MENU_IMG_TXT {IMAGE} {MESSAGE}} + " -{GC}gold -{FC}food -{WC}wood"
[command]
[if]
{RCHECK {GC} {FC} {WC}}
[then]
{RTRANSACTION {GC} {FC} {WC}}
[unit]
x=$x1
y=$y1
side=$side_number
type={TYPE}
[/unit]
[/then]
[else]
[sound]
name=leave.wav
[/sound]
[/else]
[/if]
[unstore_unit]
variable=worker
find_vacant=yes
[/unstore_unit]
[/command]
[/option]
#enddef
#define IRIG1_HARVEST MESSAGE IMAGE GC FC WC SOUND1 SOUND2 TERRAIN
[option]
message= _ {MENU_IMG_TXT {IMAGE} {MESSAGE}} + " +{GC}gold +{FC}food +{WC}wood"
[show_if]
[have_location]
x=$x1
y=$y1
[filter_adjacent_location]
terrain="Ww"
[/filter_adjacent_location]
[/have_location]
[/show_if]
[command]
[set_variable]
name=worker.moves
value=0
[/set_variable]
{RTRANSACTION2 {GC} {FC} {WC}}
[sound]
name={SOUND1}
[/sound]
[sound]
name={SOUND2}
[/sound]
[terrain]
x=$x1
y=$y1
terrain={TERRAIN}
[/terrain]
[unstore_unit]
variable=worker
[/unstore_unit]
[/command]
[/option]
#enddef
#define IRIG2_HARVEST MESSAGE IMAGE GC FC WC SOUND1 SOUND2 TERRAIN
[option]
message= _ {MENU_IMG_TXT {IMAGE} {MESSAGE}} + " +{GC}gold +{FC}food +{WC}wood"
[show_if]
[not]
[have_location]
x=$x1
y=$y1
[filter_adjacent_location]
terrain="Ww"
[/filter_adjacent_location]
[/have_location]
[/not]
[/show_if]
[command]
[set_variable]
name=worker.moves
value=0
[/set_variable]
{RTRANSACTION2 {GC} {FC} {WC}}
[sound]
name={SOUND1}
[/sound]
[sound]
name={SOUND2}
[/sound]
[terrain]
x=$x1
y=$y1
terrain={TERRAIN}
[/terrain]
[unstore_unit]
variable=worker
[/unstore_unit]
[/command]
[/option]
#enddef
#define INJURED_SUMMON MESSAGE IMAGE GC FC WC CONFIRM SOUND TYPE HP MAX TERRAIN
[option]
message= _ {MENU_IMG_TXT {IMAGE} {MESSAGE}} + " -{GC}gold -{FC}food -{WC}wood"
[command]
[if]
{RCHECK {GC} {FC} {WC}}
[then]
[set_variable]
name=worker.moves
value=0
[/set_variable]
{RTRANSACTION {GC} {FC} {WC}}
[sound]
name={SOUND}
[/sound]
[terrain]
x,y=$x1,$y1
terrain={TERRAIN}
[/terrain]
[unit]
x=$x1
y=$y1
max_hitpoints={MAX}
hitpoints={HP}
side=$side_number
type={TYPE}
[/unit]
{PRIVATE_MESSAGE {CONFIRM}}
[/then]
[else]
[sound]
name=leave.wav
[/sound]
[/else]
[/if]
[unstore_unit]
variable=worker
find_vacant=yes
[/unstore_unit]
[/command]
[/option]
#enddef
#define GENERIC_SELL RESOURCE AMOUNT IMAGE
[option]
message= _ {MENU_IMG_TXT {IMAGE} "Sell {RESOURCE} {AMOUNT}gold per {RESOURCE}"}
[command]
[message]
speaker=narrator
message= _ "How much {RESOURCE}?"
[text_input]
variable={RESOURCE}_amount
label=_ "Amount:"
max_chars=3
text="${RESOURCE}_$side_number"
[/text_input]
image=items/box.png
[/message]
[if]
[variable]
name={RESOURCE}_$side_number
greater_than_equal_to=${RESOURCE}_amount
[/variable]
[then]
[set_variable]
name=worker.moves
add=-1
[/set_variable]
[set_variable]
name={RESOURCE}_$side_number
add=-${RESOURCE}_amount
[/set_variable]
[set_variable]
name=totalprofit
value={AMOUNT}
[/set_variable]
[set_variable]
name=totalprofit
multiply=${RESOURCE}_amount
[/set_variable]
[gold]
side=$side_number
amount=$totalprofit
[/gold]
[unstore_unit]
variable=worker
text=$totalprofit
red,green,blue=255,255,0
[/unstore_unit]
[sound]
name=gold.ogg
[/sound]
[/then]
[else]
[unstore_unit]
variable=worker
[/unstore_unit]
[sound]
name=leave.wav
[/sound]
[/else]
[/if]
[/command]
[/option]
#enddef
#define DEFECT_OPTION
[option]
message= _ {MENU_IMG_TXT "icons/icon-serverother.png" "Give unit away."}
[command]
[message]
speaker=narrator
message= _ "Which side?"
[text_input]
variable=give_side
label=_ "Side"
max_chars=2
[/text_input]
image=$worker.image
[/message]
[if]
[have_unit]
canrecruit=yes
side=$give_side
[/have_unit]
[then]
[set_variable]
name=worker.side
value=$give_side
[/set_variable]
[/then]
[else]
[sound]
name=leave.wav
[/sound]
[/else]
[/if]
[unstore_unit]
variable=worker
[/unstore_unit]
[/command]
[/option]
#enddef
#define SACRIFICE_HARVEST MESSAGE IMAGE GC FC WC SOUND1 SOUND2
[option]
message= _ {MENU_IMG_TXT {IMAGE} {MESSAGE}} + " + $worker.hitpoints food"
[command]
[set_variable]
name=worker.moves
value=0
[/set_variable]
{RTRANSACTION2 {GC} {FC} {WC}}
[sound]
name={SOUND1}
[/sound]
[sound]
name={SOUND2}
[/sound]
[/command]
[/option]
#enddef
#define MOD_UNIT_TERRA MESSAGE IMAGE GC FC WC TRAIT OP VALUE SOUND1 TERRAIN
[option]
message= _ {MENU_IMG_TXT {IMAGE} {MESSAGE}} + " {GC}gold {FC}food {WC}wood"
[command]
[if]
{RCHECK {GC} {FC} {WC}}
[then]
{RTRANSACTION {GC} {FC} {WC}}
[sound]
name={SOUND1}
[/sound]
[set_variable]
name=worker.{TRAIT}
{OP}={VALUE}
[/set_variable]
[terrain]
x,y=$x1,$y1
terrain={TERRAIN}
[/terrain]
[/then]
[else]
[sound]
name=leave.wav
[/sound]
[/else]
[/if]
[unstore_unit]
variable=worker
[/unstore_unit]
[/command]
[/option]
#enddef
#define MEET_CONTAINER NAME IMAGE
[option]
message= _ {MENU_IMG_TXT {IMAGE} "Meet with "+{NAME}+"."}
[command]
[message]
speaker="narrator"
message= _ "What aid shall I ask them for? Wood: $wood_$side_number Food: $food_$side_number Gold: $goldamount"
#enddef
#define LET_RECRUIT NAME TYPE COST IMAGE
[option]
message= _ {MENU_IMG_TXT {IMAGE} "{NAME} -{COST}gold (R)"}
[command]
[if]
[variable]
name=goldamount
greater_than_equal_to={COST}
[/variable]
[then]
[set_variable]
name=worker.moves
value=0
[/set_variable]
[gold]
side=$side_number
amount=-{COST}
[/gold]
[unstore_unit]
variable=worker
[/unstore_unit]
[allow_recruit]
type={TYPE}
side=$side_number
[/allow_recruit]
[/then]
[else]
[unstore_unit]
variable=worker
[/unstore_unit]
[sound]
name=leave.wav
[/sound]
[/else]
[/if]
[/command]
[/option]
#enddef
#define MULTI_BUY NAME TYPE COST NUM IMAGE
[option]
message= _ {MENU_IMG_TXT {IMAGE} "{NAME} -{COST}gold ({NUM})"}
[command]
[if]
[variable]
name=goldamount
greater_than_equal_to={COST}
[/variable]
[then]
[set_variable]
name=worker.moves
value=0
[/set_variable]
[gold]
side=$side_number
amount=-{COST}
[/gold]
[unstore_unit]
variable=worker
[/unstore_unit]
[set_variable]
name=limit
value={NUM}
[/set_variable]
[while]
[variable]
name=limit
greater_than_equal_to=1
[/variable]
[do]
[unit]
side=$side_number
x,y=$x1,$y1
type={TYPE}
[/unit]
[set_variable]
name=limit
add=-1
[/set_variable]
[/do]
[/while]
[/then]
[else]
[unstore_unit]
variable=worker
[/unstore_unit]
[sound]
name=leave.wav
[/sound]
[/else]
[/if]
[/command]
[/option]
#enddef
#define MEET_CLOSE
[option]
message= _ "Nevermind"
[command]
[unstore_unit]
variable=worker
[/unstore_unit]
[/command]
[/option]
[/message]
[/command]
[/option]
#enddef
#define EX_MEET_CONTAINER NAME IMAGE
[option]
message= _ {MENU_IMG_TXT {IMAGE} "Meet with "+{NAME}+"."}
[show_if]
[variable]
name=extended
equals=true
[/variable]
[/show_if]
[command]
[message]
speaker="narrator"
message= _ "What aid shall I ask them for? Wood: $wood_$side_number Food: $food_$side_number Gold: $goldamount"
#enddef
#define TRADE_OPTION
[option]
message= _ {MENU_IMG_TXT "icons/icon-server.png" "Trade"}
[command]
[message]
speaker=narrator
message= _ "Which side?"
[text_input]
variable=give_side
label=_ "Side"
max_chars=2
[/text_input]
image=$worker.image
[/message]
[if]
[have_unit]
canrecruit=yes
side=$give_side
[/have_unit]
[then]
[message]
speaker=narrator
message= _ "What resource?"
[text_input]
variable=resource
label=_ "Resource"
max_chars=50
text="Type in food, gold, or wood. All lowercase."
[/text_input]
image=$worker.image~RC(magenta>$give_side)
[/message]
[if]
[variable]
name=resource
equals=gold
[/variable]
[then]
[message]
speaker=narrator
message= _ "How much?"
[text_input]
variable=amount
label=_ "Amount:"
max_chars=50
text="$goldamount"
[/text_input]
image="items/gold-coins-large.png"
[/message]
[if]
[variable]
name=goldamount
greater_than_equal_to=$amount
[/variable]
[then]
[gold]
side=$side_number
amount=-$amount
[/gold]
[gold]
side=$give_side
amount=$amount
[/gold]
[message]
speaker=narrator
message= _ "Player $side_number has given Player $give_side $amount $resource"
[/message]
[/then]
[/if]
[/then]
[else]
[if]
[variable]
name=resource
equals=food
[/variable]
[then]
[message]
speaker=narrator
message= _ "How much?"
[text_input]
variable=amount
label=_ "Amount:"
max_chars=50
text="$food_$side_number"
[/text_input]
image="items/grain-sheaf.png"
[/message]
[if]
[variable]
name=food_$side_number
greater_than_equal_to=$amount
[/variable]
[then]
[set_variable]
name=food_$side_number
add=-$amount
[/set_variable]
[set_variable]
name=food_$give_side
add=$amount
[/set_variable]
[message]
speaker=narrator
message= _ "Player $side_number has given Player $give_side $amount $resource"
[/message]
[/then]
[/if]
[/then]
[/if]
[if]
[variable]
name=resource
equals=wood
[/variable]
[then]
[message]
speaker=narrator
message= _ "How much?"
[text_input]
variable=amount
label=_ "Amount:"
max_chars=50
text="$wood_$side_number"
[/text_input]
image="terrain/forest/great-tree-tile.png"
[/message]
[if]
[variable]
name=wood_$side_number
greater_than_equal_to=$amount
[/variable]
[then]
[set_variable]
name=wood_$side_number
add=-$amount
[/set_variable]
[set_variable]
name=wood_$give_side
add=$amount
[/set_variable]
[message]
speaker=narrator
message= _ "Player $side_number has given Player $give_side $amount $resource"
[/message]
[/then]
[/if]
[/then]
[/if]
[/else]
[/if]
[/then]
[else]
[sound]
name=leave.wav
[/sound]
[/else]
[/if]
[unstore_unit]
variable=worker
[/unstore_unit]
[/command]
[/option]
#enddef
#define SHIP_SUMMON IMAGE NAME GC FC WC TYPE DAM NUM
[option]
message= _ {MENU_IMG_TXT {IMAGE} "Order the construction of a {NAME} ship."}
[command]
[if]
{RCHECK {GC} {FC} {WC}}
[then]
[set_variable]
name=worker.moves
value=0
[/set_variable]
{RTRANSACTION {GC} {FC} {WC}}
[sound]
name=spear.wav
[/sound]
[sound]
name=water-blast.wav
[/sound]
[unstore_unit]
variable=worker
[/unstore_unit]
[unit]
name=Ship
type={TYPE}
role=$shipnum
hitpoints="200"
side=$side_number
x=$x1
y=$y1
[modifications]
[object]
[effect]
apply_to=new_attack
name= _ "flame cannon"
icon=attacks/dragonstaff.png
type=fire
range=ranged
damage={DAM}
number={NUM}
[specials]
{WEAPON_SPECIAL_MAGICAL}
[/specials]
[/effect]
[effect]
apply_to=new_animation
[attack_anim]
[filter_attack]
name=flame cannon
[/filter_attack]
{MISSILE_FRAME_FIRE_BREATH 9,-34 9,15 22,-22 24,10}
[/attack_anim]
[/effect]
[/object]
[/modifications]
[/unit]
[set_variable]
name=shipnum
add=1
[/set_variable]
[/then]
[else]
[unstore_unit]
variable=worker
[/unstore_unit]
[sound]
name=leave.wav
[/sound]
[/else]
[/if]
[/command]
[/option]
#enddef
#define MOD_UNIT_SHIP MESSAGE IMAGE GC FC WC CONFIRM TRAIT OP VALUE SOUND1 SOUND2
[option]
message= _ {MENU_IMG_TXT {IMAGE} {MESSAGE}} + " {GC}gold {FC}food {WC}wood"
[command]
[if]
{RCHECK {GC} {FC} {WC}}
[then]
{RTRANSACTION {GC} {FC} {WC}}
[sound]
name={SOUND1}
[/sound]
[sound]
name={SOUND2}
[/sound]
[set_variable]
name=worker.{TRAIT}
{OP}={VALUE}
[/set_variable]
{PRIVATE_MESSAGE {CONFIRM}}
[/then]
[else]
[sound]
name=leave.wav
[/sound]
[/else]
[/if]
[unstore_unit]
variable=worker
[/unstore_unit]
[/command]
[/option]
#enddef
#define MASK_BUILD MESSAGE IMAGE GC FC WC SOUND1 TERRAIN
[option]
message= _ {MENU_IMG_TXT {IMAGE} {MESSAGE}} + " -{GC}gold -{FC}food -{WC}wood"
[command]
[if]
{RCHECK {GC} {FC} {WC}}
[then]
[set_variable]
name=worker.moves
value=0
[/set_variable]
{RTRANSACTION {GC} {FC} {WC}}
[sound]
name={SOUND1}
[/sound]
[terrain_mask]
x=$x1
y=$y1
mask={TERRAIN}
[/terrain_mask]
[/then]
[else]
[sound]
name=leave.wav
[/sound]
[/else]
[/if]
[unstore_unit]
variable=worker
[/unstore_unit]
[/command]
[/option]
#enddef
#define GENERIC_BUILD_EX MESSAGE IMAGE GC FC WC MOP MOVES SOUND1 SOUND2 TERRAIN
[option]
message= _ {MENU_IMG_TXT {IMAGE} {MESSAGE}} + " -{GC}gold -{FC}food -{WC}wood"
[show_if]
[variable]
name=extended
equals=true
[/variable]
[/show_if]
[command]
[if]
{RCHECK {GC} {FC} {WC}}
[then]
[set_variable]
name=worker.moves
{MOP}={MOVES}
[/set_variable]
{RTRANSACTION {GC} {FC} {WC}}
[sound]
name={SOUND1}
[/sound]
[sound]
name={SOUND2}
[/sound]
[terrain]
x=$x1
y=$y1
terrain={TERRAIN}
[/terrain]
[capture_village]
side=$side_number
x=$x1
y=$y1
[/capture_village]
[/then]
[else]
[sound]
name=leave.wav
[/sound]
[/else]
[/if]
[unstore_unit]
variable=worker
[/unstore_unit]
[/command]
[/option]
#enddef
#define GENERIC_SUMMON_EX MESSAGE IMAGE GC FC WC CONFIRM SOUND TYPE TERRAIN
[option]
message= _ {MENU_IMG_TXT {IMAGE} {MESSAGE}} + " -{GC}gold -{FC}food -{WC}wood"
[show_if]
[variable]
name=extended
equals=true
[/variable]
[/show_if]
[command]
[if]
{RCHECK {GC} {FC} {WC}}
[then]
[set_variable]
name=worker.moves
value=0
[/set_variable]
{RTRANSACTION {GC} {FC} {WC}}
[sound]
name={SOUND}
[/sound]
[terrain]
x,y=$x1,$y1
terrain={TERRAIN}
[/terrain]
[unit]
x=$x1
y=$y1
side=$side_number
type={TYPE}
[/unit]
{PRIVATE_MESSAGE {CONFIRM}}
[/then]
[else]
[sound]
name=leave.wav
[/sound]
[/else]
[/if]
[unstore_unit]
variable=worker
find_vacant=yes
[/unstore_unit]
[/command]
[/option]
#enddef
the section of _general.cfg that I'm pretty sure is the important one for this problem: (generic_summon, special_summon, and special_summon2)
Spoiler:
Code: Select all
#define GENERIC_SUMMON MESSAGE IMAGE GC FC WC CONFIRM SOUND TYPE TERRAIN
[option]
message= _ {MENU_IMG_TXT {IMAGE} {MESSAGE}} + " -{GC}gold -{FC}food -{WC}wood"
[command]
[if]
{RCHECK {GC} {FC} {WC}}
[then]
[set_variable]
name=worker.moves
value=0
[/set_variable]
{RTRANSACTION {GC} {FC} {WC}}
[sound]
name={SOUND}
[/sound]
[terrain]
x,y=$x1,$y1
terrain={TERRAIN}
[/terrain]
[unit]
x=$x1
y=$y1
side=$side_number
type={TYPE}
[/unit]
{PRIVATE_MESSAGE {CONFIRM}}
[/then]
[else]
[sound]
name=leave.wav
[/sound]
[/else]
[/if]
[unstore_unit]
variable=worker
find_vacant=yes
[/unstore_unit]
[/command]
[/option]
#enddef
Code: Select all
#define SPECIAL_SUMMON MESSAGE IMAGE GC FC WC CONFIRM SOUND TYPE
[option]
message= _ {MENU_IMG_TXT {IMAGE} {MESSAGE}} + " -{GC}gold -{FC}food -{WC}wood"
[command]
[if]
{RCHECK {GC} {FC} {WC}}
[then]
{RTRANSACTION {GC} {FC} {WC}}
[sound]
name={SOUND}
[/sound]
[unit]
x=$x1
y=$y1
side=$side_number
type={TYPE}
[/unit]
{PRIVATE_MESSAGE {CONFIRM}}
[/then]
[else]
[sound]
name=leave.wav
[/sound]
[/else]
[/if]
[unstore_unit]
variable=worker
find_vacant=yes
[/unstore_unit]
[/command]
[/option]
#enddef
Code: Select all
#define SPECIAL_SUMMON2 MESSAGE IMAGE GC FC WC TYPE
[option]
message= _ {MENU_IMG_TXT {IMAGE} {MESSAGE}} + " -{GC}gold -{FC}food -{WC}wood"
[command]
[if]
{RCHECK {GC} {FC} {WC}}
[then]
{RTRANSACTION {GC} {FC} {WC}}
[unit]
x=$x1
y=$y1
side=$side_number
type={TYPE}
[/unit]
[/then]
[else]
[sound]
name=leave.wav
[/sound]
[/else]
[/if]
[unstore_unit]
variable=worker
find_vacant=yes
[/unstore_unit]
[/command]
[/option]
#enddef
_buildingoptions.cfg macro
the specific part I've been focusing on of _buildingoptions.cfg:
and the Cow.cfg file found in the units folder:
Trying to buy a cow from a "ranch" (desert village) will throw a Lua error in the game:
Code: Select all
<Lua error> game_error: unknown unit type: Cow
Buying core units in similar situations (from other villages like the #Tavern in the _buildingoptions.cfg macro) works just fine. Buying any non-core unit (aka, those that came with the add-on and are in the /units folder in the /add-ons folder) does not work in any situation.
Hope all that made sense and someone can provide some direction. I can't really code from scratch I just modify pre-exisiting files and pick them apart so I only barely know what I'm doing. If any information is missing just ask and I'll provide it.