佳丽云

英雄无敌3-WoG中文站

 找回密码
 英雄注册|Register
查看: 14723|回复: 6

New script for WoG359 test:Alternate peasant script

 关闭 [复制链接]

 成长值: 27250

  • TA的每日心情
    无聊
    2020-5-27 00:09
  • 签到天数: 24 天

    连续签到: 2 天

    [LV.4]狂狼人

    5771

    回帖

    2696万

    金币

    42

    精华

    管理员

    精灵奇侠

    Rank: 12Rank: 12Rank: 12

    积分
    9244753

    社区QQ达人论坛创始人杰出贡献论坛元老

    发表于 2007-2-10 13:54:15 | 显示全部楼层 |阅读模式
    Script Author: c3fassbier<siegfried@rorkvell.de>
    Note:
    • If you find any other bugs in this script, please contact the author with the eamil that is given above.
    • You need to register as a member to download the script.
    • In the second floor of this thread is the original codes of the script, feel free to copy them and make it as your own script. You should name your file as script**.[wiki]ERM[/wiki](** is numbers between 78~99) to make it works in your ...Data\s folder.
    The alternate peasant script
    This script makes peasants do many different economic things. What they do depends on where you put them.
    Peasants in towns:
    In towns peasants are producing gold and optionally resources. To do so they must be garrisoned. Peasants in a visiting heroes army do not produce gold or resources. They may do other things (see peasants in hero armies). The basic gold production in a village (town with only village hall built) is 1 gold per peasant. This may be increased by town buildings and/or hero level, secondary skills, speciality and artifacts as well as peasant rank:
    +1% per average rank
    +10% for town hall
    +20% for city hall
    +40% for capitol (note: town hall, city hall and capitol do not sum up)
    +10% for market place
    +100% for grail
    +0...60% for estates (0..30% normal, 0-60% for gold or estates specialists)
    +20% per hero level for gold specialists
    +15% for equipped sack of gold
    +10% for equipped bag of gold
    +5% for equipped purse of gold
    If a resource silo is built, then 1 unit of the silos resource type is produced daily per 1000 peasants. If the resource silo produces wood and ore, both are produced, but still per 1000 peasants.
    If the garrisoned hero is a resource specialist, then 1 unit of that resource per 1000 peasants is produced, too, if the resource silo is built.
    Peasants in mines:
    For wood and ore, one unit of that resource is produced per day per 500 peasants. For the other resources, 1 resource unit is produced daily per 1000 peasants. Additionally some mines add a significant growth rate to some creatures. They do (currently) not produce any creatures out of nothing, but they do apply a growth rate to these creatures already guarding the mine. The growth rate is 1 hitpoint per 1-2 peasants, depending on the peasant growth rate. These mines apply growth rates to these creatures:
    Wood: Dendroid gurads, and dendroid soldiers
    Mercury: Currently none (no idea)
    Ore: Iron golems
    Sulfur: Rust dragons
    Crystal: Crystal dragon
    Gem: Diamond golems and diamond dragons
    Gold: Gold golems
    (Planned for next version: Peasants will apply a smaller growth rate to any creature for unowned mines. At startup all unowned mines are filled with some creatures.)
    Peasants in Garrisons:
    Peasants do apply a small growth rate to any creature garrisoned. The growth rate is applied to peasants, too. Growth rate is 1 hitpoint per 2-4 peasants depending on peasant growth rate.
    Peasants in hero armies (currently in development):
    If at the end of the week the hero has some remaining movement points left, then the peasants apply a small growth rate to the heroes stacks. The growth rate is:
    (peasant rank + 1) * (hero level) * (movement points) * (number of peasants) / 10000.
    Since peasants are the slowest creatures, the normal over-land movement points are at maximum 1300. So for a level 1 hero and rank 0 peasants and the hero not moving at all at day 7, this sums up to 1300/10000 = 0.13 hitpoints per peasant. So you would need 8 peasants to at least add 1 peasant to your peasant stack.
    Peasants as guards in dwellings (planned for future version):
    They supply additional creatures to be hired per week.

    General strategic considerations:
    Peasants do not do all these things at the same time. You have to decide what to focus on. In early game, depending on your resource situation, it may be good to put peasants in multiples of 500 into sawmills and ore pits to increase the production of these urgently needed resources. The production is more effective than buying these resources at the in-town market place, as long as you own less than 4 market places. Of course, if you have access to a market place on the adventure map, it is most effective to buy these resources there and put the peasants into your capitol. Later in the game it may become mandatory to move them to a town, preferably into the capitol. The gold production is highest in the capitol. But later you also will need some of the precious resources, f.ex. to build your magic guilds or to build your high-level dwellings. If you own 4 or more market places it is better to buy these resources there. If you own less it is more effective to let these resources be produced in the mines.
    If you have enough resources and access to a garrison, especially in early game it may be a good idea to put the peasants into the garrison, maybe together with some low level creatures. This slightly increases your army in the next week. Att.: The growth rate is applied to every non-empty slot! So it is best to fill all slots with something. Hint: It may be a good idea to fill all slots of the garrison with peasants. This increases your available peasants very fast, since the growth rate is applied to every stack, and so next week there are more peasants in every stack applying a higher growth rate to all peasant stacks, and so on. Drawback is, as long as they are in the garrison they do not produce resources in mines or towns. It is your decision where you put the peasants.
    Some tactical considerations:
    If you get the peasants into battle to increase their experience, then try to preserve them. They are no fodder. Each peasant killed means one potential gold income less. And, if you are unlucky, 1 other resource less per day, too. So keep an eye on your peasants, they are valuable units! Not on the battlefield, but economically. If you are short on resources, the peasants may be the key to victory!
    If you have some garrisons on the adventure map, be sure to use them to replenish your stacks at the start of the week. For this a hero should have one stack of peasants in his army with significant numbers (preferably more than 1000). So if there is no enemy nearby on day 7, put the peasants into the garrison, together with 1 creature of any type you whish to refill. Be sure to fill all 7 slots of the garrision. The next day you then will have some new recruits. Of course this is only useful for garrisons where you then can remove these creatures and put them into your army. Perhaps you check first.
    Appendix:
    Peasant growth rate is set to 50 if one of the other general growth options is set:
    Option 284 Growth in town dwelling option (script127)
    Option 285 Growth in hero army and garrison
    Option 116 General army growth
    The alternate peasant script is disabled if the H4 peasant script is enabled (Option 286).
    Simple notification messages are subpressed if option 185 is set (disable some messages).

    Known Bugs:
    Due to erm limitations these bugs apply:
    If a town has a visiting hero (i.e. a hero at the same position as the town), then the peasant experience is irrelevant (only base rank applies). If the town has only a visiting hero and no garrisoned hero, then the peasants do not produce anything there.
    The same applies to mines.
    If at the beginning of the week a garrison has a visiting hero, then there will be no creature growth at all. The script engine is unable to find the garrison at the given position if at this position there is a hero. It finds the hero instead. (Should i then take an alternate approach and apply the garrison growth to the hero army instead?)

    Have fun!

    script134.zip

    10.6 KB, 下载次数: 33, 下载积分: 金币 -5

     成长值: 27250

  • TA的每日心情
    无聊
    2020-5-27 00:09
  • 签到天数: 24 天

    连续签到: 2 天

    [LV.4]狂狼人

    5771

    回帖

    2696万

    金币

    42

    精华

    管理员

    精灵奇侠

    Rank: 12Rank: 12Rank: 12

    积分
    9244753

    社区QQ达人论坛创始人杰出贡献论坛元老

     楼主| 发表于 2007-2-10 13:55:42 | 显示全部楼层

    1. ZVSE
    2. [wiki]ERM[/wiki]S_ScriptName=Peasants
    3. ERMS_ScriptAuthor=siegfried
    4. ERMS_ScriptVersion=1.3.1
    5. ERMS_ScriptDate=7.2(February).2007
    6. ERMS_ScriptERMVersion=2.70
    7. ERMS_ScriptLanguage=German or Deutsch (native)
    8. ERMS_ScriptUsedFunctions=FU614-FU619;FU817-FU818
    9. ERMS_PoweredBy=ERM Scripter v. 2004.10.5.945
    10. _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!

    11. ** Peasant script
    12. ** This adds resource production for peasants stored in towns or mines.
    13. ** This is an alternate to the H4 peasant script and as such disabled if the
    14. ** H4 peasant script is enabled.
    15. ** H4 peasant option is 286
    16. ** This peasant option is 334

    17. ** Towns
    18. ** Basic gold production in towns is 1 gold per peasant. It may be increased:
    19. **   +1% per average rank
    20. **  +10% for town hall
    21. **  +20% for city hall
    22. **  +40% for capitol (note: town hall, city hall and capitol do not sum up)
    23. **  +10% for market place
    24. ** +100% for grail
    25. ** +0...60% for estates (0..30% normal, 0-60% for gold or estates specialists)
    26. **  +10% per hero level for gold specialists
    27. **  +15% for equipped sack of gold
    28. **  +10% for equipped bag of gold
    29. **   +5% for equipped purse of gold
    30. ** May sum up to 230% for lvl1 hero and 1120% for lvl89 hero


    31. ** Vars from script00.erm:
    32. ** v2391 ($once$): 1 if first active color, 0 else (read only)
    33. ** v2393: day (read only)

    34. ** Vars from script127 (H4 peasant script) reused:
    35. ** z78: Peasant speciality text (set)
    36. ** v600 - v608: Players hero list (written)

    37. ** Message disabling option from script025: Option number 185
    38. ** If option set, disable messages

    39. ** v998, v999, v1000: Position of object.
    40. ** Rem: During function executing the content of these
    41. ** variables seems to be destroyed. So position is given
    42. ** by parameter, and after function execution the position
    43. ** is resoored.


    44. !#UN:P334/1;                           DEBUG: Manually enable

    45. ****************************************************************************
    46. ** Aux. function to iterate through slots
    47. ** Town version (town without hero)
    48. ** x1 = creature type (-1 = any)
    49. ** x2 = dummy (not used)
    50. ** x3 = fixed hitpoint growth rate
    51. ** x4 = additional experience
    52. ** x5 = xpos
    53. ** x6 = ypos
    54. ** x7 = level
    55. ** x16 = slot number
    56. ** v13 = function multiplexer (do not change inside function)
    57. ** returns:
    58. ** v1 = Number of (matching) creatures
    59. ** v2 = Sum of experience per creature (of matching creatures)
    60. ** v3 = Number of slots with matching creatures
    61. ** v4 = First empty slot
    62. ** v5 = First matching slot
    63. !?FU817&v13=98;                        Town
    64. !!VRv1&x16=0:S0;                       Init number of creatures
    65. !!VRv2&x16=0:S0;                       Init Experience
    66. !!VRv3&x16=0:S0;                       Init number of stacks
    67. !!VRv4&x16=0:S-1;                      Init first free slot
    68. !!VRv5&x16=0:S-1;                      Init first matching slot
    69. ** DEBUG
    70. ** Need that for now if there is a town without garrisoned hero
    71. ** plus a visiting hero. The EX trigger then looks for the hero
    72. ** at that position and throws an error, because type = town is
    73. ** specified.
    74. !!OBx5/x6/x7:T?y1;                     Type (maybe visiting hero)
    75. **IF&y1<>98:M^Error: No town found at location %X5,%X6,%X7^;
    76. **FU&y1<>98:E;                         Exit if not town
    77. !!VRy7:S0;
    78. !!CAx5/x6/x7&y1=34:M2/x16/?y5/?y6;
    79. !!EXx5/x6/x7/x16/2&y1=98:A?y5/?y6/?y7; y5=type, y6=number, y7=exp
    80. !!FU&y5>=160/y5<=163:E;                No emissary growth
    81. !!VRv4&y6=0/v4=-1:Sx1;                 Found first empty slot
    82. !!FU&y6=0:E;                           Empty slot: Done
    83. !!VRv5&y5=x1/v5=-1:Sx1;                Found first matching slot
    84. !!VRy1&x1<>-1:S-1;
    85. !!MA&x1<>-1:Ux1/?y2;                   y2 = possible upgraded version
    86. !!VRv1|x1=-1/x1=y5/x1=y2:+y6;          Add number of creatures
    87. !!VRv2|x1=-1/x1=y5/x1=y2:+y7;          Add experience per creature
    88. !!VRv3|x1=-1/x1=y5/x1=y1:+1;           Increment number of stacks
    89. !!FU&x3=0/x4=0:E;                      Done
    90. !!FU|x1>=0/x1<>y5/x1<>y2:E;
    91. !!FU&y6>2000:E;                        No growth beyond 2000
    92. **FU&y5=139/y6>1000:E;                 EXPERIMENTAL: no growth for peasants > 1000
    93. !!MA:Py5/?y8;                          y8 = Hitpoints per creature
    94. !!VRy9:S0;                             Init
    95. !!VRy9&y8>0/x3>y8:Sx3:y8;              y9 = Number of creatures to add
    96. !!CAx5/x6/x7&x3<>0:M2/x16/d/dy9;       Add creatures
    97. !!FU&x4=0:E;                           Done
    98. !!FU&y1<>98:E;
    99. !!UN:P900/?y11;                        Stack experience enabled?
    100. !!FU&y11=0:E;                          Exit if not
    101. !!EXx5/x6/x7/x16/2&x4<>0:Ad/d/dx4;     Add experience
    102. !!FU:E;                                Done

    103. ****************************************************************************
    104. ** Aux. function to iterate through slots
    105. ** Hero version
    106. ** x1 = creature type (-1 = any)
    107. ** x2 = Hero ID
    108. ** x3 = fixed hitpoint growth rate
    109. ** x4 = additional experience
    110. ** x16 = slot number
    111. ** v13 = function multiplexer (do not change inside function)
    112. ** returns:
    113. ** v1 = Number of (matching) creatures
    114. ** v2 = Sum of experience per creature (of matching creatures)
    115. ** v3 = Number of slots with matching creatures
    116. ** v4 = First empty slot
    117. ** v5 = First matching slot
    118. !?FU817&v13=34;                        Hero
    119. !!VRv1&x16=0:S0;                       Init number of creatures
    120. !!VRv2&x16=0:S0;                       Init Experience
    121. !!VRv3&x16=0:S0;                       Init number of stacks
    122. !!VRv4&x16=0:S-1;                      Init first free slot
    123. !!VRv5&x16=0:S-1;                      Init first matching slot
    124. !!FU&x1<0:E;                           Parameter error
    125. !!FU&x1>155:E;                         Parameter error
    126. !!EXx2/x16:A?y5/?y6/?y7;               y5 = type, y6 = number, y7 = exp.
    127. !!FU&y5>=160/y5<=163:E;                No emissary growth
    128. !!VRv4&y6=0/v4=-1:Sx1;                 Found first empty slot
    129. !!FU&y6=0:E;                           Empty slot: Done
    130. !!VRy1&x1<>-1:S-1;
    131. !!MA&x1<>-1:Ux1/?y2;                   y1 = possible upgraded version
    132. !!VRv1|x1=-1/x1=y5/x1=y2:+y6;          Add number of creatures
    133. !!VRv2|x1=-1/x1=y5/x1=y2:+y7;          Add experience per creature
    134. !!VRv3|x1=-1/x1=y5/x1=y2:+1;           Increment number of stacks
    135. !!FU&x3=0/x4=0:E;                      Done
    136. !!FU&x1>=0/x1<>y5/x1<>y2:E;
    137. !!FU&y6>2000:E;                        No growth beyond 2000
    138. **FU&y5=139/y6>1000:E;                 EXPERIMENTAL: no growth for peasants > 1000
    139. !!MA:Py5/?y8;                          y8 = Hitpoints per creature
    140. !!VRy9:S0;                             Init
    141. !!VRy9&y8>0/x3>y8:Sx3:y8;              y9 = Number of creatures to add
    142. !!HEx2&x3<>0:C0/x16/d/dy9;             Add creatures
    143. !!FU&x4<>0:E;                          Done
    144. !!UN:P900/?y11;                        Stack experience enabled?
    145. !!FU&y11=0:E;                          Exit if not
    146. !!EXx2/x16&x4<>0:A?d/d/dx4;            Add experience
    147. !!FU:E;                                Done

    148. ****************************************************************************
    149. ** Aux. function to iterate through slots
    150. ** Mine version (types 53 and 220)
    151. ** x1 = creature type (-1 = any)
    152. ** x2 = Dummy (not used)
    153. ** x3 = fixed hitpoint growth rate
    154. ** x4 = additional experience
    155. ** x5 = xpos
    156. ** x6 = ypos
    157. ** x7 = level
    158. ** x16 = slot number
    159. ** v13 = function multiplexer (do not change inside function)
    160. ** returns:
    161. ** v1 = Number of (matching) creatures
    162. ** v2 = Sum of experience per creature (of matching creatures)
    163. ** v3 = Number of slots with matching creatures
    164. ** v4 = First empty slot
    165. ** v5 = First matching slot
    166. !?FU817|v13=53/v13=220;                Mine
    167. !!VRv1&x16=0:S0;                       Init number of creatures
    168. !!VRv2&x16=0:S0;                       Init Experience
    169. !!VRv3&x16=0:S0;                       Init number of stacks
    170. !!VRv4&x16=0:S-1;                      Init first free slot
    171. !!VRv5&x16=0:S-1;                      Init first matching slot
    172. ** DEBUG
    173. !!OBx5/x6/x7:T?y1;                     Type (maybe visiting hero)
    174. **IF&y1<>53/y1<>220:M^Error: No mine type %V13 found at location %X5,%X6,%X7^;
    175. **IF&y1<>53/y1<>220:M^found: type %Y1^;
    176. **FU&y1<>53/y1<>220:E;                 Exit if not mine
    177. **
    178. !!VRy7:S0;
    179. !!MNx5/x6/x7&y1=34:Mx16/?y5/?y6;       y5=type, y6=number, y7=exp (vis. hero)
    180. !!EXx5/x6/x7/x16/3&y1=53:A?y5/?y6/?y7; without visiting hero
    181. !!EXx5/x6/x7/x16/3&y1=220:A?y5/?y6/?y7;without visiting hero
    182. !!FU&y5>=160/y5<=163:E;                No emissary growth
    183. ** DEBUG
    184. **IF&y6>0:M^DEBUG: Mine, type %Y1, slot%X16, %Y6 Creatures^;
    185. ** END DEBUG
    186. !!VRv4&y6=0/v4=-1:Sx1;                 Found first empty slot
    187. !!FU&y6=0:E;                           Empty slot: Done
    188. !!VRy1&x1<>-1:S-1;
    189. !!MA&x1<>-1:Ux1/?y2;                   y2 = possible upgraded version
    190. !!VRv1|x1=-1/x1=y5/x1=y2:+y6;          Add number of creatures
    191. !!VRv2|x1=-1/x1=y5/x1=y2:+y7;          Add experience per creature
    192. !!VRv3|x1=-1/x1=y5/x1=y2:+1;           Increment number of stacks
    193. !!FU&x3=0/x4=0:E;                      Done
    194. !!FU&x1>=0/x1<>y5/x1<>y2:E;
    195. !!FU&y6>2000:E;                        No growth beyond 2000
    196. **FU&y5=139/y6>1000:E;                 EXPERIMENTAL: no growth for peasants > 1000
    197. !!MA:Py5/?y8;                          y8 = Hitpoints per creature
    198. !!VRy9:S0;                             Init
    199. !!VRy9&y8>0/x3>=y8:Sx3:y8;             y9 = Number of creatures to add
    200. !!MNx5/x6/x7&x3<>0:Mx16/d/dy9;         Add creatures
    201. !!FU&x4<>0:E;                          Done
    202. !!FU&y1<>53/y1<>220:E;                 Exit if not mine
    203. !!UN:P900/?y11;                        Stack experience enabled?
    204. !!FU&y11=0:E;                          Exit if not
    205. !!EXx5/x6/x7/x16/2&x4<>0:Ad/d/dx4;     Add experience
    206. !!FU:E;                                Done

    207. ****************************************************************************
    208. ** Aux. function to iterate through slots
    209. ** Garrison version (types 33 and 219)
    210. ** x1 = creature type (-1 = any)
    211. ** x2 = Dummy (not used)
    212. ** x3 = fixed hitpoint growth rate
    213. ** x4 = Dummy
    214. ** x5 = xpos
    215. ** x6 = ypos
    216. ** x7 = level
    217. ** x16 = slot number
    218. ** v13 = function multiplexer (do not change inside function)
    219. ** v998, v999, v1000 = position
    220. ** returns:
    221. ** v1 = Number of (matching) creatures
    222. ** v2 = Sum of experience per creature (of matching creatures)
    223. ** v3 = Number of slots with matching creatures
    224. ** v4 = First empty slot
    225. ** v5 = First matching slot
    226. !?FU817|v13=33/v13=219;                Garrison
    227. !!VRv1&x16=0:S0;                       Init number of creatures
    228. !!VRv2&x16=0:S0;                       Init Experience
    229. !!VRv3&x16=0:S0;                       Init number of stacks
    230. !!VRv4&x16=0:S-1;                      Init first free slot
    231. !!VRv5&x16=0:S-1;                      Init first matching slot
    232. ** DEBUG
    233. !!OBx5/x6/x7:T?y1;                     Type (maybe visiting hero)
    234. **IF|y1<>33/y1<>219:M^Error: No garrison found at location %X5,%X6,%X7^;
    235. !!FU&y1<>33/y1<>219:E;                 Exit if not garrison
    236. **
    237. !!GRx5/x6/x7:Gx16/?y5/?y6;             y5 = type, y6 = number
    238. !!VRv4&y6=0/v4=-1:Sx1;                 Found first empty slot
    239. !!FU&y6=0:E;                           Empty slot: Done
    240. !!FU&y5>=160/y5<=163:E;                No emissary growth
    241. !!FU&y6>2000:E;                        No growth beyond 2000
    242. **FU&y5=139/y6>1000:E;                 EXPERIMENTAL: no growth for peasants > 1000
    243. !!VRy1&x1<>-1:S-1;
    244. !!MA&x1<>-1:Ux1/?y1;                   y1 = possible upgraded version
    245. !!VRv1|x1=-1/x1=y5/x1=y1:+y6;          Add number of creatures
    246. !!VRv3|x1=-1/x1=y5/x1=y1:+1;           Increment number of stacks
    247. !!FU&x3=0/x4=0:E;                      Done
    248. !!FU&x1>=0/x1<>y5/x1<>y2:E;
    249. !!MA:Py5/?y8;                          y8 = Hitpoints per creature
    250. **IF:M^DEBUG: Found creature with %Y8HP per creature in slot %X16 of garrison^;
    251. !!VRy9:S0;                             Init
    252. !!VRy9&y8>0/x3>y8:Sx3:y8;              y9 = Number of creatures to add
    253. !!GRx5/x6/x7&x3<>0:Gx16/d/dy9;         Add creatures
    254. !!FU:E;                                Done


    255. ****************************************************************************
    256. !?TM2&$once$=1/$day$>1;
    257. **IF:M^DEBUG: Peasant script^;
    258. !!UN:P286/?y-2;                        Check H4 peasant script
    259. !!FU&y-2=1:E;                          Exit if H4 peasant script enabled
    260. !!UN:P334/?y-3;                        Check option for this script
    261. !!FU&y-3=0:E;                          Exit if not enabled
    262. !!EA139:L?y-1;                         y-1 = experience scaling and limit
    263. !!UN:U98/-1/?y-10;                     y-10 = number of towns
    264. !!DO614/1/y-10/1:P98/$color$;          Do for all towns
    265. !!UN:U53/-1/?y-10;
    266. !!DO615/1/y-10/1&y-10>0:P53/$color$;   Do for all mines
    267. !!UN:U220/-1/?y-10;
    268. !!DO615/1/y-10/1&y-10>0:P220/$color$;  Do for all mines
    269. !!FU:E;

    270. !?TM2&$once$=1/$day$>1/$weekday$=$monday$;
    271. !!UN:P286/?y-2;                        Check H4 peasant script
    272. !!FU&y-2=1:E;                          Exit if H4 peasant script enabled
    273. !!UN:P334/?y-3;                        Check option for this script
    274. !!FU&y-3=0:E;                          Exit if not enabled
    275. !!EA139:L?y-1;                         y-1 = experience scaling and limit
    276. !!UN:U33/-1/?y-10;
    277. !!DO616/1/y-10/1&y-10>0:P33/$color$;   Do for all garrisons
    278. !!UN:U219/-1/?y-10;
    279. !!DO616/1/y-10/1&y-10>0:P219/$color$;  Do for all garrisons
    280. !!UN:U54/139/?y-10;
    281. !!DO618/1/y-10/1&y-10>0:P54/139/-1;    Do for all free peasant stacks
    282. !!FU:E;

    283. !?TM2&$day$>1/$weekday$=$monday$;
    284. !!UN:P286/?y-2;                        Check H4 peasant script
    285. !!FU&y-2=1:E;                          Exit if H4 peasant script enabled
    286. !!UN:P334/?y-3;                        Check option for this script
    287. !!FU&y-3=0:E;                          Exit if not enabled
    288. !!EA139:L?y-1;                         y-1 = experience scaling and limit
    289. !!UN:P286/?y-2;                        Check H4 peasant script
    290. !!FU&y-2=1:E;                          Exit if H4 peasant script enabled
    291. **UN:P334/?y-3;                        Check option for this script
    292. **FU&y-3=0:E;                          Exit if not enabled
    293. ** Get active (on adventure map) hero list of player.
    294. ** Variables reused from script127
    295. !!OW:O$color$/?v600/?v601/?v602/?v603/?v604/?v605/?v606/?v607/?v608;
    296. !!VRy-10:S601+v600;
    297. !!DO617/601/y-10/1&v600>0:P34/$color$; Do for players heroes
    298. !!FU:E;

    299. !?TM2&$day$=1;
    300. !!UN:P286/?y-2;                        Check H4 peasant script
    301. !!FU&y-2=1:E;                          Exit if enabled
    302. !!UN:P334/?y-3;                        Check option for this script
    303. !!FU&y-3=0:E;                          Exit if not enabled
    304. !!UN:P185/?y-4;                        Messages disabled?
    305. ** Set peasant speciality text:
    306. !!VRz78&y-2=0/y-3=1/y-4=0:S^Produces resources in towns and mines.^;
    307. !!UN&y-2=0/y-3=1/y-4=0:G1/139/2/78;
    308. !!IF&y-2=0/y-3=1/y-4=0:M^Peasants in this land may produce gold and resources:
    309. In villages, they produce 1 gold per peasant.
    310. In towns, they produce 1.1 gold per peasant.
    311. In cities, they produce 1.2 gold per peasant.
    312. In the capitol, they produce 1.4 gold per peasant.
    313. Peasants with higher ranks do produce more: 10%% per rank.
    314. A market place increases the production by 10%%.
    315. The grail increases the production by 100%%.
    316. The resource silo enables enough peasants to produce that resource, too.
    317. Heroes in town garrison may increase production further.
    318. Heroes with resource speciality enable enough peasants to produce that resource too, if the resource silo is built.^;
    319. !!IF&y-2=0/y-3=1/y-4=0:M^Peasants in mines may increase mine resource production:
    320. Sawmill production is increased by 1 wood per 500 peasants.
    321. Alchemist lab production is increased by 1 mercury per 1000 peasants.
    322. Ore pit production is increased by 1 ore per 500 peasants.
    323. Sulfur mine production is increased by 1 sulfur per 1000 peasants.
    324. Crystal mine production is increased by 1 crystal per 1000 peasants.
    325. Gem pond production is increased by 1 gem per 1000 peasants.^;
    326. !!MA:G139/?y-5;                        y-5 = Peasant growth rate
    327. !!UN:P284/?y-6;                        Growth in town dwelling option
    328. !!UN:P285/?y-7;                        Growth in hero army and garrison
    329. !!UN:P116/?y-8;                        General army growth
    330. !!VRy-9:Sy-6+y-7+y-8;
    331. !!MA&y-2=0/y-3=1/y-9>1:G139/dy1;       Double peasant growth then
    332. !!FU:E;



    333. ****************************************************************************
    334. ** Towns
    335. ** x1 = object type
    336. **      98  = town
    337. ** x2 = color (player) number
    338. ** x16 = object number
    339. ** depends on y-1 = experience scaling and limit (!!EA139:L?y-1;)
    340. ** y1 = owner
    341. ** y2 = number of peasants
    342. ** y10 = hero ID
    343. !?FU614;                               Peasants in town
    344. !!FU&x1<1:E;                           Error exit
    345. !!UN:Ux1/-1/x16/998;                   Get object coordinates to x=v998, y=v999, l=v1000
    346. !!VRy90:Sv998;                         xpos
    347. !!VRy91:Sv999;                         ypos
    348. !!VRy92:Sv1000;                        level
    349. ** DEBUG: Remove these two:
    350. **OBv998/v999/v1000:T?y1;              Type (maybe visiting hero)
    351. **FU&y1<>98:E;                         Exit if not town
    352. !!VRy9:S1;                             Slot type (y9): Assume hero
    353. !!VRy1:S-1;                            Init owner: y1 (no owner)
    354. !!CA998:O?y1;                          Owner (y1)
    355. !!FU&y1<0:E;                           Exit if no owner
    356. !!CA998:H0/?y10;                       Garrison hero (y10)
    357. !!VRy2:S0;                             Init number of peasants (y2)
    358. !!VRy3:S0;                             Init peasant experience (y3)
    359. !!VRy4:S0;                             Init number of peasant stacks (y4)
    360. ** NEW
    361. !!VRv13:S98;                           Function multiplexer: Town
    362. !!VRv13&y10>=0:S34;                    Function multiplexer: Hero
    363. !!DO817/0/6/1:P139/y10/0/0/y90/y91/y92;
    364. !!VRy2:Sv1;                            y2 = Number of peasants
    365. !!VRy3:Sv2;                            y3 = Experience sum
    366. !!VRy3&v3>0: :v3;                      y3 = Average experience
    367. ** END NEW
    368. !!UN:Ux1/-1/x16/998;                   Restore object coordinates to x=v998, y=v999, l=v1000

    369. !!VRy3: *10;
    370. !!VRy3: :y-1;                          Rank = (current/max)*10
    371. ** Gold
    372. ** y2 = number of peasants
    373. ** y3 = average rank
    374. ** y4 = percentage extra gold
    375. ** y8 = resource type (6 = gold)
    376. ** Rem: Town hall replaces village hall, city hall replaces town hall,
    377. ** capitol replaces city hall.
    378. !!VRy8:S6;                             Resource type = Gold
    379. !!VRy4:Sy3;                            Rank gives an extra gold of 0...10%
    380. !!CA998:B3/11;                         Town hall?
    381. !!VRy4&1:+10;                          -> extra 10% gold
    382. !!CA998:B3/12;                         City hall?
    383. !!VRy4&1:+20;                          -> extra 20% gold
    384. !!CA998:B3/13;                         Capitol?
    385. !!VRy4&1:+40;                          -> extra 40% gold
    386. !!CA998:B3/14;                         Market place?
    387. !!VRy4&1:+10;                          -> extra 10% gold
    388. !!CA998:B3/26;                         Grail?
    389. !!VRy4&1:+100;                         -> extra 100% gold
    390. ** If garrisoned hero:
    391. !!VRy13:S0;                            Init estates level (y13)
    392. !!HEy10&y10>=0:S13/?y13;               Estates level -> y13
    393. !!HEy10&y10>=0:X?y14/?y15/d/d/d/d/d;   Speciality (type -> y14, subtype -> y15)
    394. !!VRy13&y14=2/y15=6:*2;                Double for gold specialist
    395. !!VRy13&y14=0/y15=13:*2;               Double for estates specialist
    396. !!VRy13&y13>0:*10;                     Estates -> 0 - 60% extra gold
    397. !!VRy4&y14=2/y15=6:+y13;               Add to extra gold
    398. ** IDEA: Include hero level?
    399. !!HEy10&y10>=0:Ed/?y16;                y16 = hero level
    400. !!VRy16&y14=2/y15=6:*20;               20% per hero level for gold specialists
    401. !!VRy4&y14=2/y15=6:+y16;               -> extra percentage
    402. ** Check artifacts
    403. !!HEy10:A2/115/d/?y15;                 Sack of gold equipped?
    404. !!VRy4&y15>0:+15;                      -> extra 15% gold
    405. !!HEy10:A2/116/d/y15;                  Bag of gold equipped?
    406. !!VRy4&y15>0:+10;                      -> extra 10% gold
    407. !!HEy10:A2/117/d/y15;                  Purse of gold equipped?
    408. !!VRy4&y15>0:+5;                       -> extra 5% gold
    409. !!HEy10:A2/140/d/y15;                  Cornucupia equipped?
    410. !!VRy4&y15>0:50;                       -> extra 50% gold
    411. ** IDEA: Include difficulty level?
    412. ** TODO
    413. **
    414. ** Calculate gold
    415. ** y2 = number of peasants
    416. ** y3 = average rank
    417. ** y4 = extra percentage (may sum up to 210%)
    418. ** y5 = gold result
    419. ** y8 = resource type (6=gold)
    420. !!VRy5:Sy2;                            Gold result = number of peasants
    421. !!VRy6:Sy2*y4:100;                     Extra gold
    422. !!VRy5:+y6;                            Add extra gold
    423. **IF:M^DEBUG: %Y4 extra percentage, %Y5 gold^;
    424. !!OW:Ry1/y8/dy5;                       Add resource (gold)
    425. ** Other resources
    426. ** y2 = number of peasants
    427. ** y3 = average rank
    428. ** y20 = wood (type 0)
    429. ** y21 = mercury (type 1)
    430. ** y22 = ore (type 2)
    431. ** y23 = sulfur (type 3)
    432. ** y24 = crystal (type 4)
    433. ** y25 = gems (type 5)
    434. !!OBv998/v999/v1000:U?y12;             Subtype (town class) -> y12
    435. !!CA998:B3/15;                         Resource silo built? (-> flag 1)
    436. !!VRy20:S0;                            Wood
    437. !!VRy21:S0;                            Mercury
    438. !!VRy22:S0;                            Ore
    439. !!VRy23:S0;                            Sulfur
    440. !!VRy24:S0;                            Crystal
    441. !!VRy25:S0;                            Gems
    442. !!VRy20&1/y12=0:Sy3+1;                 Castle: Wood
    443. !!VRy22&1/y12=0:Sy3+1;                 Castle: Ore
    444. !!VRy24&1/y12=1:Sy3+1;                 Rampart: Crystal
    445. !!VRy25&1/y12=2:Sy3+1;                 Tower: Gems
    446. !!VRy21&1/y12=3:Sy3+1;                 Inferno: Mercury
    447. !!VRy20&1/y12=4:Sy3+1;                 Necro: Wood
    448. !!VRy22&1/y12=4:Sy3+1;                 Necro: Ore
    449. !!VRy23&1/y12=5:Sy3+1;                 Dungeon: Sulfur
    450. !!VRy20&1/y12=6:Sy3+1;                 Stronghold: Wood
    451. !!VRy22&1/y12=6:Sy3+1;                 Stronghold: Ore
    452. !!VRy20&1/y12=7:Sy3+1;                 Forttress: Wood
    453. !!VRy22&1/y12=7:Sy3+1;                 Fortress: Ore
    454. !!VRy21&1/y12=8:Sy3+1;                 Conflux: Mercury
    455. ** y20 - y25 now contain 0 or peasant rank
    456. ** DEBUG
    457. !!CA998:N?z1;                          Name of town
    458. !!HEy10&y10>=0:B0/?z2;                 Name of hero (if any)
    459. !!OW:Gy1/?y19;                         y19 = 1 if player here
    460. **IF&1:N0/y20/1/y21/2/y22/3/y23/4/y24/5/y25;
    461. **IF&1/y19=1:N^DEBUG: %Y2 peasants, resource production^;     (o.k.)
    462. ** Check equipped artifacts
    463. !!VRy15:S0;                            Preset: No artifact
    464. !!HEy10&y10>=0:A2/114/d/y15;           Cart of lumber equipped?
    465. !!VRy20&1/y15>0:+10;                   10% extra wood
    466. !!HEy10&y10>=0:A2/111/d/y15;           Vial of mercury equipped?
    467. !!VRy21&1/y15>0:+10;                   10% extra mercury
    468. !!HEy10&y10>=0:A2/112/d/y15;           Cart of ore equipped?
    469. !!VRy22&1/y15>0:+10;                   10% extra ore
    470. !!HEy10&y10>=0:A2/113/d/y15;           Ring of sulfur equipped?
    471. !!VRy23&1/y15>0:+10;                   10% extra sulfur
    472. !!HEy10&y10>=0:A2/109/d/y15;           Crystal cloak equipped?
    473. !!VRy24&1/y15>0:+10;                   10% extra crystal
    474. !!HEy10&y10>=0:A2/110/d/y15;           Ring of gems equipped?
    475. !!VRy25&1/y15>0:+10;                   10% extra gems
    476. !!HEy10&y10>=0:A2/140/d/y15;           Cornucupia equipped?
    477. !!VRy20&1/y15>0:+10;                   10% extra wood
    478. !!VRy21&1/y15>0:+10;                   10% extra mercury
    479. !!VRy22&1/y15>0:+10;                   10% extra ore
    480. !!VRy23&1/y15>0:+10;                   10% extra sulfur
    481. !!VRy24&1/y15>0:+10;                   10% extra crystal
    482. !!VRy25&1/y15>0:+10;                   10% extra gems
    483. ** DEBUG
    484. **IF&1:N0/y20/1/y21/2/y22/3/y23/4/y24/5/y25;
    485. **IF&1/y19=1:N^DEBUG: %Y2 peasants, resource production^;  (o.k.)
    486. ** Check hero speciality
    487. !!VRy14:S-1;                           Preset speciality type
    488. !!VRy15:S-1;                           Preset speciality subtype
    489. !!HEy10&y10>=0:X?y14/?y15/d/d/d/d/d;   Speciality (type -> y14, subtype -> y15)
    490. !!HEy10&y10>=0:Ed/?y16;                y16 = hero level
    491. !!VRy16&y14=2:*10;                     10% per hero level for res. specialists
    492. !!VRy20&1/y10>=0/y14=2/y15=0:+y16;     Wood specialist
    493. !!VRy21&1/y10>=0/y14=2/y15=1:+y16;     Mercury specialist
    494. !!VRy22&1/y10>=0/y14=2/y15=2:+y16;     Ore specialist
    495. !!VRy23&1/y10>=0/y14=2/y15=3:+y16;     Sulfur specialist
    496. !!VRy24&1/y10>=0/y14=2/y15=4:+y16;     Crystal specialist
    497. !!VRy25&1/y10>=0/y14=2/y15=5:+y16;     Gems specialist
    498. ** DEBUG
    499. **IF&1:N0/y20/1/y21/2/y22/3/y23/4/y24/5/y25;
    500. **IF&1/y19=1:N^DEBUG: %Y2 peasants, resource production^;  (o.k.)
    501. ** y20 - y25 now contain the extra percentage + 1
    502. !!VRy20&1/y20>0:*y2;
    503. !!VRy21&1/y21>0:*y2;
    504. !!VRy22&1/y22>0:*y2;
    505. !!VRy23&1/y23>0:*y2;
    506. !!VRy24&1/y24>0:*y2;
    507. !!VRy25&1/y25>0:*y2;
    508. !!VRy20&1/y20>0: :100;
    509. !!VRy21&1/y21>0: :100;
    510. !!VRy22&1/y22>0: :100;
    511. !!VRy23&1/y23>0: :100;
    512. !!VRy24&1/y24>0: :100;
    513. !!VRy25&1/y25>0: :100;
    514. !!VRy20&1/y20>0:+y2;
    515. !!VRy21&1/y21>0:+y2;
    516. !!VRy22&1/y22>0:+y2;
    517. !!VRy23&1/y23>0:+y2;
    518. !!VRy24&1/y24>0:+y2;
    519. !!VRy25&1/y25>0:+y2;
    520. ** y20 - y25 now contain corrected number of peasants
    521. ** Error prevention. It seems erm does not calculate correct.
    522. ** small numbers divided by large numberd do not result in 0
    523. ** but in 1!
    524. !!VRy20&y20<500:S0;
    525. !!VRy21&y21<1000:S0;
    526. !!VRy22&y22<500:S0;
    527. !!VRy23&y23<1000:S0;
    528. !!VRy24&y24<1000:S0;
    529. !!VRy25&y25<1000:S0;
    530. ** div by granularity
    531. !!VRy20&1/y20>0: :1000;                One unit per 1000 peasants
    532. !!VRy21&1/y21>0: :1000;                One unit per 1000 peasants (DEBUG: 1)
    533. !!VRy22&1/y22>0: :1000;                One unit per 1000 peasants
    534. !!VRy23&1/y23>0: :1000;                One unit per 1000 peasants
    535. !!VRy24&1/y24>0: :1000;                One unit per 1000 peasants
    536. !!VRy25&1/y25>0: :1000;                One unit per 1000 peasants
    537. ** DEBUG
    538. **IF&1:N0/y20/1/y21/2/y22/3/y23/4/y24/5/y25;
    539. **IF&1/y19=1:N^DEBUG: %Y2 peasants, resource production^; ()
    540. !!OW&y20>0:Ry1/0/dy20;                 Add wood
    541. !!OW&y21>0:Ry1/1/dy21;                 Add mercury
    542. !!OW&y22>0:Ry1/2/dy22;                 Add ore
    543. !!OW&y23>0:Ry1/3/dy23;                 Add sulfur
    544. !!OW&y24>0:Ry1/4/dy24;                 Add crystal
    545. !!OW&y25>0:Ry1/5/dy25;                 Add gems
    546. ** Check if to display message (i.e. current player is player here)
    547. !!UN:P185/?y19;                        Messages disabled?
    548. !!FU&y19=1:E;                          Exit if yes
    549. !!OW:Gy1/?y19;                         y19 = 1 if player here
    550. !!FU&y19<>1:E;                         Exit if not
    551. ** Now display produced resources
    552. !!VRy18:S29;                           Type index
    553. !!VRy17:S39;                           Amount index
    554. ** The gold result is in y5
    555. ** Gold
    556. !!VRy18&y5>0:+1;                       Advance index
    557. !!VRy17&y5>0:+1;                       Advance index
    558. !!VRyy18&y5>0:S6;                      First resource: Gold (if any)
    559. !!VRyy17&y5>0:Sy5;                     Gold amount
    560. ** Wood
    561. !!VRy18&y20>0:+1;                      Advance index
    562. !!VRy17&y20>0:+1;                      Advance index
    563. !!VRyy18&y20>0:S0;                     Next resource: Wood (if any)
    564. !!VRyy17&y20>0:Sy20;                   Wood amount
    565. ** Mercury
    566. !!VRy18&y21>0:+1;                      Advance index
    567. !!VRy17&y21>0:+1;                      Advance index
    568. !!VRyy18&y21>0:S1;                     Next resource: Mercury (if any)
    569. !!VRyy17&y21>0:Sy21;
    570. ** Ore
    571. !!VRy18&y22>0:+1;                      Advance index
    572. !!VRy17&y22>0:+1;                      Advance index
    573. !!VRyy18&y22>0:S2;                     Next resource: Ore (if any)
    574. !!VRyy17&y22>0:Sy22;                   Ore amount
    575. ** Sulfur
    576. !!VRy18&y23>0:+1;                      Advance index
    577. !!VRy17&y23>0:+1;                      Advance index
    578. !!VRyy18&y23>0:S3;                     Next resource: Sulfur (if any)
    579. !!VRyy17&y23>0:Sy23;                   Sulfur amount
    580. ** Crystal
    581. !!VRy18&y24>0:+1;                      Advance index
    582. !!VRy17&y24>0:+1;                      Advance index
    583. !!VRyy18&y24>0:S4;                     Next resource: Crystal (if any)
    584. !!VRyy17&y24>0:Sy24;                   Crystal amount
    585. ** Gems
    586. !!VRy18&y25>0:+1;                      Advance index
    587. !!VRy17&y25>0:+1;                      Advance index
    588. !!VRyy18&y25>0:S5;                     Next resource: Gems (if any)
    589. !!VRyy17&y25>0:Sy25;                   Gems amount
    590. !!CA998:N?z1;                          Name of town
    591. !!HEy10&y10>=0:B0/?z2;                 Name of hero (if any)
    592. !!VRz3&y10<0:S^%Y2 peasants in %Z1 produced some resources^;
    593. !!VRz3&y10>=0:S^%Z2s %Y2 peasants in %Z1 produced some resources^;
    594. ** y18 > 29 if any resources (display message), max 36
    595. !!IF&y19=1/y18=30:Q1/y30/y40/1^%Z3^;   If one resource, display single pic msg
    596. !!IF&y19=1/y18=31:Ny30/y40/y31/y41;    More resources...
    597. !!IF&y19=1/y18=32:Ny30/y40/y31/y41/y32/y42;
    598. !!IF&y19=1/y18=33:Ny30/y40/y31/y41/y32/y42/y33/y43;
    599. !!IF&y19=1/y18=34:Ny30/y40/y31/y41/y32/y42/y33/y43/y34/y44;
    600. !!IF&y19=1/y18=35:Ny30/y40/y31/y41/y32/y42/y33/y43/y34/y44/y35/y45;
    601. !!IF&y19=1/y18=36:Ny30/y40/y31/y41/y32/y42/y33/y43/y34/y44/y35/y45/y36/y46;
    602. !!IF&y19=1/y18>30:N^%Z3^;              Display the message
    603. !!FU:E;

    604. ****************************************************************************
    605. ** Mines
    606. ** Mines are type 53 and 220
    607. ** x1 = object type
    608. ** x2 = color (player) number
    609. ** x16 = Mine number
    610. !?FU615;                               Peasants in mine
    611. !!UN:Ux1/-1/x16/998;                   Get object coordinates to x=v998, y=v999, l=v1000
    612. !!MNv998/v999/v1000:O?y1/1;            Owner/no redraw
    613. **FU&y1<0:E;                           Exit if no owner
    614. !!VRy9:S3;                             Slot type (y9): Mine
    615. !!MNv998/v999/v1000:R?y8;              Resource type -> y8
    616. !!FU&y8<0:E;                           Resource error
    617. !!FU&y8>6:E;                           Resource error
    618. !!VRy90:Sv998;
    619. !!VRy91:Sv999;
    620. !!VRy92:Sv1000;
    621. ** Number of peasants and average experience
    622. ** y1 = owner
    623. ** y2 = number of peasants
    624. ** y3 = experience per peasant
    625. !!VRv13:Sx1;
    626. !!DO817/0/6/1:P139/-1/0/0/y90/y91/y92; Count peasants
    627. !!VRy2:Sv1;                            y2 = number of peasants
    628. !!VRy3:Sv2;                            y3 = experience sum
    629. !!VRy4:Sv3;                            y4 = number of stacks
    630. ** DEBUG
    631. **IF&y2>0:M^DEBUG: Mine, position %Y90,%Y91,%Y92, %Y2 Peasants^;
    632. ** END DEBUG
    633. !!FU&y2=0:E;                           Exit if no peasant stacks
    634. !!UN:Ux1/-1/x16/998;                   Get object coordinates to x=v998, y=v999, l=v1000
    635. !!MNv998/v999/v1000:R?y8;              Resource type -> y8
    636. ** Peasant rank (average)
    637. ** y2 = number of peasants
    638. ** y3 = average rank
    639. ** y5 = result amount
    640. ** y11 = rank corrected number of peasants
    641. !!VRy3: :y4;                           y3 = Average experience
    642. !!VRy3: *10;
    643. !!VRy3: :y-1;                          Rank = (current/max)*10
    644. !!VRy11:Sy3*y2:100;
    645. !!VRy11:+y2;                           y11 = rank corrected number of peasants
    646. !!VRy5:S0;
    647. ** y8 = mine resource type
    648. ** y19 = 1 if player here (display message)
    649. !!VRy5&y8=0:Sy11:500;                  500 peasants per resource unit
    650. !!VRy5&y8=1:Sy11:1000;
    651. !!VRy5&y8=2:Sy11:500;                  500 peasants per resource unit
    652. !!VRy5&y8=3:Sy11:1000;
    653. !!VRy5&y8=4:Sy11:1000;
    654. !!VRy5&y8=5:Sy11:1000;
    655. !!VRy5&y8=6:Sy11;
    656. !!OW&y5>0/y1>=0:Ry1/y8/dy5;            Add resource
    657. !!OW:Gy1/?y19;                         y19 = 1 if player here
    658. !!UN:P185/?y18;                        Messages disabled?
    659. !!VRz1&y19=1/y18<>1:S^The peasants in the mine produced some resources^;
    660. !!IF&y19=1/y18<>1/y5>0:Q1/y8/y5/1^%Z1^;Message
    661. !!FU&$weekday$<>$monday$:E;            Weekly part:
    662. ** Apply growth rate:
    663. ** Growth rate is:
    664. ** (number of peasants) * (peasant growth rate) / 100
    665. !!MA:G139/?y20;                        y20 = peasant growth rate
    666. !!VRy20:*y11;
    667. !!VRy20: :100;
    668. !!DO817/0/6/1&y8=0:P22/-1/y20/0/y90/y91/y92; Wood: Dendroid guards
    669. !!DO817/0/6/1&y8=0:P23/-1/y20/0/y90/y91/y92; Wood: Dendroid soldiers
    670. **DO817/0/6/1&y8=1:P??/-1/y20/0/y90/y91/y92; Mercury: ??? (TODO)
    671. !!DO817/0/6/1&y8=2:P33/-1/y20/0/y90/y91/y92; Ore: Iron Golems
    672. !!DO817/0/6/1&y8=3:P135/-1/y20/0/y90/y91/y92;Sulfur: Rust dragon
    673. !!DO817/0/6/1&y8=4:P133/-1/y20/0/y90/y91/y92;Crystal: Crystal dragon
    674. !!DO817/0/6/1&y8=5:P117/-1/y20/0/y90/y91/y92;Gem: Diamond golem
    675. !!DO817/0/6/1&y8=5:P151/-1/y20/0/y90/y91/y92;Gem: Diamond dragon
    676. !!FU:E;                                Done

    677. ****************************************************************************
    678. ** Garrisons
    679. ** Applies a growth rate to any stack in the garrison.
    680. ** Hitpoints to add = (number of peasants) * (peasant growth rate) / 100
    681. ** So for a standard peasant growth rate of 25, this means, you need
    682. ** 4 peasants to produce 1 hitpoint. The growth rate is applied to
    683. ** peasant stacks, too.
    684. ** x1 = object type
    685. ** x2 = color (player) number
    686. ** x16 = Garrison number
    687. !?FU616;                               Peasants in garrison
    688. **IF:M^DEBUG: Garrison No.%X16^;
    689. !!FU&$weekday$<>$monday$:E;            Only weekly
    690. **IF:M^DEBUG: Garrison No.%X16, weekly^;
    691. !!UN:Ux1/-1/x16/998;                   Get object coordinates to x=v998, y=v999, l=v1000
    692. !!VRy90:Sv998;
    693. !!VRy91:Sv999;
    694. !!VRy92:Sv1000;
    695. !!VRy93:S-1;
    696. **HEy90/y91/y92:N?y93;                 Hero ID if there is a hero at this position
    697. !!VRv13:Sx1;
    698. !!DO817/0/6/1:P139/y93/0/0/y90/y91/y92;
    699. !!FU&v1=0:E;                           Exit if no peasants
    700. **IF:M^DEBUG: Garrison with %V1 peasants^;
    701. ** Apply growth rate (hitpoints to add):
    702. ** (number of peasants) * (peasant growth rate) / 200
    703. !!MA:G139/?y2;                         y2 = peasant growth rate
    704. !!VRy2:*v1;
    705. !!VRy2: :200;
    706. !!VRv13:Sx1;                           Function multiplexer: Garrison
    707. !!VRv13&y93>=0/y98<0155:S34;           Hero if found at that position
    708. !!DO817/0/6/1:P-1/-1/y2/0/y90/y91/y92; Apply growth rate
    709. !!FU:E;

    710. ****************************************************************************
    711. ** Heroes
    712. ** x1 = object type (34)
    713. ** x2 = color (player) number
    714. ** x16 = Index to hero number (601 - 608)
    715. !?FU617;                               Peasants in hero army on adv. map
    716. !!FU&$weekday$<>$monday$:E;            Only weekly
    717. !!VRy1:Svx16;                          Get ID
    718. !!FU&y1<0:E;                           Exit if unavailable
    719. !!HEy1:O?y2;                           Heroes owner
    720. !!FU&y2<0:E;                           No owner (error): Exit
    721. !!VRv13:Sx1;
    722. !!DO817/0/6/1:P139/y1/0/0;
    723. !!FU&v1=0:E;                           Exit if no peasants;
    724. !!VRy2:Sv1;                            y2 = Number of peasants
    725. !!VRy3:Sv2:v3;                         Average Exp.
    726. !!VRy3: *10;
    727. ** Growth rate in hitpoints is:
    728. ** (1+Rank) * (Hero level) * (Movement points) * (num peasants) / 10000
    729. !!VRy3: :y-1;                          y3 = Rank = (current/max)*10
    730. !!HEy1:Ed/?y16;                        y16 = hero level
    731. !!VRy16:+1;                            Hero level + 1
    732. !!HEy1:W?y4/1;                         y4 = movement points
    733. !!VRy5:S0;
    734. !!VRy5&y4>0:Sy3*y16*y4*y2:10000;
    735. !!DO817/0/6/1&y5>0/y5<10000:P-1/y1/y5/0;
    736. ** TODO
    737. !!FU:E;

    738. ****************************************************************************
    739. ** Free peasant stacks
    740. ** x1 = object type (54)
    741. ** x2 = subtype (139)
    742. ** x3 = agression modifier(-1 or +1)
    743. ** x16 = Object number
    744. !?FU618;
    745. !!FU&$weekday$<>$monday$:E;            Only weekly
    746. !!FU|x3<-1/x3>1:E;                     Parameter error
    747. !!FU&x3=0:E;                           Nothing to do
    748. !!UN:Ux1/x2/x16/998;                   Get stack coordinates to x=v998, y=v999, l=v1000
    749. !!MO998:R?y1/1;                        y1 = current stack agression lvl
    750. !!MO998&y1>0/x3<0:Rdx3/1;              Decrease aggression
    751. !!MO998&y1<10/x3>0:Rdx3/1;             Increase aggression
    752. !!FU:E;

    753. ****************************************************************************
    754. ** Object triggers
    755. ****************************************************************************

    756. ** Dwelling (copied from script096)
    757. !?OB17; // visit creature generator
    758. !!UN:P286/?y-2;                        Check H4 peasant script
    759. !!FU&y-2=1:E;                          Exit if H4 peasant script enabled
    760. !!UN:P334/?y-3;                        Check option for this script
    761. !!FU&y-3=0:E;                          Exit if not enabled
    762. !!HE-1:N?y-8; // get hero's number
    763. !!DWv998/v999/v1000:M0/?y-4/d; // get creature in slot 1
    764. !!DWv998/v999/v1000:M1/?y-5/d; // get creature in slot 2
    765. !!DWv998/v999/v1000:M2/?y-6/d; // get creature in slot 3
    766. !!DWv998/v999/v1000:M3/?y-7/d; // get creature in slot 4
    767. ** TODO
    768. !!FU:E;


    769. ****************************************************************************
    770. ** Arena
    771. !?OB4;

    772. ****************************************************************************
    773. ** Library
    774. !?OB41;

    775. ****************************************************************************
    776. ** School of magic
    777. !?OB7;

    778. ****************************************************************************
    779. ** Mercenary camp
    780. !?OB51;

    781. ****************************************************************************
    782. ** School of war
    783. !?OB107;

    784. ****************************************************************************
    785. ** Marletto tower
    786. !?OB23;
    复制代码

    该用户从未签到

    218

    回帖

    6066

    金币

    0

    精华

    2级 Adventuring Hero

    Rank: 2

    积分
    342
    发表于 2007-2-12 21:58:27 | 显示全部楼层
    too long
    lazy to read...
    Network is the point
    Connecting EACH oTHER for FUN will bring [wiki]WoG[/wiki] a bright Future
    头像被屏蔽

    该用户从未签到

    25

    回帖

    2254

    金币

    0

    精华

    禁止发言

    积分
    115
    发表于 2007-3-8 22:47:39 | 显示全部楼层
    提示: 作者被禁止或删除 内容自动屏蔽

    该用户从未签到

    76

    回帖

    8072

    金币

    0

    精华

    1级 Hired Hero

    Rank: 1

    积分
    152
    QQ
    发表于 2008-4-21 20:43:36 | 显示全部楼层
    I think that's great!
  • TA的每日心情
    开心
    2020-9-19 16:27
  • 签到天数: 7 天

    连续签到: 1 天

    [LV.3]火元素使者

    9896

    回帖

    64万

    金币

    19

    精华

    管理员

    风侠

    Rank: 12Rank: 12Rank: 12

    积分
    52027

    论坛元老魅力之星封魔玩家

    发表于 2009-5-11 22:03:38 | 显示全部楼层
    Wonderful

    该用户从未签到

    906

    回帖

    9696

    金币

    2

    精华

    5级 Honorable Hero

    Rank: 5Rank: 5

    积分
    4086

    退役版主

    发表于 2009-9-15 19:47:21 | 显示全部楼层
    who can test the 359 script when 359 is not released?

    please release 359 for us to test.
    ahome_bigavatar:guest
    ahome_bigavatar:welcomelogin
    您需要登录后才可以回帖 登录 | 英雄注册|Register

    本版积分规则

    捐赠
    关注我们,英3Mod一网打尽!

    WoG中文站 ( 辽B2-20210485-10 )|辽公网安备 21128202000228 号

    GMT+8, 2024-4-26 04:14 , Processed in 0.694949 second(s), 15 queries , Gzip On, File On.

    Powered by Discuz! X3.4

    Copyright © 2004-2022, Beijing Second Sight Technology Co., LTD.

    快速回复 返回顶部 返回列表