q451143538 发表于 2010-9-30 04:59:21

求大家帮我解释一下这个erm

ZVSE
_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
ERMS_ScriptDate=13.4(April).2009
** script to prevent creature experience reduction due to overflow. JHV,2/3/2009
** uses v7090-v7103 to store troop ranks @ start of battle
** uses FU459-FU462
**"The bug you describe probably occurs when the experience exceeds the maximum
**positive value that its (internal) variable can store.
**For example, one byte (8 bits) can store a number from
**0 to 255 (11111111 in binary), but it is convenient to the value stored as
**from -128 to +127, by performing the "two's complement" (change all 0's to 1's
**and 1's to 0's, then add 1) to convert a positive number to a negative number,
**because any binary number and its two's-complement sum to zero (with a carry
**that overflows out of the byte).This makes integer subtraction easy (just add
**the two's complement of the number to be subtracted), but it means that, for
**example, if you are using 1-byte storage, adding 2 to
**127 (00000010 to 01111111 in binary) produces -127 instead of 129."
**In readable words :P this bug will certainly occur when the experience received
**after a very big battle can't be handled by the game. Usually if you continue
**to play a map after the 12th month and the neutral creatures have an
**overgrowth. Your experience will go into the negative, all abilities will be
**lost and you will need certainly more than hundred battles to restore it.
**The script restore it automatically if lost.
!?BA0&1000; start of (human) battle
!!BA:H0/?v1; get attacker hero #
!!BA:H1/?v2; get defender hero # (if any)
!!DO459/0/6/1&v1>-1/v1<156:Pv1; check stacks 0-6 for attacker
!!DO460/0/6/1&v2>-1/v2<156:Pv2; check stacks 0-6 for defender

!?FU459; get exp. rank of troop in slot x16 of hero x1, store in v
!!HEx1:C0/x16/?y1/?y2/?y3/2; y1=type, y2=no., y3=experience
!!VRv5:S7090+x16;
!!VRvv5:Sy3;
!?FU460; get exp. rank of troop in slot x16 of hero x1, store in v
!!HEx1:C0/x16/?y1/?y2/?y3/2; y1=type, y2=no., y3=experience
!!VRv5:S7097+x16;
!!VRvv5:Sy3;
!?BA1&1000; end of (human) battle
!!BA:H0/?v1; get attacker hero #
!!BA:H1/?v2; get defender hero # (if any)
!!VRv3:C-1/-1; set v3 & v4 to -1
!!HEv1&v1>-1/v1<156:O?v3; get attacker's Owner - will be 0-7 if attacker won
!!HEv2&v2>-1/v2<156:O?v4; get defender's Owner - will be 0-7 if defender won
!!DO461/0/6/1&v3>-1/v3<8:Pv1; check stacks 0-6 for attacker
!!DO462/0/6/1&v4>-1/v4<8:Pv2; check stacks 0-6 for defender
!?FU461; get exp. rank of troop in slot x16 of hero x1, vs. v
!!HEx1:C0/x16/?y1/?y2/?y3/2; y1=type, y2=no., y3=experience
!!FU&y2<1:E; quit if no troops left in slot
!!VRv5:S7090+x16;
!!VRy4:Svv5;
!!HEx1&y4>y3:C0/x16/d/d/11/12; set rank to 11 if negative experience was
gained (overflow occurred)
!?FU462; get exp. rank of troop in slot x16 of hero x1, vs. v
!!HEx1:C0/x16/?y1/?y2/?y3/2; y1=type, y2=no., y3=experience
!!FU&y2<1:E; quit if no troops left in slot
!!VRv5:S7097+x16;
!!VRy4:Svv5;
!!HEx1&y4>y3:C0/x16/d/d/11/12; set rank to 11 if negative experience was
gained (overflow occurred)
!!IF&610:V616/1;

cyhken 发表于 2010-9-30 08:44:43

等高人出現...

songfx 发表于 2010-9-30 12:21:58

看起来像是修复经验溢出的脚本

无心云 发表于 2010-9-30 19:49:37

现在高人中好像也就风侠出现的频率高点了

加油啊,大仙们,出现吧

air 发表于 2010-10-1 12:38:48

LZ我来解释一下.看行不?
!?BA0&1000; 战斗开始前并双方有一方不是电脑就促发一下事件.
!!BA:H0/?v1; 得到攻方雄号码V1
!!BA:H1/?v2; 得到防方雄号码V2
!!DO459/0/6/1&v1>-1/v1<156:Pv1; 当V1>-1且V1<156就引发!?FU459并让他运行6次.并让!?FU459后的X1=V1
!!DO460/0/6/1&v2>-1/v2<156:Pv2; 当V2>-1且V2<156就引发!?FU460并让他运行6次.并让!?FU460后的X1=V2


!?FU459;
!!HEx1:C0/x16/?y1/?y2/?y3/2; 改变X1号因雄1-6格的怪物.
!!VRv5:S7090+x16;让V5=7090+X16(X16=1-6)
!!VRvv5:Sy3;让W5=Y3
!?FU460;
!!HEx1:C0/x16/?y1/?y2/?y3/2;改变X1号因雄1-6格的怪物.
!!VRv5:S7097+x16;让V5=7090+X16(X16=1-6)
!!VRvv5:Sy3;让W5=Y3
!?BA1&1000; 战后.并双方有一方是非电脑就开使下面事件
!!BA:H0/?v1; 得到攻方雄号码V1

!!BA:H1/?v2; 得到攻方雄号码V2

!!VRv3:C-1/-1; 让V3=-1 V4=-1
!!HEv1&v1>-1/v1<156:O?v3; 当V1>-1且V1<156.就取V1号英雄的归属.
!!HEv2&v2>-1/v2<156:O?v4; 当V2>-1且V2<156.就取V2号英雄的归属.
!!DO461/0/6/1&v3>-1/v3<8:Pv1; 当V3>-1且V3<8就运行!?FU461 6次并让!?FU461以下的X1=V1
!!DO462/0/6/1&v4>-1/v4<8:Pv2; 当V4>-1且V4<8就运行!?FU462 6次并让!?FU462以下的X1=V2

!?FU461;
!!HEx1:C0/x16/?y1/?y2/?y3/2; 改变X1号因雄1-6格的怪物.(注Y3=改怪的EXP)
!!FU&y2<1:E; 当Y2<1就退出
!!VRv5:S7090+x16;让V5=7090+X16(X16=1_6)
!!VRy4:Svv5;让Y4+W5
!!HEx1&y4>y3:C0/x16/d/d/11/12; 当Y4>Y3就设置等级11(溢出发生了)。
!?FU462; 下面差不多.
!!HEx1:C0/x16/?y1/?y2/?y3/2;
!!FU&y2<1:E; quit if no troops left in slot
!!VRv5:S7097+x16;
!!VRy4:Svv5;
!!HEx1&y4>y3:C0/x16/d/d/11/12; set rank to 11 if negative experience was
gained (overflow occurred)
!!IF&610:V616/1;如果表制610为真就让616为真.

LZ这是生物EXP益出变负的ERM

[ 本帖最后由 air 于 2010-10-1 12:39 编辑 ]
页: [1]
查看完整版本: 求大家帮我解释一下这个erm

捐赠