- 积分
- 2094
- 威望
- 0
- 魅力
- 0
- 经验
- 1335
- 热心度
- 0
- 注册时间
- 2012-3-4
- 最后登录
- 2019-1-9
- 主题
- 64
- 回帖
- 436
- 精华
- 0
- 阅读权限
- 40
TA的每日心情 | 开心 2015-9-30 21:15 |
---|
签到天数: 2 天 连续签到: 1 天 [LV.1]投石矮人
4级 Famous Hero
- 积分
- 2094
|
目前是鼠标右键单击议事厅打开,求改为右键城堡打开。
因为这个脚本和建筑师的脚本打开有冲突。
ZVSE
ERMS_ScriptDate=12.1(January).2007
_WARNING_#1=IMPORTANT! This file is not in a plain text format. NEVER use any editor except ERM_S for making any kind of changes!
ERMS_PoweredBy=ERM Scripter v. 2004.6.29.918
****************************************************************
********************* New Upgrades *****************************
**** done by: **************************************************
**** Acid Dragon (building, dwelling and modifying parts) ******
**** Timothy Pulver (upgrading part) ***************************
**** special thanks to Thomas Franz for the PO:V3 bit ;) *******
****************************************************************
* Variables Used: v9500-v9600 (not all of them, there exist some irregullar gaps)
* Functions Used: FU9500-FU9513
* z Variables Used: z943-z959, z199500-z199604
!#VRv9500:S-1; [Initialize v9500 to -1]
!#VRv9520:S0;
!#VRv9562:S0;
!?TM19&v9562=0; [occur at day one for all players, never after (timer from wogify)]
!!UN:P555/?v1; [Check if New Upgrades script is enabled: v1=1 if Yes]
!!FU9508&v1=1:P;
!?FU9508;
!#UN:P555/?v1; [Check if New Upgrades script is enabled: v1=1 if Yes]
!#UN:P67/?v2; [Check if Neutral Town is enabled: v2=1 if yes]
!#UN&v2=1/v1=1:P67/0; [DISABLE Neutral Town]
!#UN:P125/?v2; [Check if the rule upg level 7 become level 8 is enabled: v2=1 if yes]
!#UN&v2=1/v1=1:P125/0; [DISABLE the rule]
!!MA:U29/-1; [Remove Master Gremlins to Halflings] *Tower*
!!MA:U138/-1; [Remove Halflings to Master Gremlins] *Tower*
****************************************************************
************************ Upgrading Part ************************
****************************************************************
!?CM1;
!!UN:P555/?v1; [Check if New Upgrades script is enabled: v1=1 if Yes]
!!FU9500&v1=1:P;
!?FU9500;
!!UN:P555/?v1; [Check if New Upgrades script is enabled: v1=1 if Yes]
!!UN:P173/?v4; [Check if Universal Upgrades are enabled: v4=1 if yes]
!!UN:P37/?v3; [Check if Rebalanced Creatures is enabled: v3=1 if yes]
!!MA&v1=1/v4=1/v3<>1:U29/173; [Master Gremlins to Santa Gremlins] *Tower*
!!MA&v1=1/v4=1/v3=1:U29/138; [Master Gremlins to Halflings] *Tower*
!!MA&v1=1/v4=1/v3=1:U138/29; [Halflings to Master Gremlins] *Tower*
!!UN:P900/?v5; [Check if STACK EXPERIENCE is enabled: v5=0 if no]
!!MA&v1=1/v4=1/v3<>1/v5=0:U29/138; [Master Gremlins to Halflings] *Tower*
!!MA&v1=1/v4=1/v3<>1/v5=0:U138/29; [Halflings to Master Gremlins] *Tower*
[Set/Reset town types for creature upgrading]
!!CA-1:T?y1; [Town type: y1]
!!CM:I?y2; [Position clicked: y2]
!!CA-1:P?v9530/?v9531/?v9532;
[Check creature types]
!!CA-1:P?y3/?y4/?y5; [Town's position: y3/y4/y5]
!!POy3/y4/y5:O?y6; [PO:O: y6]
!!FU9502&y6>0/y6<8:Py1; [Restore creatures unless nothing is stored yet]
[Set creature to be upgraded (if upgraded creature dwelling is built)]
!!FU9501&y2>=115/y2<=121:Py1/y2; [Garrison slots]
!!FU9501&y2>=140/y2<=146:Py1/y2; [Visiting hero slots]
------------------------------------------------------------------------------------------------------------------
[Determine which creature is clicked]
[x1=town type, x2=position clicked]
!?FU9501;
!!VRy1:S-1; !!VRy2:S-1;
!!VRy1&x2>=115/x2<=121:Sx2 -115; [Garrison creature slot number: y1]
!!VRy2&x2>=140/x2<=146:Sx2 -140; [Visiting hero creature slot number: y2]
[Determine creature type: y5]
!!CA-1:H0/?y3 H1/?y4; [Garrison hero: y3, Visiting hero: y4]
!!HEy3&y3>=0/y1>=0:C0/y1/?y5/d; [Garrison hero creature: y5]
!!CA-1&y3<0/y1>=0:M2/y1/?y5/d; [Garrison creature: y5]
!!HEy4&y4>=0/y2>=0:C0/y2/?y5/d; [Visiting hero creature: y5]
!!FU&y5<0:E; [Exit if not a creature]
!!MA:Uy5/?y7; [Check for a custom upgrade: y7]
[Default upgrade for all towns except Conflux]
!!VRy6&y7=-1/y5<=111:Sy5 %2; [Remainder of creature number divided by 2: y6]
!!VRy7&y7=-1/y5<=111/y6=0:Sy5 +1; [If non-upgraded, upgrade is y7]
[Default upgrade for Conflux]
!!VRy7&y7=-1/y5=112:S127; [Air Elemental]
!!VRy7&y7=-1/y5=113:S125; [Earth Elemental]
!!VRy7&y7=-1/y5=114:S129; [Fire Elemental]
!!VRy7&y7=-1/y5=115:S123; [Water Elemental]
!!VRy7&y7=-1/y5=118:S119; [Pixie]
!!VRy7&y7=-1/y5=120:S121; [Psychic Elemental]
!!VRy7&y7=-1/y5=130:S131; [Firebird]
!!VRy6:S1; [Initialize y6 to 1]
!!VRy6&y7>=0:S0; [Set y6 to 0 if y7>=0]
!!FU|y6=1/y7=-2:E; [Exit if no upgrade]
!!MA:Ly5/?v9502; [Store creature's level in v9502]
!!VRy8:S37 +v9502; [Upgraded dwelling of this creature's level: y8]
!!CA-1:B3/y8; [Check if town has this upgraded dwelling built: Flag 1 True if yes]
!!CA-1&-1:B3/19; [Check if horde building 1 is built: Flag 1 is true if yes]
!!CA-1&-1:B3/25; [Check if horde building 2 is built: Flag 1 is true if yes]
!!FU&-1:E; [Exit if upgraded dwelling isn't built]
!!POv9530/v9531/v9532:V3/?y-2; get flag for current town
!!VRy-2:&64; test if the bit 7 is set
!!FU&y-2=0:E; Exit if there's no special structure in town
!!VRv9500:Sy5; [Store creature number: v9500]
!!MA:Oy5/?v9501; [Store creature's town type in v9501]
!!FU&v9501<>x1:E; [Exit function if creture type is DIFFERENT than town type]
!!VRv9510:Sy7; [Store upgraded creature number: v9510]
!!MA:Oy7/?v9511; [Store upgraded creature's town type in v9511]
!!MA:Ly7/?v9512; [Store upgraded creature's level in v9512]
[Check & Store creature type and level]
!!CA-1:P?y13/?y14/?y15; [Town's position: y13/y14/y15]
!!POy13/y14/y15:B0/?y16 B1/?y17 O?y18; [PO:B0: y16 PO:B1: y17 PO:O: y18]
!!VRy9:Sy18 -1; [Subtract 1 from y18 to get real creature level: y9]
!!UN&v9502<>y9:Tx1/v9502/0/?y18; [If this level not stored, get non-upgraded type: y18]
!!UN&v9502<>y9:Tx1/v9502/1/?y19; [If this level not stored, get upgraded type: y19]
!!VRy10&v9502<>y9:Sy18 +1; [Non-upgraded type +1: y10]
!!VRy11&v9502<>y9:Sy19 +1; [Upgraded type +1: y11]
!!VRy12&v9502<>y9:Sv9502 +1; [Creature level +1: y12]
!!POy13/y14/y15&v9502<>y9:B0/y10; [If this level not stored, store non-upgraded type (+1)]
!!POy13/y14/y15&v9502<>y9:B1/y11; [If this level not stored, store upgraded type (+1)]
!!POy13/y14/y15&v9502<>y9:Oy12; [If this level not stored, store creature level (+1)]
[Set this town's creature of this level]
!!UN:Tx1/v9502/0/y5; [Set non-upgraded creature]
!!UN:Tx1/v9502/1/y7; [Set upgraded creature]
------------------------------------------------------------------------------------------------------------------
[Reset changed town creature types]
!?FU9502;
!!CA-1:P?y1/?y2/?y3; [Town's position: y1/y2/y3]
[Creature type: y4 (non-upgraded) and y5 (upgraded), y6 (level)]
!!POy1/y2/y3:B0/?y4 B1/?y5 O?y6; [PO:B0: y4 PO:B1: y5 PO:O: y6]
!!VRy4&y4>0:-1; [Subtract 1 from y4 to get non-upgraded creature number]
!!VRy5&y5>0:-1; [Subtract 1 from y5 to get upgraded creature number]
!!VRy6&y6>0:-1; [Subtract 1 from y6 to get creature level]
!!UN&y4>=0:Tx1/y6/0/y4; [Reset non-upgraded]
!!UN&y5>=0:Tx1/y6/1/y5; [Reset upgraded]
!!FU&v9500<0:E; [Exit function if no creature changed]
[Restore creature: v9500]
!!MA:Ov9500/v9501; [Restore creature's town type]
[Restore upgraded creature: v9510]
!!MA:Ov9510/v9511; [Restore upgraded creature's town type]
[Reset v9500 to -1]
!!VRv9500:S-1;
************************* set new upgrades ***********************************
!#UN:P555/?v1; [Check if Extended Creature Upgrades is enabled: v1=1 if Yes]
!#MA&v1=1:U13/150; [Archangels to Supreme Archangels] *Castle Level 8*
!#MA&v1=1:U27/151; [Gold Dragons to Diamond Dragons] *Rampart Level 8*
!#MA&v1=1:U41/152; [Titans to Lords of Thunder] *Tower Level 8*
!#MA&v1=1:U55/153; [Arch Devils to Antichrists] *Inferno Level 8*
!#MA&v1=1:U69/154; [Ghost Dragons to Blood Dragons] *Necropolis Level 8*
!#MA&v1=1:U83/155; [Black Dragons to Darkness Dragons] *Dungeon Level 8*
!#MA&v1=1:U97/156; [Ancient Behemoths to Ghost Behemoths] *Stronghold Level 8*
!#MA&v1=1:U111/157; [Chaos Hydras to Hell Hydras] *Fortress Level 8*
!#MA&v1=1:U131/158; [Phoenixes to Sacred Phoenixes] *Conflux Level 8*
[aligment changes]
!#MA&v1=1:O169/0; War Zealot > Castle
!#MA&v1=1:O192/1; Sylvan Centaurs > Rampart
!#MA&v1=1:O137/1; Sharpshooters > Rampart
!#MA&v1=1:O170/1; Arctic Sharpshooters > Rampart
!#MA&v1=1:O171/1; Lava Sharpshooters > Rampart
!#MA&v1=1:O138/2; Halflings > Tower
!#MA&v1=1:O173/2; Santa Gremlin > Tower
!#MA&v1=1:O116/2; Gold Golem > Tower
!#MA&v1=1:O117/2; Diamond Golem > Tower
!#MA&v1=1:O193/2; Sorceresses > Tower
!#MA&v1=1:O136/2; Enchanters > Tower
!#MA&v1=1:O159/4; Ghosts > Necropolis
!#MA&v1=1:O141/4; Mummies > Necropolis
!#MA&v1=1:O168/7; Gorynyches > Fortress
!#MA&v1=1:O164/8; Fire Messengers > Fortress
!#MA&v1=1:O165/8; Earth Messengers > Fortress
!#MA&v1=1:O166/8; Air Messengers > Fortress
!#MA&v1=1:O167/8; Water Messengers > Fortress
* changing statistics:
[The following can only be upgraded at Hill Forts]
[Hill Fort is trigger]
!?OB35;
!!UN:P555/?v2; [Check if the script is enabled: v2=1 if Yes]
!!FU&v2<>1:E; [Exit if script isn't enabled]
!!MA:U127/166; [Storm Elementals to Air Messengers] *Conflux*
!!MA:U125/165; [Magma Elementals to Earth Messengers] *Conflux*
!!MA:U129/164; [Energy Elementals to Fire Messengers] *Conflux*
!!MA:U123/167; [Ice Elementals to Water Messengers] *Conflux*
!!MA:U09/169; [Zealots to War Zealots] *Castle*
!!MA:U19/192; [Grand Elves to Sylvan Centaurs] *Rampart*
!!UN:P37/?v3; [Check if Rebalanced Creatures is enabled: v3=1 if yes]
!!MA&v2=1/v3<>1:U29/173; [Master Gremlins to Santa Gremlins] *Tower*
!!MA&v2=1/v3=1:U29/138; [Master Gremlins to Halflings] *Tower*
!!MA&v2=1/v3=1:U138/29; [Halflings to Master Gremlins] *Tower*
!!UN:P900/?v5; [Check if STACK EXPERIENCE is enabled: v5=0 if no]
!!MA&v2=1/v3<>1/v5=0:U29/138; [Master Gremlins to Halflings] *Tower*
!!MA&v2=1/v3<>1/v5=0:U138/29; [Halflings to Master Gremlins] *Tower*
!!MA:U33/116; [Iron Golems to Gold Golems] *Tower*
!!MA:U59/141; [Zombies to Mummies] *Necropolis*
!!MA:U116/117; [Gold Golems to Diamond Golems] *Tower*
!!MA:U137/170; [Sharpshooters to Arctic Sharpshooters] *Rampart*
!!MA:U136/193; [Enchanters to Sorceresses] *Tower*
!!MA:U170/171; [Arctic Sharpshooters to Lava Sharpshooters] *Rampart*
!!MA:U193/136; [Sorceresses to Enchanters] *Tower*
!!MA:U195/172; [Hell Steeds to Nightmares] *Neutral*
!!MA:U111/168; [Chaos Hydras to Gorynyches] *Fortress*
!!MA:U168/157; [Gorynches to Hell Hydras] *Fortress Level 8*
[Post-visit Hill Fort is trigger]
!$OB35;
!!UN:P555/?v2; [Check if the script is enabled: v2=1 if Yes]
!!FU&v2<>1:E; [Exit if script isn't enabled]
!!UN:P173/?v6; [Check if Extended Upgrades are enabled: v6=1 if yes]
!!UN:P174/?v7; [Check if Universal Upgrades are enabled: v7=1 if yes]
!!MA&v6<>1/v7<>1:U127/-1; [Remove Storm Elementals to Air Messengers] *Conflux*
!!MA&v6<>1/v7<>1:U125/-1; [Remove Magma Elementals to Earth Messengers] *Conflux*
!!MA&v6<>1/v7<>1:U129/-1; [Remove Energy Elementals to Fire Messengers] *Conflux*
!!MA&v6<>1/v7<>1:U123/-1; [Remove Ice Elementals to Water Messengers] *Conflux*
!!MA&v6<>1/v7<>1:U09/-1; [Remove Zealots to War Zealots] *Castle*
!!MA&v6<>1/v7<>1:U19/-1; [Remove Grand Elves to Sylvan Centaurs] *Rampart*
!!MA&v6<>1/v7<>1:U29/-1; [Remove Master Gremlins to Santa Gremlins] *Tower*
!!MA&v6<>1/v7<>1:U138/-1; [Remove Halflings to Master Gremlins] *Tower*
!!MA&v6<>1/v7<>1:U33/-1; [Remove Iron Golems to Gold Golems] *Tower*
!!MA&v6<>1/v7<>1:U59/-1; [Remove Zombies to Mummies] *Necropolis*
!!MA&v6<>1/v7<>1:U116/-1; [Remove Gold Golems to Diamond Golems] *Tower*
!!MA&v6<>1/v7<>1:U137/-1; [Remove Sharpshooters to Arctic Sharpshooters] *Rampart*
!!MA&v6<>1/v7<>1:U136/-1; [Remove Enchanters to Sorceresses] *Tower*
!!MA&v6<>1/v7<>1:U170/-1; [Remove Arctic Sharpshooters to Lava Sharpshooters] *Rampart*
!!MA&v6<>1/v7<>1:U193/-1; [Remove Sorceresses to Enchanters] *Tower*
!!MA&v6<>1/v7<>1:U195/-1; [Remove Hell Steeds to Nightmares] *Neutral*
!!MA:U111/157; [Chaos Hydras to Hell Hydras] *Fortress Level 8*
!!MA&v6<>1/v7<>1:U168/-1; [Remove Gorynches to Hell Hydras] *Fortress Level 8*
*****************************************************************************
************** the special structure in a town used for upgrading ***********
*****************************************************************************
!?CM1; (trigger on clicking in town screen)
!!UN:P555/?v2; [Check if the script is enabled: v2=1 if Yes]
!!FU&v2<>1:E; [Exit if script isn't enabled]
******* auto-destructing the special building if there's no vilage hall *****
* it's up here so as to skip the player/owner check and happens after
* just any kind of click after destroying the vilage hall (like exiting)
!!CA-1:B3/10; check if there's a vilage hall
!!CA-1&-1:B3/11; check town hall
!!CA-1&-1:B3/12; check city hall
!!CA-1&-1:B3/13; check capitol
* if something is built somewhere a flag +1 had to happen
!!POv9530/v9531/v9532&-1:V3/?y-2; get flag for current town
!!VRy-2&-1:&64; test if the bit 7 is set
!!POv9530/v9531/v9532&-1/y-2=64:V3/?y-3; get flag for current town
!!VRy-3&y-2=64/-1:&-65; unset bit 7
!!POv9530/v9531/v9532&-1/y-2=64:V3/y-3; once again set flag
!!CA-1:O?y-2; (owner of the town: y-2)
!!OW:C?v9540; (current player: y-3)
!!FU&y-2<>v9540:E; (Exit if player doesn't own town)
!!CM:S?y1; (Get what type of click)
!!FU&y1<>14:E; (exit if not right click)
!!CM:I?y1; (Get what type of click)
!!FU&y1<10:E; (abort if not town hall type)
!!FU&y1>13:E; (abort if not town hall type)
!!CA-1:T?y2; (get town type)
!!CM:R0; (Disable normal popup)
!!CA-1:B3/13; (if capitol built - reenable standard text)
!!CM&1:R1;
!!VRv4:S0;
!!VRv5:S0;
!!VRv6:S0;
!!CA-1:B3/9; (ckeck if there's a castle)
!!VRv4&1:S1; (set a helping var)
!!CA-1:B3/8; (check for citadel)
!!VRv5&1:S1;
!!CA-1:B3/7; (check for fort)
!!VRv6&1:S1;
!!CM&v4=0/v5=0/v6=0:R1; (if no fort, citadel or castle reenable standard text)
!!UN:P4/?y2; check if town demolition is enabled
!!CM&y2=1:R0; if it is not enabled - disable any standard text
************ get current resources *************
!!OW:Rv9540/6/?v9541; 1 - gold
!!OW:Rv9540/0/?v9542; 2 - wood
!!OW:Rv9540/2/?v9543; 3 - ore
!!OW:Rv9540/1/?v9544; 4 - mercury
!!OW:Rv9540/3/?v9545; 5 - sulfur
!!OW:Rv9540/4/?v9546; 6 - crystal
!!OW:Rv9540/5/?v9547; 7 - gems
!!OW:Rv9540/7/?v9548; 8 - mithril
************ set texts ********************
!!VRz946:Sz199601; already build
!!VRz947:Sz199602; can build
!!VRz948:Sz199603; not enough resources
!!VRz949:Sz199604; need to have a castle
!!VRz945:S^^;
!!VRz950:S^^;
!!CA-1:T?y2; check town type
************************ CONFLUX *****************************
!!VRz945&y2=8:Sz199500; text before building
!!VRz950&y2=8:Sz199501; text after building
!!VRz953&y2=8:Sz199502; the name of the graphic
!!VRv9551&y2=8:S20000; price in gold
!!VRv9552&y2=8:S30; price in crystals
!!VRv9553&y2=8:S15; price in gems
!!VRv9554&y2=8:Sv9546; second resource amount
!!VRv9555&y2=8:Sv9547; third resource amount
!!VRv9556&y2=8:S4; second resource is crystal
!!VRv9557&y2=8:S5; third resource is gems
************************* CASTLE *****************************
!!VRz945&y2=0:Sz199503; text before building
!!VRz950&y2=0:Sz199504; text after building
!!VRz953&y2=0:Sz199505; the name of the graphic
!!VRv9551&y2=0:S22000; price in gold
!!VRv9552&y2=0:S30; price in gems
!!VRv9553&y2=0:S30; price in ore
!!VRv9554&y2=0:Sv9547; second resource amount
!!VRv9555&y2=0:Sv9543; third resource amount
!!VRv9556&y2=0:S5; second resource is gems
!!VRv9557&y2=0:S2; third resource is ore
************************ RAMPART ****************************
!!VRz945&y2=1:Sz199506; text before building
!!VRz950&y2=1:Sz199507; text after building
!!VRz953&y2=1:Sz199508; the name of the graphic
!!VRv9551&y2=1:S20000; price in gold
!!VRv9552&y2=1:S25; price in crystals
!!VRv9553&y2=1:S40; price in wood
!!VRv9554&y2=1:Sv9546; second resource amount
!!VRv9555&y2=1:Sv9542; third resource amount
!!VRv9556&y2=1:S4; second resource is crystal
!!VRv9557&y2=1:S0; third resource is wood
************************ TOWER *****************************
!!VRz945&y2=2:Sz199509; text before building
!!VRz950&y2=2:Sz199510; text after building
!!VRz953&y2=2:Sz199511; the name of the graphic
!!VRv9551&y2=2:S25000; price in gold
!!VRv9552&y2=2:S30; price in gems
!!VRv9553&y2=2:S15; price in mercury
!!VRv9554&y2=2:Sv9547; second resource amount
!!VRv9555&y2=2:Sv9544; third resource amount
!!VRv9556&y2=2:S5; second resource is gems
!!VRv9557&y2=2:S1; third resource is mercury
************************ INFERNO *****************************
!!VRz945&y2=3:Sz199512; text before building
!!VRz950&y2=3:Sz199513; text after building
!!VRz953&y2=3:Sz199514; the name of the graphic
!!VRv9551&y2=3:S19000; price in gold
!!VRv9552&y2=3:S30; price in mercury
!!VRv9553&y2=3:S15; price in sulfur
!!VRv9554&y2=3:Sv9544; second resource amount
!!VRv9555&y2=3:Sv9545; third resource amount
!!VRv9556&y2=3:S1; second resource is mercury
!!VRv9557&y2=3:S3; third resource is sulfur
************************ NECROPOLIS *****************************
!!VRz945&y2=4:Sz199515; text before building
!!VRz950&y2=4:Sz199516; text after building
!!VRz953&y2=4:Sz199517; the name of the graphic
!!VRv9551&y2=4:S21000; price in gold
!!VRv9552&y2=4:S25; price in mercury
!!VRv9553&y2=4:S35; price in wood
!!VRv9554&y2=4:Sv9544; second resource amount
!!VRv9555&y2=4:Sv9542; third resource amount
!!VRv9556&y2=4:S1; second resource is mercury
!!VRv9557&y2=4:S0; third resource is wood
************************ DUNGEON *****************************
!!VRz945&y2=5:Sz199521; text before building
!!VRz950&y2=5:Sz199522; text after building
!!VRz953&y2=5:Sz199523; the name of the graphic
!!VRv9551&y2=5:S23000; price in gold
!!VRv9552&y2=5:S30; price in sulfur
!!VRv9553&y2=5:S35; price in ore
!!VRv9554&y2=5:Sv9545; second resource amount
!!VRv9555&y2=5:Sv9543; third resource amount
!!VRv9556&y2=5:S3; second resource is sulfur
!!VRv9557&y2=5:S2; third resource is ore
************************ STRONGHOLD *****************************
!!VRz945&y2=6:Sz199524; text before building
!!VRz950&y2=6:Sz199525; text after building
!!VRz953&y2=6:Sz199526; the name of the graphic
!!VRv9551&y2=6:S19000; price in gold
!!VRv9552&y2=6:S60; price in crystals
!!VRv9553&y2=6:S15; price in gems
!!VRv9554&y2=6:Sv9543; second resource amount
!!VRv9555&y2=6:Sv9546; third resource amount
!!VRv9556&y2=6:S2; second resource is ore
!!VRv9557&y2=6:S4; third resource is crystal
************************ FORTRESS *****************************
!!VRz945&y2=7:Sz199527; text before building
!!VRz950&y2=7:Sz199528; text after building
!!VRz953&y2=7:Sz199529; the name of the graphic
!!VRv9551&y2=7:S18000; price in gold
!!VRv9552&y2=7:S50; price in wood
!!VRv9553&y2=7:S20; price in sulfur
!!VRv9554&y2=7:Sv9542; second resource amount
!!VRv9555&y2=7:Sv9545; third resource amount
!!VRv9556&y2=7:S0; second resource is wood
!!VRv9557&y2=7:S3; third resource is sulfur
********************** check if the building is built ****************
!!VRv9520:S0;
!!POv9530/v9531/v9532:V3/?y-2; get flag for current town
!!VRy-2:&64; test if the bit 7 is set
!!VRv9520&y-2=64:S1; set a check value for 'yes' on the v9520
********************** handle texts on the town screen ***************
!!CA-1:R?y3;
!!VRz945&v9520=0/y3=1:Sz945+z946;
!!VRz945&v9520=0/y3=0/v4=1/v9554>=v9552/v9541>=v9551/v9555>=v9553:Sz945+z947;
!!VRz945&v9520=0/y3=0/v4=1/v9541>=v9551/v9554>=v9552/v9555<v9553:Sz945+z948;
!!VRz945&v9520=0/y3=0/v4=1/v9541>=v9551/v9554<v9552:Sz945+z948;
!!VRz945&v9520=0/y3=0/v4=1/v9541<v9551:Sz945+z948;
!!VRz945&v9520=0/y3=0/v4=0:Sz945+z949;
!!IF&v9520=0:V1/0;
!!IF&v9520=0/y3=1:M1/945;
!!IF&v9520=0/y3=0/v4=1/v9541<v9551:Q2/6/v9551/v9556/v9552/v9557/v9553/1/945;
!!IF&v9520=0/y3=0/v4=1/v9541>=v9551/v9554<v9552:Q2/6/v9551/v9556/v9552/v9557/v9553/1/945;
!!IF&v9520=0/y3=0/v4=1/v9541>=v9551/v9554>=v9552/v9555<v9553:Q2/6/v9551/v9556/v9552/v9557/v9553/1/945;
!!IF&v9520=0/y3=0/v4=1/v9541>=v9551/v9554>=v9552/v9555>=v9553:Q1/6/v9551/v9556/v9552/v9557/v9553/2/945;
!!IF&v9520=0/y3=0/v4=0:M1/945;
!!FU&v9520=0/-1:E; (exit if player doesn't build)
******************************* building the special structure procedure *************
!!VRv9541&v9520=0/1:Sv9541-v9551; substract 'price' from 'gold'
!!VRv9554&v9520=0/1:Sv9554-v9552; substract 'price' from 'second resource amount'
!!VRv9555&v9520=0/1:Sv9555-v9553; substract 'price' from 'third resource amount'
!!OW&v9520=0/1:Rv9540/6/v9541; set new gold value
!!OW&v9520=0/1:Rv9540/v9556/v9554; set new second resource
!!OW&v9520=0/1:Rv9540/v9557/v9555; set new third resource
!!VRz10&v9520=0/1:S^..\data\p\BUILDTWN.WAV^;
!!SN&v9520=0/1:Pz10; Play the sound of a new building
!!POv9530/v9531/v9532&v9520=0/1:V3/?y1; get flag for current town
!!VRy1&v9520=0/1:|64; set the structure to 'built' (set bit 7)
!!POv9530/v9531/v9532&v9520=0/1:V3/y1; set flag
!!CA-1&v9520=0/1:R1; no more building today for this town
!!VRv9520&v9520=0/1:S1; set the helping v9520 because I don't want to re-write the entire code :P
**************************** text if the structure is built **************
!!IF&v9520=1:D3/950/0/0/952/0/0/0/953/0/0/0/0/0/0/0;
!!IF&v9520=1:F3/0/0/0/0/0; [disabled cancel button]
!!IF&v9520=1:E1/3; [Display dialogue box]
***************************************************************************
************ AI building the special structure and upgrading **************
***************************************************************************
!?OB98&-1000; !!FU9504:P; -occur when AI is entering town
!$OB98&-1000; !!FU9504:P; -occur when AI is leaving town
!?FU9504;
!!UN:P555/?v1; [Check if the script is enabled: v1=1 if Yes]
!!FU&v1<>1:E; [Exit if not enabled]
***************************** building part ******************************
!!CA998:O?y-2; (owner of the town: y-2)
!!OW:C?v9540; (current player: y-3)
!!FU&y-2<>v9540:E; (Exit if player doesn't own town)
!!VRv4:S0;
!!CA998:B3/9; (ckeck if there's a castle)
!!VRv4&1:S1; (set a helping var)
;get money
!!OW:Rv9540/6/?v9541; 1 - gold
!!OW:Rv9540/0/?v9542; 2 - wood
!!OW:Rv9540/2/?v9543; 3 - ore
!!OW:Rv9540/1/?v9544; 4 - mercury
!!OW:Rv9540/3/?v9545; 5 - sulfur
!!OW:Rv9540/4/?v9546; 6 - crystal
!!OW:Rv9540/5/?v9547; 7 - gems
!!OW:Rv9540/7/?v9548; 8 - mithril
!!CA998:T?y2; check town type
************************ CONFLUX *****************************
!!VRv9551&y2=8:S15000; price in gold
!!VRv9552&y2=8:S30; price in crystals
!!VRv9553&y2=8:S15; price in gems
!!VRv9554&y2=8:Sv9546; second resource amount
!!VRv9555&y2=8:Sv9547; third resource amount
!!VRv9556&y2=8:S4; second resource is crystal
!!VRv9557&y2=8:S5; third resource is gems
************************* CASTLE *****************************
!!VRv9551&y2=0:S16000; price in gold
!!VRv9552&y2=0:S30; price in gems
!!VRv9553&y2=0:S30; price in ore
!!VRv9554&y2=0:Sv9547; second resource amount
!!VRv9555&y2=0:Sv9543; third resource amount
!!VRv9556&y2=0:S5; second resource is gems
!!VRv9557&y2=0:S2; third resource is ore
************************ RAMPART ****************************
!!VRv9551&y2=1:S15000; price in gold
!!VRv9552&y2=1:S25; price in crystals
!!VRv9553&y2=1:S40; price in wood
!!VRv9554&y2=1:Sv9546; second resource amount
!!VRv9555&y2=1:Sv9542; third resource amount
!!VRv9556&y2=1:S4; second resource is crystal
!!VRv9557&y2=1:S0; third resource is wood
************************ TOWER *****************************
!!VRv9551&y2=2:S17000; price in gold
!!VRv9552&y2=2:S30; price in gems
!!VRv9553&y2=2:S15; price in mercury
!!VRv9554&y2=2:Sv9547; second resource amount
!!VRv9555&y2=2:Sv9544; third resource amount
!!VRv9556&y2=2:S5; second resource is gems
!!VRv9557&y2=2:S1; third resource is mercury
************************ INFERNO *****************************
!!VRv9551&y2=3:S14500; price in gold
!!VRv9552&y2=3:S30; price in mercury
!!VRv9553&y2=3:S15; price in sulfur
!!VRv9554&y2=3:Sv9544; second resource amount
!!VRv9555&y2=3:Sv9545; third resource amount
!!VRv9556&y2=3:S1; second resource is mercury
!!VRv9557&y2=3:S3; third resource is sulfur
************************ NECROPOLIS *****************************
!!VRv9551&y2=4:S15500; price in gold
!!VRv9552&y2=4:S25; price in mercury
!!VRv9553&y2=4:S35; price in wood
!!VRv9554&y2=4:Sv9544; second resource amount
!!VRv9555&y2=4:Sv9542; third resource amount
!!VRv9556&y2=4:S1; second resource is mercury
!!VRv9557&y2=4:S0; third resource is wood
************************ DUNGEON *****************************
!!VRv9551&y2=5:S17000; price in gold
!!VRv9552&y2=5:S30; price in sulfur
!!VRv9553&y2=5:S35; price in ore
!!VRv9554&y2=5:Sv9545; second resource amount
!!VRv9555&y2=5:Sv9543; third resource amount
!!VRv9556&y2=5:S3; second resource is sulfur
!!VRv9557&y2=5:S2; third resource is ore
************************ STRONGHOLD *****************************
!!VRv9551&y2=6:S14500; price in gold
!!VRv9552&y2=6:S60; price in crystals
!!VRv9553&y2=6:S15; price in gems
!!VRv9554&y2=6:Sv9543; second resource amount
!!VRv9555&y2=6:Sv9546; third resource amount
!!VRv9556&y2=6:S2; second resource is ore
!!VRv9557&y2=6:S4; third resource is crystal
************************ FORTRESS *****************************
!!VRv9551&y2=7:S14000; price in gold
!!VRv9552&y2=7:S50; price in wood
!!VRv9553&y2=7:S20; price in sulfur
!!VRv9554&y2=7:Sv9542; second resource amount
!!VRv9555&y2=7:Sv9545; third resource amount
!!VRv9556&y2=7:S0; second resource is wood
!!VRv9557&y2=7:S3; third resource is sulfur
********************** check if the building is built ****************
!!VRv9520:S0;
!!CA998:P?v9530/?v9531/?v9532; get position of the town
!!POv9530/v9531/v9532:V3/?y-2; get flag for current town
!!VRy-2:&64; test if the bit 7 is set
!!VRv9520&y-2=64:S1; set a check value for 'yes' on the v9520
********************** set a flag if the right conditions are met ***************
*** NOTE: to make it easier for the AI, it builds as soon as it gets the right resources,
*** no matter if AI built in tis turn or not
!!IF&v9520=0/v4=0:V1/0;
!!IF&v9520=0/v4=1/v9541>=v9551:V1/1;
!!IF&v9520=0/v4=1/v9541<v9551:V1/0;
!!FU&v9520=0/-1:E; (exit if player doesn't build)
******************************* building the special structure procedure **************
***** NOTE: AI has to have only the right ammount of gold - resources will be substracted
***** (if not enough resources, then take away what AI has), but the building procedure
***** for the AI doesn't depend on them - only on gold.
***** (this is because AI doesn't know it 'needs' the right resources and won't use the
***** marketplace or won't save resources to get them)
***************************************************************************************
***** UPDATE: AI now has to have only about 75% of the gold ammount for human players
***************************************************************************************
!!VRv9541&v9520=0/1:Sv9541-v9551; substract 'price' from 'gold'
!!VRv9554&v9520=0/1/v9554<v9552:S0; set '0' for 'second resource amount' (if NOT enough)
!!VRv9554&v9520=0/1/v9554>=v9552:Sv9554-v9552; substract 'price' from 'second resource amount' (if enough)
!!VRv9555&v9520=0/1/v9555<v9553:S0; set '0' for 'third resource amount' (if NOT enough)
!!VRv9555&v9520=0/1/v9555>=v9553:Sv9555-v9553; substract 'price' from 'third resource amount' (if enough)
!!OW&v9520=0/1:Rv9540/6/v9541; set new gold value
!!OW&v9520=0/1:Rv9540/v9556/v9554; set new second resource
!!OW&v9520=0/1:Rv9540/v9557/v9555; set new third resource
!!POv9530/v9531/v9532&v9520=0/1:V3/?y1; get flag for current town
!!VRy1&v9520=0/1:|64; set the structure to 'built' (set bit 7)
!!POv9530/v9531/v9532&v9520=0/1:V3/y1; set flag
***************************** upgrading part *****************************
!!POv9530/v9531/v9532:V3/?y-2; get flag for current town
!!VRy-2:&64; test if the bit 7 is set
!!FU&y-2=0:E; Exit if there's no special structure in town
!!HE-1:N?v1; [Hero number: v1]
!!CA998:T?v2; [Town type: v2]
[Check each creature in AI hero's army]
!!DO9503/0/6/1:Pv1/v2;
[Check each creature in AI hero's army]
[x1=hero number, x2=town type]
!?FU9503;
!!HEx1:C0/x16/?y1/?y7; [Type of creature: y1, Number: y7]
!!FU|y1<0/y7=0:E; [Exit if creature slot is empty]
!!MA:Oy1/?y2; [Town creature belongs to: y2]
!!MA:Uy1/?y3; [Creature's upgrade number: y3]
!!MA:Ly1/?y4; [Creature's level: y4]
!!VRy6:Sy4 +37; [Upgraded dwelling number in town: y6]
!!CA998:B3/y6; [Check if upgraded dwelling is built: Flag 1 is true if yes]
!!CA998&-1:B3/19; [Check if horde building 1 is built: Flag 1 is true if yes]
!!CA998&-1:B3/25; [Check if horde building 2 is built: Flag 1 is true if yes]
[Exit if NOT native town, creature has no upgrade, creature has default upgrade or upgraded dwelling isn't built]
!!FU&y3=-2:E;
!!FU&y3=-1:E;
!!FU&y2<>x2:E;
!!FU&-1:E;
* [Default upgrade for all towns except Conflux: y3]
*!VRy5&y3=-1/y1<=111:Sy1 %2; [Remainder of creature number divided by 2: y5]
*!VRy3&y3=-1/y1<=111/y5=0:Sy1 +1; [If non-upgraded, upgrade is y3]
* [Default upgrade for Conflux: y3]
*!VRy3&y3=-1/y1=112:S127; [Air Elemental]
*!VRy3&y3=-1/y1=113:S125; [Earth Elemental]
*!VRy3&y3=-1/y1=114:S129; [Fire Elemental]
*!VRy3&y3=-1/y1=115:S123; [Water Elemental]
*!VRy3&y3=-1/y1=118:S119; [Pixie]
*!VRy3&y3=-1/y1=120:S121; [Psychic Elemental]
*!VRy3&y3=-1/y1=130:S131; [Firebird]
!!VRy5:S1; [Initialize y5 to 1]
!!VRy5&y3>=0:S0; [Set y5 to 0 if y3>=0]
!!FU|y5=1:E; [Exit if no upgrade]
!!OW:C?v9540; (current player: v6540)
!!OW:Rv9540/6/?v9541; get gold
!!HEx1:C0/x16/y1/?v9588; [get number of creatures]
!!MA:Cy1/6/?v9589; [get cost of creature un-upg]
!!MA:Cy3/6/?v9590; [get cost of creature upg]
!!VRv9590: v9590-v9589; [calculate difference in costs]
!!VRv9590: v9590*v9588; [multiply by creature number to get the real price]
!!VRv9590: v9590:4; [divide by 4 and multiply by 3 to get 75% of the real price]
!!VRv9590: v9590*3; [divide by 4 and multiply by 3 to get 75% of the real price]
!!HEx1&v9590<=v9541:C0/x16/y3/d; [Upgrade creature]
!!VRv9591&v9590<=v9541:Sv9541-v9590; substract 'price' from 'gold'
!!OW&v9590<=v9541:Rv9540/6/v9591; set new gold value
*** this was used for bug-catching only :)
*!IF&v9590<=v9541:M ^AI upgrades creature number %Y1 to %Y3 in a quantity of %V9588 for %V9590 gold. He had %V9541 gold, now he has %V9591^;
[ 本帖最后由 独孤求败 于 2012-5-13 21:24 编辑 ] |
|