- 积分
- 10806
- 威望
- 64
- 魅力
- 63
- 经验
- 7155
- 热心度
- 3
- 注册时间
- 2015-11-15
- 最后登录
- 2024-2-20
- 主题
- 104
- 回帖
- 1839
- 精华
- 8
- 阅读权限
- 120
TA的每日心情 | 开心 2015-12-9 01:09 |
---|
签到天数: 9 天 连续签到: 1 天 [LV.3]火元素使者
版主
- 积分
- 10806
|
本帖最后由 XEricSin 于 2020-2-10 13:02 编辑
这句话是最新加的,这个方法是在进城的一瞬间动态的改变一个城,比如把一部分元素城变成新城,从而实现多城共存。这个方法很老了,有兴趣可以深挖。
本脚本参考了龙城的方法,在不替换原有城镇的基础上添加新的城镇。可是,我发现龙城切换城镇时使用的内存函数老是导致游戏崩溃,因此,我避开了内存函数,转而通过城镇的列表编号来确定进的是哪座城。此脚本稍加修改就可以支持多个新城(当然会有些限制)。
本来配合新生物插件可以真正实现新城新生物,可是此插件还不完善。所以这里就以添加原版生物到新城为例子了。
第一部分
**游戏开始时替换城镇为新城
**在每座新城的名字中增加两个字母来标记是新城
!#VRz709:S^ZL^;
!#IF:V413/1; flag on TM1 to setup ZL
!#IF:V414/0; flag on TM1 to hire specific new hero
!#VRv5250:S0; new male heros in map, bit mask
!#VRv5251:S0; new female heros in map, bit mask
!#TM1:S1/164/1/255; triggers every color every day [same as Tobyn's Universal Timer--no conflict]
!?PI;
!!VRz2:Sz310036; //initial prompt
!!IF:M1/z2;
!!UN:P169/0; disable renaming town
!!UN:U98/-1/?y1;
!!VRv1:C-1/-1/-1; //for relative obj searching method
!!DO6152/1/y1/1&y1>0:P;
**转换起始城和部分野城为逐鹿城*
*function to convert towns to ZL towns
!?FU6152;
!!VRy-1:S12; y-1=chace of convert (0-100)
!!UN:U98/-1/-1/1; put coordinates of next type x1/x2 object --> (v1,2,3)
!!CA1:O?y2; get Owner of town
!!if&y2=-1:; no owner
!!VRy10:S0 R100;
!!FU&y10>y-1:E;
!!el:;
!!OW:Iy2/?y3; ai?
!!FU&y3=1:E; //if town owner is ai then end
!!en:;
*!CA1:T1; //chnge type to Rampart
!!CA1:B3/7; //fort built? in flag 1
!!CA1&1:I1; //castle look (the old pcx need to be replaced)
!!CA1&-1:I2; //no-castle look (the old pcx need to be replaced)
!!CA1:N?z3; get town Name
!!VRz2:S^%Z709 %Z3^; //add ZL to before town name
!!CA1:Nz2; set town Name
********************************************************************************
第二部分**每次进城时,更改城镇相应巢穴来模拟新城
**进入城镇界面有4个途径
*1:大地图点击城堡 2:大地图右边的城镇列表 3:英雄大地图进城
*4:进入城镇界面后,通过右下角的城镇列表切换城镇 (这个是重点和难点)(其实还有第五种,估计很少人用过,反正我是没用过)
注意难点来了。
前三种进城方式很直接,都有直接的erm检测进的是不是新城(名字是不是包含标记)
但是,第四种进城方式很特殊,没有直接的erm检测切换到哪座城。所以,龙城是用的一个内存函数。可是,我发现这个函数老是导致游戏崩溃,因此,我避开了内存函数,转而通过城镇在列表中的位置
和玩家鼠标点击的位置和次数来跟踪,到底是点的哪座城。上面的v5256-v5259就是为此设计的。
FU6154则是根据进城时的不同情况赋予v5256-v5259的初始值。
**英雄进入壁垒、逐鹿城时,更改建筑和兵种图片**
!?OB98;
!!FU6154:P0; //initialise the index of 3 towns in town screen
!!CA998:N?z3 T?y3; get Town Name/type
!!VRz2:M1/z3/0/2; get substring "ZL" if Town is a ZL
!!FU6150&z2=z709:P0/y3; //change structures
!!FU6151&z2<>z709:P0/y3; //restore structures
!!CA998:O?y1; get town owner
!!OW:C?y2; get hero owner
!!if&y1<>y2:; diff owner
!!FU9555&z2=z709:P1/171; change tower to sword master
!!if&z2<>z709:; change tower to original
!!VRy4:Sy3*14;
!!VRy4|y3=0/y3=3/y3=7:+2;
!!VRy4|y3=1/y3=6:+4;
!!VRy4|y3=2/y3=5:+6;
!!VRy4&y3=4:+8;
!!VRy4&y3=8:+3;
!!FU9555:Py3/y4;
!!en:;
!!el:; same owner
!!FU6157&z2=z709:P; prompt to change hero提示更换英雄
!!en:;
**左键点击主界面城镇列表并进城时,更改建筑和生物图片**
*LMB on Town List slot in Adventure Screen, change dwellings
!?CM5;
!!CM:I?y1 S?y9;
!!FU&y9<>12:E; not left push
!!FU|y1<32/y1>36:E; not town slot
!!VRy2:Sy1-32; convert to slot # 0-4
!!OW:N-1/y2/?y3; y3=town #
!!CA0/y3:N?z3 T?y4; get Town name/type
!!OW:N-1/?y10;
!!FU&y10=-1:E;
!!CA0/y10:N?z10; //name of active town
!!FU&z10<>z3:E; //target town is not active
!!FU6154:P1; //initialise the index of 3 towns in town screen
!!VRz2:M1/z3/0/2; get substring "ZL" if Town is a ZL
!!FU6150&z2=z709:P0/y4;
!!FU6151&z2<>z709:P0/y4;
********************************************************************************
**左键点击地图上城镇并进城时,更改建筑和生物图片*
*LMB on Town in Big Adventure Map, change dwellings
!?CM5;
!!CM:I?y1 S?y9;
!!FU&y9<>12:E; not left push
!!FU&y1<>37:E; not big adv map
!!CM:P?v2/?v3/?v4;
!!OB2:T?y2;
!!FU&y2<>98:E; not town
!!CA2:N?z3 T?y3; //get target town name and type
*!FU&y3<>1:E; not rampart town
!!OW:N-1/?y10; //current active town
!!FU&y10=-1:E;
!!CA0/y10:N?z10; //name of active town
!!FU&z10<>z3:E; //target town is not active
!!FU6154:P1; //initialise the index of 3 towns in town screen
!!VRz2:M1/z3/0/2; get substring "ZL" if Town is a ZL
!!FU6150&z2=z709:P0/y3;
!!FU6151&z2<>z709:P0/y3;
********************************************************************************
**左键点击城镇界面中的城镇列表并进城时,更改建筑和生物图片*
* LMB push in Town Screen, on Town slot in Town List, change dwellings
!?CM1;
!!CM:I?y1 S?y2;
!!FU|y1<155/y1>157:E; //only for town slots
!!FU&y2<>12:E; //Left mouse click sub type is 12
!!VRv5256&y1=155:Sv5257; //v5256 records town index of next town screen
!!VRv5256&y1=156:Sv5258;
!!VRv5256&y1=157:Sv5259;
!!OW:W-1/v5256/?y3; //town number for next town screen
!!CA0/y3:T?y4 N?z3; //type and name of town for next town screen
!!VRz2:M1/z3/0/2; get substring "ZL" if Town is a ZL
!!FU6150&z2=z709:P0/y4; //target is ZL then redirect structures
!!FU6151&z2<>z709:P0/y4; //target is not ZL then undo redirect structures
********************************************************************************
**左键点击城镇界面中的城镇列表的上下滑动箭头时,更新当前显示的3个城的城镇列表编号**
!?CM1&415; LMB push in Town Screen, on up and down button for towns scroll
!!CM:I?y1 S?y2;
! !IF:M^%Y1 %Y2^;
!!FU&y2<>13:E; //Left mouse click sub type for scroll button is 13
!!if&y1=152:; //click up
!!FU|v5256=0/v5256=1:E; //no towns above, ignore this click
!!VRv5257:Cd-1/d-1/d-1; //reduce corresponding town index by 1
!!en:;
!!if&y1=153:; //click down
!!OW:W-1/?y3; //number of towns
!!VRy4:Sy3-2;
!!FU&v5256>=y4:E; //no towns below, ignore this click
!!VRv5257:Cd1/d1/d1; //increase corresponding town index by 1
!!en:;
*****************************************************
**设置城镇巢穴为逐鹿城巢穴**change dwellings to ZL
!?FU6150; x1=dummy x2=town type
!!UN:Tx2/0/0/?y1; [level 1 no upg - ?]
!!FU&y1=138:E; simple check whether town is normal
!!UN:Tx2/0/0/138; [level 1 no upg - Huluwa]
!!UN:Tx2/0/1/139; [level 1 upg - Elder Huluwa]
!!UN:Tx2/1/0/140; [level 2 no upg - Green-hill Fox]
!!UN:Tx2/1/1/142; [level 2 upg - Nine-tail Fox]
!!UN:Tx2/2/0/144; [level 3 no upg - Bronzy Monk]
!!UN:Tx2/2/1/194; [level 3 upg - Golden Arhat]
!!UN:Tx2/3/0/170; [level 4 no upg - Sword Servant]
!!UN:Tx2/3/1/171; [level 4 upg - Sword Master]
!!UN:Tx2/4/0/167; [level 5 no upg - Spirit of Waters]
!!UN:Tx2/4/1/166; [level 5 upg - Guardian of Waters]
!!UN:Tx2/5/0/164; [level 6 no upg - Spirit of Mountains]
!!UN:Tx2/5/1/165; [level 6 upg - Guardian of Mountains]
!!UN:Tx2/6/0/168; [level 7 no upg - Great Deer]
!!UN:Tx2/6/1/169; [level 7 upg - Great White Deer]
!!MA:O138/x2 O139/x2 O140/x2 O142/x2 O144/x2 O194/x2;
!!MA:O170/x2 O171/x2 O167/x2 O166/x2 O164/x2 O165/x2;
!!MA:O168/x2 O169/x2 O195/x2 O192/x2;
**图片也是可以改的,可以参考龙城中的相关部分
* REDIRECT BUILDING PICTURES
! !SN:L^Era.dll^/?y1; y1=handle
! !SN:Ay1/^RedirectFile^/?y2; y2=FU address
! !SN:Ey2/1/^TBRMDW_0.def^/^TBRMDW_4.def^;
。。。
! !IF:V412/1; prevent redirected redirects
********************************************************************************
**还原普通城巢穴**restore normal Town Cr's
!?FU6151; x1=dummy x2=town type
!!UN:Tx2/0/0/?y1; [level 1 no upg - ?]
!!FU&y1<>138:E; simple check whether town is ZL
!!if&x2<8:;
!!VRy1:S14 *x2;
!!UN:Tx2/0/0/y1; [level 1 no upg - Hulu Boy]
!!VRy1:+1;
!!UN:Tx2/0/1/y1; [level 1 upg - Elder Hulu Boy]
!!VRy1:+1;
!!UN:Tx2/1/0/y1; [level 2 no upg - Green-hill Fox]
!!VRy1:+1;
!!UN:Tx2/1/1/y1; [level 2 upg - Nine-tail Fox]
!!VRy1:+1;
!!UN:Tx2/2/0/y1; [level 3 no upg - Bronzy Monk]
!!VRy1:+1;
!!UN:Tx2/2/1/y1; [level 3 upg - Golden Lohan]
!!VRy1:+1;
!!UN:Tx2/3/0/y1; [level 4 no upg - Sword Servant]
!!VRy1:+1;
!!UN:Tx2/3/1/y1; [level 4 upg - Sword Master]
!!VRy1:+1;
!!UN:Tx2/4/0/y1; [level 5 no upg - Spirit of Waters]
!!VRy1:+1;
!!UN:Tx2/4/1/y1; [level 5 upg - Guardian of Waters]
!!VRy1:+1;
!!UN:Tx2/5/0/y1; [level 6 no upg - Spirit of Mountains]
!!VRy1:+1;
!!UN:Tx2/5/1/y1; [level 6 upg - Guardian of Mountains]
!!VRy1:+1;
!!UN:Tx2/6/0/y1; [level 7 no upg - Great Deer]
!!VRy1:+1;
!!UN:Tx2/6/1/y1; [level 7 upg - White Deer]
!!el:; element town
!!UN:Tx2/0/0/118; [level 1 no upg - Hulu Boy]
!!UN:Tx2/0/1/119; [level 1 upg - Elder Hulu Boy]
!!UN:Tx2/1/0/112; [level 2 no upg - Green-hill Fox]
!!UN:Tx2/1/1/127; [level 2 upg - Nine-tail Fox]
!!UN:Tx2/2/0/115; [level 3 no upg - Bronzy Monk]
!!UN:Tx2/2/1/123; [level 3 upg - Golden Lohan]
!!UN:Tx2/3/0/114; [level 4 no upg - Sword Servant]
!!UN:Tx2/3/1/129; [level 4 upg - Sword Master]
!!UN:Tx2/4/0/113; [level 5 no upg - Spirit of Waters]
!!UN:Tx2/4/1/125; [level 5 upg - Guardian of Waters]
!!UN:Tx2/5/0/120; [level 6 no upg - Spirit of Mountains]
!!UN:Tx2/5/1/121; [level 6 upg - Guardian of Mountains]
!!UN:Tx2/6/0/130; [level 7 no upg - Great Deer]
!!UN:Tx2/6/1/131; [level 7 upg - White Deer]
!!en:;
**如果建筑图片也参考龙城改了,就要在还原城镇是一并还原
* undo all redirects
! !SN:L^Era.dll^/?y1; y1=handle
! !SN:Ay1/^RedirectFile^/?y2; y2=FU address
! !SN:Ey2/1/^^/^^;
! !IF:V412/0; unflag redirects
********************************************************************************
**进入城镇界面时,记录当前界面的3个城镇列表编号**
**when entering a town screen, a small town list will be at the bottom right corner.
**record the indexes of these towns in player's overall town list as v5257 v5258 v5259.
**v5256 is the index of the town that gives the current town screen
!?FU6154;
!!if&x1=0:; //triggered by hero
!!CA998:U?y1; town number in map
!!en:;
!!if&x1=1:; //triggered by click
!!OW:N-1/?y1; town number in map
!!en:;
!!OW:W-1/?y3; total number of towns owned
!!VRy-3:Sy3-1; max town list index
!!VRy2:S-1; default town not in player's list
!!DO6155/0/y-3/1:Py1/?y2; //search player's town list for town number in map
**y2=index of this town in player's town list
!!VRy2&y2=-1/y3=0:S0; //entering new town when no towns
!!VRy2&y2=-1/y3=1:S1; //entering new town when having 1 town
!!VRy2&y2=-1/y3>1:S-2; //entering new town when 2 or more towns
!!if&y2=0:; entering 1st town or entering new town when no towns
!!VRv5256:S0; curret town index in player's list
!!VRv5257:C0/1/2; index of 3 towns shown in town screen list
!!FU:E;
!!en:;
!!if&y2=1:; entering 2nd town or entering new town when having 1 town
!!VRv5256:S1; curret town index in player's list
!!VRv5257:C0/1/2; index of 3 towns shown in town screen list
!!FU:E;
!!en:;
!!VRy4:Sy3-1; //num of towns -1
!!VRy5:Sy3-2; //num of towns -2
!!VRy6:Sy3-3; //num of towns -3
!!VRy7:Sy2-1; //index of towns -1
!!VRy8:Sy2+1; //index of towns +1
!!if&y2>1/y2<y5:;
!!VRv5256:Sy2; curret town index in player's list
!!VRv5257:Cy7/y2/y8; index of 3 towns shown in town screen list
!!FU:E;
!!en:;
!!if&y2=y5:;
!!VRv5256:Sy5; curret town index in player's list
!!VRv5257:Cy6/y5/y4; index of 3 towns shown in town screen list
!!FU:E;
!!en:;
!!if&y2=y4:;
!!VRv5256:Sy4; curret town index in player's list
!!VRv5257:Cy6/y5/y4; index of 3 towns shown in town screen list
!!FU:E;
!!en:;
!!if&y2=-2:; entering new town when having 2 or more towns
!!VRv5256:Sy3; curret town index in player's list
!!VRv5257:Cy5/y4/y3; index of 3 towns shown in town screen list
!!FU:E;
!!en:;
*****************************************************
**循环检测玩家城镇列表中,目标列表的编号**
!?FU6155; x1 is target town map index x2 collects the list index
!!OW:W-1/x16/?y1;
!!if&y1=x1;
!!VRx2:Sx16;
!!VRx16:S1000000;
!!FU:E;
!!en:;
!!VRx2:S-1;
*****************************************************
第三部分
由于每次建造建筑会自动刷新城镇外观,在我们离开城镇界面时,必须先把城镇外观改成新城的外观。
外观用的是稍有损坏和 完全损坏的城镇def。可以先在pac中替换成新城的def。
**退出城镇界面时,更新所有逐鹿城的外观(以及生物巢穴设置)**
*LMB push in Town Screen, on OK button(checkmark), update all ZL town looks
!?CM1;
!!CM:I?y1 S?y2;
!!FU&y1<>30720:E;
!!FU&y2<>10/y2<>12:E; //Left mouse click sub type is 10, enter/esc is 12 for OK button
!!UN:U98/-1/?y3;
!!VRv1:C-1/-1/-1;
!!DO6153/1/y3/1:P; //loop through all towns to refresh town appearance
!?FU6153;
!!UN:U98/-1/-1/2;
!!CA2:N?z3; get Town Name
!!VRz2:M1/z3/0/2; get substring "ZL" if Town is ZL
!!FU&z2<>z709:E;
*!FU6151:P0/towntype; //restore the default town setting(no need)
!!CA2:B3/7;
!!CA2&1:I1;
!!CA2&-1:I-1;
********************************************************************************
|
评分
-
2
查看全部评分
-
|