ZVSE AUTO_PoweredBy=ERM Scripter v. 2002.12.20.1755 ** Enhanced Commanders ** By Arstahd ** Version: 1.02 *** commander stats are calculated to new formulae ** display will be inaccurate when hero levels up, re-open commander screen to update stat display, ignore skill descriptions ** attack - base 5 + 1/2 x level - skill adds +25%,+50%,+75%,+100%,+125% ** defence - base 5 + 1/2 x level - skill adds +25%,+50%,+75%,+100%,+125% ** hit points - base 30 + 15 x level - skill adds +25%,+50%,+75%,+100%,+125% ** damage - base 10 + 5 x level - skill adds +25%,+50%,+75%,+100%,+125% ** magic power - base 0 + 1 x level - not increased by skill ** speed - base 5 - skill adds normal bonus ** spell quantity and magic resistance function as normal (increased by magic power skill) *** commanders each start with a special ability ** paladin - endless retaliation ** heirophant - summon creature ** temple guardian - shoot ** succubus - fly ** soul eater - fear ** brute - no retaliation ** ogre leader - charge attack ** shaman - poison ** astral spirit - radius attack *** commanders (except soul eater) now cast an additional spell (at adv. level) after they cast a spell ** paladin - bless ** heirophant - cure ** temple guardian - magic mirror ** succubus - bloodlust ** soul eater - none ** brute - mirth ** ogre leader - haste ** shaman - shield ** astral spirit - air shield *** commanders (except soul eater or astral spirit) are now living and can be resurrected (soul eater can still be raised with animate dead) *** commanders are town based if bought, type depends on town not hero when you buy a new commander (dismiss old commander to buy a new one) *** death stare ability replaced with 50% chance to cast poison - attack or shoot *** astral spirit "banish" ability now returns creatures after battle ** Variables used: v7080-v7087 v7185, y1-y9 ** Functions used: 7070-7073 ** Timers used: none ** initialization !#UN:P185/?v7185; [check if Enhanced Commanders is enabled in WoGify Options] !#UN:P3/?y9; [check if commanders are enabled] !#VRv7185:S1; [enable for stand alone use] !#VRv7185&y9=1:S0; [disable if commanders aren't enabled] !#CO-2&v7185=1:P1; [enable custom primary skill control] ** function to make commanders alive !?FU7072; !!MA:Xx16/?i; [get flags] !!VRi:+16; [add alive bit] !!VRi|x16=178/x16=187/x16=182/x16=191:-16; [remove alive bit if soul eater or astral spirit] !!MA:Xx16/i; [reset flags] ** end of function ** !#DO7072/174/191/1:P; [iterate through all commander types and make alive] ** end of initialization ** commander screen open trigger !?CO0&v7185=1; [check if Commander Stats are enabled] !!HE-1:N?y1; [get hero's (commander's) number] !!FU7070:Py1; ** end of hero level trigger ** start of pre-battle trigger ** !?BA0&v7185=1; [check if Commander Stats are enabled] !!VRv7080:C-1/-1/-1/-1/-1/-1/-1/-1/-1/-1; [initialize variables] !!BA:H0/?v7083; [get hero (commander) number - attacker] !!BA:H1/?v7085; [get hero (commander) number - defender] !!FU7070&v7083>-1:Pv7083; [modify commander stats - attacker] !!FU7070&v7085>-1:Pv7085; [modify commander stats - defender] !!COv7083&v7083>-1:B0/?v7084 T?v7088; [check skill bits, get type - attacker] !!COv7085&v7085>-1:B0/?v7086 T?v7089; [check skill bits, get type - defender] !!VRv7084&v7083>-1:&4096; [check death stare bit - attacker] !!VRv7086&v7085>-1:&4096; [check death stare bit - defender] *!COv7083&v7083>-1:B1/12/?v7084; [check for death stare - attacker] *!COv7085&v7085>-1:B1/12/?v7086; [check for death stare - defender] !!COv7083&v7083>-1/v7084=4096:B1/12/0; [remove death stare - attacker] !!COv7085&v7085>-1/v7086=4096:B1/12/0; [remove death stare - defender] !!VRv7090&v7185=1:C0/0/0/0/0/0/0; [no creatures to resurrect after battle - attacker] !!VRv7097&v7185=1:C0/0/0/0/0/0/0; [no creatures to resurrect after battle - defender] !!BA&v7083>-1:M0/0/?l/?v7090; [save qty in each of attacking hero's slots for after battle] !!BA&v7083>-1:M0/1/?l/?v7091; [to determine qty lost for first aid skill] !!BA&v7083>-1:M0/2/?l/?v7092; !!BA&v7083>-1:M0/3/?l/?v7093; !!BA&v7083>-1:M0/4/?l/?v7094; !!BA&v7083>-1:M0/5/?l/?v7095; !!BA&v7083>-1:M0/6/?l/?v7096; !!BA&v7085>-1:M1/0/?l/?v7097; [save qty in each of defending hero's slots for after battle] !!BA&v7085>-1:M1/1/?l/?v7098; [to determine qty lost for first aid skill] !!BA&v7085>-1:M1/2/?l/?v7099; !!BA&v7085>-1:M1/3/?l/?v7100; !!BA&v7085>-1:M1/4/?l/?v7101; !!BA&v7085>-1:M1/5/?l/?v7102; !!BA&v7085>-1:M1/6/?l/?v7103; ** end of pre-battle trigger ** start of battlefield trigger ** !?BF&v7185=1; [continue if enabled] !!VRv7104:C0/0/0/0/0/0/0; [no creatures to resurrect after battle attacker] !!VRv7111:C0/0/0/0/0/0/0; [no creatures to resurrect after battle defender] !!BA&v7083>-1:M0/0/?l/?y1; [save qty in each of attacking hero's slots for after battle] !!BA&v7083>-1:M0/1/?l/?y2; [to determine qty lost for first aid skill] !!BA&v7083>-1:M0/2/?l/?y3; !!BA&v7083>-1:M0/3/?l/?y4; !!BA&v7083>-1:M0/4/?l/?y5; !!BA&v7083>-1:M0/5/?l/?y6; !!BA&v7083>-1:M0/6/?l/?y7; !!BA&v7085>-1:M1/0/?l/?y8; [save qty in each of defending hero's slots for after battle] !!BA&v7085>-1:M1/1/?l/?y9; [to determine qty lost for first aid skill] !!BA&v7085>-1:M1/2/?l/?y10; !!BA&v7085>-1:M1/3/?l/?y11; !!BA&v7085>-1:M1/4/?l/?y12; !!BA&v7085>-1:M1/5/?l/?y13; !!BA&v7085>-1:M1/6/?l/?y14; !!VRv7104&v7083>-1:Sv7090 -y1; !!VRv7105&v7083>-1:Sv7091 -y2; !!VRv7106&v7083>-1:Sv7092 -y3; !!VRv7107&v7083>-1:Sv7093 -y4; !!VRv7108&v7083>-1:Sv7094 -y5; !!VRv7109&v7083>-1:Sv7095 -y6; !!VRv7110&v7083>-1:Sv7096 -y7; !!VRv7111&v7085>-1:Sv7097 -y8; !!VRv7112&v7085>-1:Sv7098 -y9; !!VRv7113&v7085>-1:Sv7099 -y10; !!VRv7114&v7085>-1:Sv7100 -y11; !!VRv7115&v7085>-1:Sv7101 -y12; !!VRv7116&v7085>-1:Sv7102 -y13; !!VRv7117&v7085>-1:Sv7103 -y14; ** end of battlefield trigger ** post-battle trigger ** !?BA1&v7185=1; [continue if enabled] !!COv7083&v7083>-1/v7084=4096:B1/12/1; [restore death stare - attacker] !!COv7085&v7085>-1/v7086=4096:B1/12/1; [restore death stare - defender] !!VRy1:S-1; !!VRy3:S-1; !!HEv7083&v7083>-1:B0/?z1; [get hero's name - attacker] !!HEv7085&v7085>-1:B0/?z3; [get hero's name - defender] !!HEv7083&v7083>-1:O?y1; [get hero's owner - attacker] !!HEv7085&v7085>-1:O?y3; [get hero's owner - defender] !!BA&v7089=8/v7083>-1/y1>-1:M0/0/?l/dv7104; [add banished qty in each of attacking hero's slots after battle] !!BA&v7089=8/v7083>-1/y1>-1:M0/1/?l/dv7105; !!BA&v7089=8/v7083>-1/y1>-1:M0/2/?l/dv7106; !!BA&v7089=8/v7083>-1/y1>-1:M0/3/?l/dv7107; !!BA&v7089=8/v7083>-1/y1>-1:M0/4/?l/dv7108; !!BA&v7089=8/v7083>-1/y1>-1:M0/5/?l/dv7109; !!BA&v7089=8/v7083>-1/y1>-1:M0/6/?l/dv7110; !!BA&v7088=8/v7085>-1/y3>-1:M1/0/?l/dv7111; [add banished qty in each of defending hero's slots after battle] !!BA&v7088=8/v7085>-1/y3>-1:M1/1/?l/dv7112; !!BA&v7088=8/v7085>-1/y3>-1:M1/2/?l/dv7113; !!BA&v7088=8/v7085>-1/y3>-1:M1/3/?l/dv7114; !!BA&v7088=8/v7085>-1/y3>-1:M1/4/?l/dv7115; !!BA&v7088=8/v7085>-1/y3>-1:M1/5/?l/dv7116; !!BA&v7088=8/v7085>-1/y3>-1:M1/6/?l/dv7117; !!IF&1000/v7089=8/v7083>-1/y1>-1:M^After the battle, any banished units come to their senses and return to %Z1's army!^; !!IF&1000/v7088=8/v7085>-1/y3>-1:M^After the battle, any banished units come to their senses and return to %Z3's army!^; ** end of post-battle trigger ** ** pre-action trigger ** !?BG&v7185=1; [continue if enabled] !!BG:N?v7080 A?v7081 E?v7082; [get current stack, action type, destination stack] !!BMv7082&v7082>-1:R?v7087; [get retaliations of target creature stack] ** end of pre-action trigger ** ** post-action trigger ** !?BG1&v7185=1; [continue if enabled] !!BMv7080&v7080>-1:T?y3 I?y4; [get acting monster type and side] !!FU7071&y3>=174/y3<=191/v7081=10:Pv7080/y3; [cast extra spell if commander cast] !!BMv7082&v7082>-1:F?y7 P?y8; [get target's flags, position] !!VRy5&y3>=174/y3<=191/v7081>=6/v7081<=7/v7084=4096/y4=0:S0 R99; [random roll - attacker] !!VRy6&y3>=174/y3<=191/v7081>=6/v7081<=7/v7086=4096/y4=1:S0 R99; [random roll - defender] !!FU7073&y3>=174/y3<=191/v7081>=6/v7081<=7/v7084=4096/y4=0/y5<50:Py7/y8; [50% cast poison if commander with death stare attacked or shot - attacker] !!FU7073&y3>=174/y3<=191/v7081>=6/v7081<=7/v7086=4096/y4=1/y6<50:Py7/y8; [50% cast poison if commander with death stare attacked or shot - defender] ** retaliation attack !!BMv7082&v7082>-1:T?y3 I?y4 P?y5; [get target monster type, side, position] !!BU&v7082>-1:Ey5/?y6; [check if target is still alive] !!VRy3&v7082>-1/y6>-1:S-1; [reset monster type if dead] !!BMv7080&v7080>-1:F?y7 P?y8; [get acting creature's flags, position] !!FU7073&y3>=174/y3<=191/v7081=6/v7084=4096/v7087>0/y4=0/y5<50:Py7/y8; [50% cast poison if commander with death stare retaliates - attacker] !!FU7073&y3>=174/y3<=191/v7081=6/v7086=4096/v7087>0/y4=1/y6<50:Py7/y8; [50% cast poison if commander with death stare retaliates - defender] ** end of post-action trigger ** ** post-buy commander trigger ** !?CO2&v7185=1; !!HE-1:P?y1/?y2/?y3; [get hero position] !!OBy1/y2/y3:U?y4; [get subtype of town] !!CO-1:Ty4; [set commander type] ** end of post-buy commander trigger ** ** function to edit commander stats !?FU7070; x1=hero number !!COx1:X2/?y2; [get commander level] ** attack - base 5 + 1/2 x level - skill adds +25%,+50%,+75%,+100%,+125% !!COx1:S0/?y3; [get attack level] !!VRy4&y3=0:Sy2 :2 +5; [if attack=0 set attack to 5 + 1/2 level] !!VRy4&y3=1:Sy2 :2 +5 *125 :100 -2; [if attack=1 set attack to 5 + 1/2 level x 125%] !!VRy4&y3=2:Sy2 :2 +5 *150 :100 -5; [if attack=2 set attack to 5 + 1/2 level x 150%] !!VRy4&y3=3:Sy2 :2 +5 *175 :100 -9; [if attack=3 set attack to 5 + 1/2 level x 175%] !!VRy4&y3=4:Sy2 :2 +5 *2 -15; [if attack=4 set attack to 5 + 1/2 level x 200%] !!VRy4&y3=5:Sy2 :2 +5 *225 :100 -25; [if attack=5 set attack to 5 + 1/2 level x 225%] !!COx1:P0/y4; [set attack] ** defence - base 5 + 1/2 x level - skill adds +25%,+50%,+75%,+100%,+125% !!COx1:S1/?y3; [get defence level] !!VRy4&y3=0:Sy2 :2 +5; [if defence=0 set defence to 5 + 1/2 level] !!VRy4&y3=1:Sy2 :2 +5 *125 :100 -4; [if defence=1 set defence to 5 + 1/2 level x 125%] !!VRy4&y3=2:Sy2 :2 +5 *150 :100 -10; [if defence=2 set defence to 5 + 1/2 level x 150%] !!VRy4&y3=3:Sy2 :2 +5 *175 :100 -18; [if defence=3 set defence to 5 + 1/2 level x 175%] !!VRy4&y3=4:Sy2 :2 +5 *2 -30; [if defence=4 set defence to 5 + 1/2 level x 200%] !!VRy4&y3=5:Sy2 :2 +5 *225 :100 -50; [if defence=5 set defence to 5 + 1/2 level x 225%] !!COx1:P1/y4; [set defence] ** hit points - base 30 + 15 x level - skill adds +25%,+50%,+75%,+100%,+125% !!COx1:S2/?y3; [get hit points level] !!VRy4&y3=0:Sy2 *20 +40; [if hit points=0 set hit points to 40 + 20 x level] !!VRy4&y3=1:Sy2 *20 +40 *125 :110; [if hit points=1 set hit points to 40 + 20 x level x 125%] !!VRy4&y3=2:Sy2 *20 +40 *150 :125; [if hit points=2 set hit points to 40 + 20 x level x 150%] !!VRy4&y3=3:Sy2 *20 +40 *175 :145; [if hit points=3 set hit points to 40 + 20 x level x 175%] !!VRy4&y3=4:Sy2 *20 +40 *200 :170; [if hit points=4 set hit points to 40 + 20 x level x 200%] !!VRy4&y3=5:Sy2 *20 +40 *225 :200; [if hit points=5 set hit points to 40 + 20 x level x 225%] !!COx1:P2/y4; [set hit points] ** damage - base 10 + 5 x level - skill adds +25%,+50%,+75%,+100%,+125% !!COx1:S3/?y3; [get damage level] !!VRy4&y3=0:Sy2 *5 +10; [if damage=0 set damage to 10 + 5 x level] !!VRy4&y3=1:Sy2 *5 +10 *125 :110; [if damage=1 set damage to 10 + 5 x level x 125%] !!VRy4&y3=2:Sy2 *5 +10 *150 :125; [if damage=2 set damage to 10 + 5 x level x 150%] !!VRy4&y3=3:Sy2 *5 +10 *175 :145; [if damage=3 set damage to 10 + 5 x level x 175%] !!VRy4&y3=4:Sy2 *5 +10 *200 :170; [if damage=4 set damage to 10 + 5 x level x 200%] !!VRy4&y3=5:Sy2 *5 +10 *225 :200; [if damage=5 set damage to 10 + 5 x level x 225%] !!COx1:P3/y4; [set damage] ** magic power - base 0 + 1 x level - not increased by skill !!COx1:S4/?y3; [get MP level] !!VRy4&y3=0:Sy2; [if MP=0 set power to level] !!VRy4&y3=1:Sy2 -1; [if MP=1 set power to level] !!VRy4&y3=2:Sy2 -3; [if MP=2 set power to level] !!VRy4&y3=3:Sy2 -7; [if MP=3 set power to level] !!VRy4&y3=4:Sy2 -14; [if MP=4 set power to level] !!VRy4&y3=5:Sy2 -29; [if MP=5 set power to level] !!COx1:P4/y4; [set power] ** speed - base 5 - skill adds normal bonus !!COx1:P5/5; [set base speed to 5] ** starting special bonus !!COx1:T?y3; [get commander type] *!COx1&y3=0:B1/9/1; [give paladin attack twice] *!COx1&y3=1:B1/4/1; [give hierophant shoot] *!COx1&y3=2:B1/4/1; [give temple guardian shoot] *!COx1&y3=3:B1/8/1; [give succubus fly] *!COx1&y3=4:B1/1/1; [give soul eater fear] *!COx1&y3=5:B1/3/1; [give brute no retaliation] *!COx1&y3=6:B1/5/1; [give ogre leader endless retaliation] *!COx1&y3=7:B1/14/1; [give shaman summon creature] *!COx1&y3=8:B1/8/1; [give astral spirit fly] !!COx1&y3=0:B1/5/1; [give paladin - endless retaliation] !!COx1&y3=1:B1/14/1; [give hierophant - summon creature] !!COx1&y3=2:B1/4/1; [give temple guardian - shoot] !!COx1&y3=3:B1/8/1; [give succubus - fly] !!COx1&y3=4:B1/1/1; [give soul eater - fear] !!COx1&y3=5:B1/3/1; [give brute - no retaliation] !!COx1&y3=6:B1/13/1; [give ogre leader - charge] !!COx1&y3=7:B1/12/1; [give shaman - poison] !!COx1&y3=8:B1/6/1; [give astral spirit - radius attack] !!VRx1:+1; [increment hero number] ** end of function ** function to cast spell x1=acting stack x2=type x3=rank x4=power x5=no retaliation flag * x1=spell x2=position x3=rank x4=power !?FU7071; *!BG:E?y4; [get destination stack] !!BMv7082&v7082>-1:T?y7 P?y8; [get type and position of target creature stack] !!HE-1:N?y5; [get hero's (commander's) number] !!COy5:P4/?y6; [get power] !!BMx1|x2=174/x2=183:C41/y8/2/y6/1; [cast bless - paladin] !!BMx1|x2=175/x2=184:C37/y8/2/y6/1; [cast cure - heirophant] !!BMx1|x2=176/x2=185:C36/y8/2/y6/1; [cast magic mirror - temple guardian] !!BMx1|x2=177/x2=186:C43/y8/2/y6/1; [cast bloodlust - succubus] *!BMx1|x2=178/x2=187:C2/y8/2/y6/1; [cast --- - soul eater] !!BMx1|x2=179/x2=188:C49/y8/2/y6/1; [cast mirth - brute] !!BMx1|x2=180/x2=189:C53/y8/2/y6/1; [cast haste - ogre leader] !!BMx1|x2=181/x2=190:C27/y8/2/y6/1; [cast shield - shaman] !!BMx1|x2=182/x2=191:C28/y8/2/y6/1; [cast air shield - astral spirit] !!BG:N?y1; [get current stack #] !!BMy1:C2/y8/0/0/0; [cast dummy spell to restore current stack indicator] ** end of function ** ** function to cast poison x1=flags x2=position !?FU7073; *!BMv7082:F?y2 P?y3; [get target's flags, position] !!VRx1:&16; [just check alive bit] !!BG:N?y1; [get current stack #] !!BMy1&x1=16:C71/x2/1/3/1; [if target is alive have current stack cast poison] ** end of function **