|
|
bloodsucker
Legendary Hero
|
posted May 01, 2016 11:34 PM |
|
|
Everytime I tried to code a creature bank with !!CB I camed across difficulties that made me return to the more generic !!OB, namely "Not a creature bank error. I'm not saying !!CB trigger doesn't work but at least some actions aren't correctly documented.
|
|
majaczek
Supreme Hero
Work at Magic Dimmension
|
posted May 02, 2016 12:21 AM |
|
|
I written some code, but it seems the starting address for the structures table is dynamic :(
Quote: !?TM2;
!!VRy88:Sc; !!FU&y88>1:E;
!!VRy1:S111820656; Offset of _Types_ for Z358o11.def 63/69
!!VRy2:S4; Name PTR offset
!!VRy3:S56; Type Offset
!!VRy4:S60; Subtype Offset
!!VRy5:S20; Bits1 Offset
!!VRy6:S28; Bits2 Offset
!!VRy7:S36; Bits3 Offset
!!VRy8:S44; EnterMask Offset
!!VRy9:S68; Length in bytes of _Types_ structure
!!VRy21:Sy1 +y3;
!!VRy22:Sy1 +y4;
!!UN:Cy21/4/?y23;
!!UN:Cy22/4/?y24;
!!if|y23<>63/y24<>69:;
!!IF:M^Cannot apply memory patch!
Address Don't Match!^;
!!FU:E;
!!en:;
Could anybody help?
I need the script to change blockmap of default objects :(
|
|
bloodsucker
Legendary Hero
|
posted May 02, 2016 12:32 PM |
|
|
majaczek said: Could anybody help?
I need the script to change blockmap of default objects
I don't have noyhing like that but in one of my previous attempts to make an Era map I once substituted tons of objects like Refugee Camps and Thieves Guilds by special dragons dwellings and some got the craziest locations, like most of it being in the black/rock part of the underground, yet the only problems I found were when the dwelling entry was blocked by map objects like montains or trees, so I believe you are guessing wrong when you say the problem is related to blockmaps.
|
|
majaczek
Supreme Hero
Work at Magic Dimmension
|
posted May 02, 2016 04:46 PM |
|
|
bloodsucker said:
majaczek said: Could anybody help?
I need the script to change blockmap of default objects
I don't have noyhing like that but in one of my previous attempts to make an Era map I once substituted tons of objects like Refugee Camps and Thieves Guilds by special dragons dwellings and some got the craziest locations, like most of it being in the black/rock part of the underground, yet the only problems I found were when the dwelling entry was blocked by map objects like montains or trees, so I believe you are guessing wrong when you say the problem is related to blockmaps.
It is, because 63/69 has very weird default blockmap: first field (rightmost, downmost) is passable and not an entry. It probably causes search function to fail. Or other coordinates based functions.
Remember that custom object lists can't replace blockmap of game-placed objects.
Pleeeeaaase somebody help me finding the address the pointer to the table I tried to alter
|
|
joza934
Tavern Dweller
|
posted May 02, 2016 06:04 PM |
|
|
majaczek said:
bloodsucker said:
majaczek said: Could anybody help?
I need the script to change blockmap of default objects
I don't have noyhing like that but in one of my previous attempts to make an Era map I once substituted tons of objects like Refugee Camps and Thieves Guilds by special dragons dwellings and some got the craziest locations, like most of it being in the black/rock part of the underground, yet the only problems I found were when the dwelling entry was blocked by map objects like montains or trees, so I believe you are guessing wrong when you say the problem is related to blockmaps.
It is, because 63/69 has very weird default blockmap: first field (rightmost, downmost) is passable and not an entry. It probably causes search function to fail. Or other coordinates based functions.
Remember that custom object lists can't replace blockmap of game-placed objects.
Pleeeeaaase somebody help me finding the address the pointer to the table I tried to alter
GUYS CAN U HELP ME IDK HOW TO FIX THIS
http://prnt.sc/azf1x6
http://prnt.sc/azf1x6
http://prnt.sc/azf1x6
http://prnt.sc/azf1x6
____________
|
|
joza934
Tavern Dweller
|
posted May 02, 2016 06:06 PM |
|
|
majaczek said:
bloodsucker said:
majaczek said: Could anybody help?
I need the script to change blockmap of default objects
I don't have noyhing like that but in one of my previous attempts to make an Era map I once substituted tons of objects like Refugee Camps and Thieves Guilds by special dragons dwellings and some got the craziest locations, like most of it being in the black/rock part of the underground, yet the only problems I found were when the dwelling entry was blocked by map objects like montains or trees, so I believe you are guessing wrong when you say the problem is related to blockmaps.
It is, because 63/69 has very weird default blockmap: first field (rightmost, downmost) is passable and not an entry. It probably causes search function to fail. Or other coordinates based functions.
Remember that custom object lists can't replace blockmap of game-placed objects.
Pleeeeaaase somebody help me finding the address the pointer to the table I tried to alter
GUYS CAN U HELP ME IDK HOW TO FIX THIS
http://prnt.sc/azf1x6
http://prnt.sc/azf1x6
http://prnt.sc/azf1x6
http://prnt.sc/azf1x6
____________
|
|
majaczek
Supreme Hero
Work at Magic Dimmension
|
posted May 02, 2016 07:33 PM |
|
Edited by majaczek at 21:40, 02 May 2016.
|
Script Works !!!
Quote:
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.10.5.945
ERMS_ScriptDate=2.5(May).2016
!#SN:W^Temple_SunMoon Enabled^/1;
!#TM1:S1/999/1/255; triggers every color every day
!#TM2:S1/999/1/255; same but triggers only *after* all calculations from TM1 are done
!?FU55442; initialization (called from Knightmare - Town Guardians
!?TM2;
!!VRy88:Sc; !!FU&y88>1:E;
!!FU55468:P;
!?FU55468;
!!VRy31:S4294967295; !!VRy32:S8191;
000111111111111111111111111111111111111111111111
From objects txt
!!VRy35:S4294967295; !!VRy36:S24351;
010111110001111111111111111111111111111111111111
From objects txt
!!VRy38:S0; !!VRy39:S16384;
010000000000000000000000000000000000000000000000
From objects txt
!!DO55467/0/9999/1:P63/69/y35/y36/y38/y39;
!!DO55467/0/9999/1:P63/70/y35/y36/y38/y39;
!!DO55467/0/9999/1:P63/71/y35/y36/y38/y39;
!!DO55467/0/9999/1:P63/72/y35/y36/y38/y39;
!?FU55467;
x1/x2 - type/subtype (use only existing ones)
x3/x4 - Bits3
x5/x6 - EnterMask
!_!VRy1:S111820656; Offset of _Types_ for Z358o11.def 63/69
(dynamic - sorry doesn't work)
!!VRy2:S4; Name PTR offset
!!VRy3:S56; Type Offset
!!VRy4:S60; Subtype Offset
!!VRy5:S20; Bits1 Offset
!!VRy6:S28; Bits2 Offset
!!VRy7:S36; Bits3 Offset
!!VRy8:S44; EnterMask Offset
!!VRy9:S68; Length in bytes of _Types_ structure
!!VRy99:S107806860; 0x066d008c
; _Main_ + 8 ? something other ? Hope it works
!!UN:Cy99/4/?y98; y98 is a bottom of stack of _Types_
!!VRy1:Sy98 -y9; Hopefully
; Offset of _Types_ for AVXprmd0.def 63/0
!!VRy21:Sy1 +y3;
!!VRy22:Sy1 +y4;
!!UN:Cy21/4/?y23;
!!UN:Cy22/4/?y24;
!!if|y23<>63/y24<>0:;
!!IF:M^Cannot apply memory patch!
Address Don't Match! expected 63/0 got %Y23/%Y24^;
!!FU:E;
!!en:;
!!VRy44:Sy9 *x16;
!!VRy50:Sy1 +y7 -y44; !!VRy51:Sy50 +4;
!!VRy55:Sy1 +y8 -y44; !!VRy56:Sy55 +4;
!!VRy21:Sy1 -y44 +y3;
!!VRy22:Sy1 -y44 +y4;
!!UN:Cy21/4/?y23;
!!UN:Cy22/4/?y24;
!!IF&x16=9999:M^Def Sprite for Object %X1/%X2 not Found^;
!!FU|x1<>y23/x2<>y24:E;
!!UN:Cy50/4/x3; !!UN:Cy51/4/x4;
!!UN:Cy55/4/x5; !!UN:Cy56/4/x6;
!!VRx16:S999999;
!!FU:E;
!!VRy50:+y9; !!VRy51:+y9;
!!VRy55:+y9; !!VRy56:+y9;
!!UN:Cy50/4/y35; !!UN:Cy51/4/y36;
!!UN:Cy55/4/y38; !!UN:Cy56/4/y39;
!!VRy50:+y9; !!VRy51:+y9;
!!VRy55:+y9; !!VRy56:+y9;
!!UN:Cy50/4/y35; !!UN:Cy51/4/y36;
!!UN:Cy55/4/y38; !!UN:Cy56/4/y39;
!!VRy50:+y9; !!VRy51:+y9;
!!VRy55:+y9; !!VRy56:+y9;
!!UN:Cy50/4/y35; !!UN:Cy51/4/y36;
!!UN:Cy55/4/y38; !!UN:Cy56/4/y39;
!!VRy50:+y9; !!VRy51:+y9;
!!VRy55:+y9; !!VRy56:+y9;
!?TM2; Replace objects with Temples
!!FU55466:P;
!?FU55466;
!!UN:P195/?y21; [Check if Replace Objects is enabled: y21=1 if yes]
!!FU&y21=0:E;
!!VRy1:Sc;
!!IF&y1>1:E;
!_!FU55463:P16/1/25/0/63/69/100;
!!FU55463:P16/1/25/2/63/69/100;
!_!FU55463:P16/1/25/0/63/54/100; Test
!_!FU55463:P16/1/25/0/63/69/100; Test
!_!FU55463:P16/1/25/2/-1/-1/100; Test
!_!IF:M^This Mod adds pillageable Temples^;
!_!UN:R6/250;
!?FU55464; Internal for FU55463
!!UN:Ux1/x2/-2/1; [get x/y/l of yellow square of object into v1-v3]
!_!IF:M^Try Replacing^;
!!VRy77:S0 R99; Dice
!!if&y77<x7:;
!_!UN:R6/50;
!_!IF:M^Replacing %X1 %X2 with %X3 %X4^;
!!VRx16:+1;
!!UN:Ov1/v2/v3;
!!if|x5<0/x6<0:;
!!UN:Iv1/v2/v3/x3/x4;
!!el:;
!!VRy99:S99;
!!if&x3=25/x4>0:;
!!VRy99:S25;
!!UN:Iv1/v2/v3/25/0/x5/x6;
!_!UN:Iv1/v2/v3/x5/x6;
!!VRy92:Sv2 -1;
!!VRy82:Sv2 -2;
!!VRy72:Sv2 -3;
!!VRy12:Sv2 +1;
!!VRy22:Sv2 +2;
!!VRy32:Sv2 +3;
!!VRy91:Sv1 -1;
!!VRy81:Sv1 -2;
!!VRy71:Sv1 -3;
!!VRy11:Sv1 +1;
!!VRy21:Sv1 +2;
!!VRy31:Sv1 +3;
!_!SN:W^Debug Marker %V1 %V2 %V3^/x4;
!!SN:W^Debug Marker %Y91 %Y92 %V3^/666;
!!SN:W^Debug Marker %Y91 %V2 %V3^/777;
!_!SN:W^Knightmare CreBank %Y91 %Y92 %V3^/x4;
!!SN:W^Knightmare CreBank %V1 %V2 %V3^/x4;
!!TRv1 /v2 /v3:P0;
!!TRy81/v2 /v3:P0;
!!if&v1<v1:;
!_!IF:M^Boo !!!^;
!_!TRy91/v2 /v3:E0 P1;
!!TRy81/v2 /v3:E1 P0;
!!TRv1 /y92/v3:E1 P0;
!_!TRy91/y92/v3:E1 P0;
!!TRy81/y92/v3:E1 P0;
!!en:;
!!if&v1<v1:;
!_!IF:M^Boo !!!^;
!!TRv1 /v2 /v3:E1 P1;
!!TRy91/v2 /v3:E0 P1;
!!TRy81/v2 /v3:E1 P1;
!!TRv1 /y92/v3:E1 P1;
!!TRy91/y92/v3:E1 P1;
!!TRy81/y92/v3:E1 P1;
!!en:;
!_!OBv1/v2/v3:T25;
!_!OBv1/v2/v3:Ux4;
!_!UN:R6/50;
!_!FU55457:P25/x4/v1/v2/v3;
!_!OBv1/v2/v3:U?y77;
!_!IF:M^Subtype %Y77^;
!!en:;
!!UN&y99=99:Iv1/v2/v3/x3/x4/x5/x6;
!!en:;
!_!IF&x3=25/x4>0:M^Replaced %X1 %X2 with new CreBank^;
!!en:;
!?FU55463;
x1, x2 - Type and Subtype of Replaced object
x3, x4 - Type and Subtype of New Object
x5, x6 - Apperance of New Object
x7 - Percentage chance
!!UN:Ux1/x2/?v5; [objects number]
!!FU&v5<2:E; exit if < 2 objects
!_!VRv5:-1;
!!DO55464/1/v5/1:Px1/x2/x3/x4/x5/x6/x7;
!#TM81:S1/1/1/255; Once
!?TM81; Fix new Creature Banks
!?HM-1;
!!SN:W^Temple_SunMoon initialised^/?y1;
!!FU55465&y1=1:P;
!!SN&y1<9:W^Temple_SunMoon initialised^/d1;
!!SN:W^Debug Marker %V998 %V999 %V1000^/?y4;
!!IF&y4>0:M^Debug Marker %Y4^;
!?FU55465;
!!UN:U16/-1/?y-1; [creature banks number]
!!VRv1:S-1;
!!DO55457/1/y-1/1:P16/-1; [run through]
!!UN:U25/-1/?y-1; [Dragon Utopias number]
!!VRv1:S-1;
!!DO55457/1/y-1/1:P25/-1; [run through]
!!FU:E; [don't run code below]
!!UN:U63/-1/?y-1; [WoG Objects number]
!!VRv1:S-1;
!!DO55457/1/y-1/1:P25/-1; [run through]
!_?OB16;
!_!FU:E;
!_!OBv998/v999/v1000:U?y1;
!_!SN:W^Last Creature Bank Subtype^/y1;
!_!OBv998/v999/v1000&y1>20:U0;
!_$OB16/0;
!_!FU:E;
!_!SN:W^Last Creature Bank Subtype^/?y1;
!_!OBv998/v999/v1000:Uy1;
!?OB25;
!!VRy92:Sv999 -1;
!!VRy91:Sv998 -1;
!!OBv998/v999/v1000:T?y1;
!!OBv998/v999/v1000:U?y2;
!!SN:W^Knightmare CreBank %Y91 %Y92 %V1000^/?y3;
!!IF:M^Dragon Utopia (%Y1/%Y2) Hidden: %Y3^;
!!FU:E;
!!HE-1:N?y9;
!!DO55460/0/6/1:Py9;
!?FU55462; Add Prize
x1/x2/x3 - Position of Crbank
x4 - Type of prize
1 small combo
2 big combo
3 grail
!!VRy1:S0 R99; Dice
!!CBx1/x2/x3&x4=3:A3/2;
!!if&x4=2:;
!!CBx1/x2/x3&y1>=0 /y1<5 :A3/134; PotDF
!!CBx1/x2/x3&y1>=5 /y1<12:A3/129; AA
!!CBx1/x2/x3&y1>=12/y1<24:A3/133; Legion
!!CBx1/x2/x3&y1>=24/y1<36:A3/126; Dragon Soul Orb
!!CBx1/x2/x3&y1>=36/y1<55:A3/108; Fanatic Courage
!!CBx1/x2/x3&y1>=55/y1<66:A3/162; SoDK
!!CBx1/x2/x3&y1>=66/y1<80:A3/161; Helm of Vision
!!CBx1/x2/x3&y1>=80/y1<90:A3/166; Broach of Wealth
!!CBx1/x2/x3&y1>=90 :A3/169; Boots of Rincewind
!!en:;
!!if&x4=1:;
!!FU55462&y1<10 :Px1/x2/x3/1 Px1/x2/x3/1; extra bonus
!!FU55462&y1>=95:Px1/x2/x3/1 Px1/x2/x3/1; extra bonus
!!CBx1/x2/x3&y1>=10/y1<15:A3/170;
!!CBx1/x2/x3&y1>=15/y1<20:A3/168;
!!CBx1/x2/x3&y1>=20/y1<25:A3/167;
!!CBx1/x2/x3&y1>=25/y1<30:A3/165;
!!CBx1/x2/x3&y1>=30/y1<35:A3/164;
!!CBx1/x2/x3&y1>=35/y1<40:A3/163;
!!CBx1/x2/x3&y1>=40/y1<45:A3/158;
!!CBx1/x2/x3&y1>=45/y1<50:A3/140;
!!CBx1/x2/x3&y1>=50/y1<55:A3/139;
!!CBx1/x2/x3&y1>=55/y1<60:A3/138;
!!CBx1/x2/x3&y1>=60/y1<65:A3/137;
!!CBx1/x2/x3&y1>=65/y1<70:A3/136;
!!CBx1/x2/x3&y1>=70/y1<75:A3/135;
!!CBx1/x2/x3&y1>=75/y1<80:A3/132;
!!CBx1/x2/x3&y1>=80/y1<85:A3/131;
!!CBx1/x2/x3&y1>=85/y1<90:A3/130;
!!CBx1/x2/x3&y1>=90/y1<95:A3/83;
!!en:;
!?FU55461; Clean
x1/x2/x3 - Position of Crbank
!!CBx1/x2/x3:A1/?y1;
!!CBx1/x2/x3&y1>0:A4/0;
!!if&x1=1:;
!!CBx1/x2/x3:G0/-1/0 G1/-1/0 G2/-1/0 G3/-1/0 G4/-1/0 G5/-1/0;
!!CBx1/x2/x3:G6/-1/0 G7/-1/0; Clean Guards Slots
!!CBx1/x2/x3:M-1/0; Clean Monster Prize
!!CBx1/x2/x3:R0/0 R1/0 R2/0 R3/0 R4/0 R5/0 R6/0;
!!en:;
!?FU55460;
x1 - Checked hero
x16 - Creature slot
!!FU&x1<0:E;
!!HEx1:C0/x16/?y1/?y2;
!!HEx1&y1>=243/y1<=251:C0/x16/-1/0;
!?FU55457;
x1 - Object type
x2 < 0 Default
x2 > 0 Custom
!!VRy3:S0;
!!if&x2<0:;
!!UN:Ux1/-1/-1/1; [Creature Bank coordinates in v1/v2/v3]
!!OBv1/v2/v3:U?y2; [subtype]
!!el:;
!!VRv1:Cx3/x4/x5; [Creature Bank coordinates in v1/v2/v3]
!!IF:M^Custom CreBank^;
!!VRy2:Sx2;
!!en:;
!_!OBv1/v2/v3&y2>20:U10; If new Creature Bank set type to Dragon Utopia
!!SN:W^Knightmare CreBank %V1 %V2 %V3^/?y77;
!!IF&y77>0:M^Marked new CreBank %Y77^;
!_!FU:E; Debug Exit
!!if&x1=16:; Any new type CRBANK
!!if&y2>20:;
!!VRy3:Sy2 -20;
!!el:;
!!VRy3:S0;
!!en:;
!!en:;
!!if&y77<=0:;
!!if&y2>0/x1=25:;
!!VRy3:Sy2;
!!en:;
!!el:;
!!VRy3&y77>0:Sy77;
!!en:;
!!FU&y3<=0:E;
!!VRy99:S0 R99; Dice
!!if&y3=1:; Moon
!!DO55461/1/99/1:Pv1/v2/v3; Clean Creature Bank
!!CBv1/v2/v3:G0/246/9 G1/247/9 G2/248/9; First 3 slots of Guards
!!CBv1/v2/v3:G3/153/9 G4/154/9 G5/155/9; Next 3 slots of Lv7++
!!CBv1/v2/v3:G6/235/9; G7/242/9; Next 2 slots of Powerul Minions
!!FU55462&y99<65:Pv1/v2/v3/1 Pv1/v2/v3/1;
!!FU55462&y99>=65/y99<90:Pv1/v2/v3/2;
!!FU55462&y99>=90:Pv1/v2/v3/2;
!!en:;
!!if&y3=2:; Sun
!!DO55461/1/99/1:Pv1/v2/v3; Clean Creature Bank
!!CBv1/v2/v3:G0/243/9 G1/244/9 G2/245/9; First 3 slots of Guards
!!CBv1/v2/v3:G3/150/9 G4/151/9 G5/152/9; Next 3 slots of Lv7++
!!CBv1/v2/v3:G6/253/9; G7/240/9; Next 2 slots of Powerul Minions
!!FU55462&y99<65:Pv1/v2/v3/1 Pv1/v2/v3/1;
!!FU55462&y99>=65/y99<90:Pv1/v2/v3/2;
!!FU55462&y99>=90:Pv1/v2/v3/2;
!!en:;
!!if&y3=3:; Stars
!!DO55461/1/99/1:Pv1/v2/v3; Clean Creature Bank
!!CBv1/v2/v3:G0/249/9 G1/250/9 G2/251/9; First 3 slots of Guards
!!CBv1/v2/v3:G3/156/9 G4/157/9 G5/158/9; Next 3 slots of Lv7++
!!CBv1/v2/v3:G6/241/9 ;G7/254/9; Next 2 slots of Powerul Minions
!!FU55462&y99<65:Pv1/v2/v3/1 Pv1/v2/v3/1;
!!FU55462&y99>=65/y99<90:Pv1/v2/v3/2;
!!FU55462&y99>=90:Pv1/v2/v3/2;
!!en:;
!!if&y3=4:; Greed
!!DO55461/1/99/1:Pv1/v2/v3; Clean Creature Bank
!!CBv1/v2/v3:G0/134/29 G1/135/29 G2/132/29; First 3 slots of Dragons
!!CBv1/v2/v3:G0/151/29 G1/155/29 G2/154/29; Next 3 slots of Dragons
!!CBv1/v2/v3:G6/196/29; Next 1 slot of Dracoliches
!!FU55462&y99<65:Pv1/v2/v3/1 Pv1/v2/v3/1;
!!FU55462&y99>=65/y99<90:Pv1/v2/v3/2;
!!FU55462&y99>=90:Pv1/v2/v3/2;
!!en:;
or at least it seems so... I broken Flags although :P
EDIT:
Last version:
Quote: 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.10.5.945
ERMS_ScriptDate=2.5(May).2016
!#SN:W^Temple_SunMoon Enabled^/1;
!#TM1:S1/999/1/255; triggers every color every day
!#TM2:S1/999/1/255; same but triggers only *after* all calculations from TM1 are done
!?FU55442; initialization (called from Knightmare - Town Guardians
!?TM2;
!!VRy88:Sc; !!FU&y88>1:E;
!!FU55468:P;
!?FU55468;
!!IF:M^FU55468 Function disabled it is not ready^; !!FU:E;
For Blockmap
!!VRy31:S4294967295 S-1; !!VRy32:S8191;
000111111111111111111111111111111111111111111111
From objects txt
!!VRy35:S4294967295 S-1; !!VRy36:S24351;
010111110001111111111111111111111111111111111111
From objects txt
!!VRy50:S4294967295 S-1; !!VRy51:S7967;
000111110001111111111111111111111111111111111111
From objects txt
For entries
!!VRy38:S0; !!VRy39:S16384;
010000000000000000000000000000000000000000000000
From objects txt
!!DO55467/0/9999/1:P63/69/y31/y32/y38/y39;
!!DO55467/0/9999/1:P63/70/y31/y32/y38/y39;
!!DO55467/0/9999/1:P63/71/y31/y32/y38/y39;
!!DO55467/0/9999/1:P63/72/y31/y32/y38/y39;
!_#FU55468:P;
!?FU55467;
x1/x2 - type/subtype (use only existing ones)
x3/x4 - Bits3
x5/x6 - EnterMask
!!SN:W^Broken DEF patcher^/?y1; !!FU&y1>0:E;
!_!VRy1:S111820656; Offset of _Types_ for Z358o11.def 63/69
(dynamic - sorry doesn't work)
!!VRy2:S4; Name PTR offset
!!VRy3:S56; Type Offset
!!VRy4:S60; Subtype Offset
!!VRy5:S20; Bits1 Offset
!!VRy6:S28; Bits2 Offset
!!VRy7:S36; Bits3 Offset
!!VRy8:S44; EnterMask Offset
!!VRy9:S68; Length in bytes of _Types_ structure
!!VRy99:S107806860; 0x066d008c
; _Main_ + 8 ? something other ? Hope it works
!!UN:Cy99/4/?y98; y98 is a bottom of stack of _Types_
!_!VRy98:S110641484; 0x698414C
!!VRy1:Sy98 -y9; Hopefully
; Offset of _Types_ for AVXprmd0.def 63/0
!!VRy21:Sy1 +y3;
!!VRy22:Sy1 +y4;
!!UN:Cy21/4/?y23;
!!UN:Cy22/4/?y24;
!!if|y23<>63/y24<>0:;
!!IF:M^Cannot apply memory patch!
Address Don't Match! expected 63/0 got %Y23/%Y24^;
!!SN:W^Broken DEF patcher^/666;
!!FU:E;
!!en:;
!!VRy44:Sy9 *x16;
!!VRy50:Sy1 +y7 -y44; !!VRy51:Sy50 +4;
!!VRy55:Sy1 +y8 -y44; !!VRy56:Sy55 +4;
!!VRy21:Sy1 -y44 +y3;
!!VRy22:Sy1 -y44 +y4;
!!UN:Cy21/4/?y23;
!!UN:Cy22/4/?y24;
!!IF&x16=9999:M^Def Sprite for Object %X1/%X2 not Found^;
!!FU|x1<>y23/x2<>y24:E;
!!UN:Cy50/4/x3; !!UN:Cy51/4/x4;
!!UN:Cy55/4/x5; !!UN:Cy56/4/x6;
!!VRx16:S999999;
!!FU:E;
!!VRy50:+y9; !!VRy51:+y9;
!!VRy55:+y9; !!VRy56:+y9;
!!UN:Cy50/4/y35; !!UN:Cy51/4/y36;
!!UN:Cy55/4/y38; !!UN:Cy56/4/y39;
!?TM1; Replace objects with Temples
!!FU55466:P;
!?FU55466;
!!UN:P195/?y21; [Check if Replace Objects is enabled: y21=1 if yes]
!!FU&y21=0:E;
!!VRy1:Sc;
!!IF&y1>1:E;
!_!FU55463:P16/1/25/0/63/69/100;
!!FU55463:P16/1/25/2/63/69/100;
!_!FU55463:P16/1/25/0/63/54/100; Test
!_!FU55463:P16/1/25/0/63/69/100; Test
!_!FU55463:P16/1/25/2/-1/-1/100; Test
!_!IF:M^This Mod adds pillageable Temples^;
!_!UN:R6/250;
!?FU55464; Internal for FU55463
!!UN:Ux1/x2/-1/1; [get x/y/l of yellow square of object into v1-v3]
!_!IF:M^Try Replacing^;
!!VRy77:S0 R99; Dice
!!if&y77<x7:;
!_!UN:R6/50;
!_!IF:M^Replacing %X1 %X2 with %X3 %X4^;
!!VRx16:+1;
!!UN:Ov1/v2/v3;
!!if|x5<0/x6<0:;
!!UN:Iv1/v2/v3/x3/x4;
!!el:;
!!VRy99:S99;
!!if&x3=25/x4>0:;
!!VRy99:S25;
!!UN:Iv1/v2/v3/25/0/x5/x6;
!_!UN:Iv1/v2/v3/x5/x6;
!!VRy92:Sv2 -1;
!!VRy82:Sv2 -2;
!!VRy72:Sv2 -3;
!!VRy12:Sv2 +1;
!!VRy22:Sv2 +2;
!!VRy32:Sv2 +3;
!!VRy91:Sv1 -1;
!!VRy81:Sv1 -2;
!!VRy71:Sv1 -3;
!!VRy11:Sv1 +1;
!!VRy21:Sv1 +2;
!!VRy31:Sv1 +3;
!_!SN:W^Debug Marker %V1 %V2 %V3^/x4;
!_!SN:W^Debug Marker %Y91 %Y92 %V3^/666;
!_!SN:W^Debug Marker %Y91 %V2 %V3^/777;
!_!SN:W^Knightmare CreBank %Y91 %Y92 %V3^/x4;
!!SN:W^Knightmare CreBank %V1 %V2 %V3^/x4;
!!if&v1<v1:;
!_!IF:M^Boo !!!^;
!!TRv1 /v2 /v3:P0;
!!TRy81/v2 /v3:P0;
!_!TRy91/v2 /v3:E0 P1;
!!TRy81/v2 /v3:E1 P0;
!!TRv1 /y92/v3:E1 P0;
!_!TRy91/y92/v3:E1 P0;
!!TRy81/y92/v3:E1 P0;
!!en:;
!!if&v1<v1:;
!_!IF:M^Boo !!!^;
!!TRv1 /v2 /v3:E1 P1;
!!TRy91/v2 /v3:E0 P1;
!!TRy81/v2 /v3:E1 P1;
!!TRv1 /y92/v3:E1 P1;
!!TRy91/y92/v3:E1 P1;
!!TRy81/y92/v3:E1 P1;
!!en:;
!_!OBv1/v2/v3:T25;
!_!OBv1/v2/v3:Ux4;
!_!UN:R6/50;
!_!FU55457:P25/x4/v1/v2/v3;
!!OBv1/v2/v3:U?y77;
!_!IF:M^Subtype %Y77^;
!!en:;
!!UN&y99=99:Iv1/v2/v3/x3/x4/x5/x6;
!!en:;
!_!IF&x3=25/x4>0:M^Replaced %X1 %X2 with new CreBank^;
!!en:;
!?FU55463;
x1, x2 - Type and Subtype of Replaced object
x3, x4 - Type and Subtype of New Object
x5, x6 - Apperance of New Object
x7 - Percentage chance
!!UN:Ux1/x2/?v5; [objects number]
!!FU&v5<2:E; exit if < 2 objects
!!VRv5:-1;
!!DO55464/1/v5/1:Px1/x2/x3/x4/x5/x6/x7;
!_#TM81:S1/1/1/255; Once
!_?TM81; Fix new Creature Banks
!?HM-1;
!?TM1;
!!SN:W^Temple_SunMoon initialised^/?y1;
!!FU55465&y1=1:P;
!!SN&y1<9:W^Temple_SunMoon initialised^/d1;
!!SN:W^Debug Marker %V998 %V999 %V1000^/?y4;
!!IF&y4>0:M^Debug Marker %Y4^;
!?FU55465;
!!UN:U25/-1/?y-1; [Dragon Utopias number]
!!VRv1:S-1;
!!DO55457/1/y-1/1:P25/-1; [run through]
!!UN:U16/-1/?y-1; [creature banks number]
!_!VRv1:S-1;
!!DO55457/1/y-1/1:P16/-1; [run through]
!!FU:E; [don't run code below]
!!UN:U63/-1/?y-1; [WoG Objects number]
!!VRv1:S-1;
!!DO55457/1/y-1/1:P25/-1; [run through]
!_?OB16;
!_!FU:E;
!_!OBv998/v999/v1000:U?y1;
!_!SN:W^Last Creature Bank Subtype^/y1;
!_!OBv998/v999/v1000&y1>20:U0;
!_$OB16/0;
!_!FU:E;
!_!SN:W^Last Creature Bank Subtype^/?y1;
!_!OBv998/v999/v1000:Uy1;
!?OB25;
!!VRy92:Sv999 +0;
!!VRy91:Sv998 +1;
!!OBv998/v999/v1000:T?y1;
!!OBv998/v999/v1000:U?y2;
!!SN:W^Knightmare CreBank %Y91 %Y92 %V1000^/?y3;
!!IF:M^Dragon Utopia (%Y1/%Y2) Hidden: %Y3^;
!!FU:E;
!!HE-1:N?y9;
!!DO55460/0/6/1:Py9;
!?FU55462; Add Prize
x1/x2/x3 - Position of Crbank
x4 - Type of prize
1 small combo
2 big combo
3 grail
!!VRy1:S0 R99; Dice
!!CBx1/x2/x3&x4=3:A3/2;
!!if&x4=2:;
!!CBx1/x2/x3&y1>=0 /y1<5 :A3/134; PotDF
!!CBx1/x2/x3&y1>=5 /y1<12:A3/129; AA
!!CBx1/x2/x3&y1>=12/y1<24:A3/133; Legion
!!CBx1/x2/x3&y1>=24/y1<36:A3/126; Dragon Soul Orb
!!CBx1/x2/x3&y1>=36/y1<55:A3/108; Fanatic Courage
!!CBx1/x2/x3&y1>=55/y1<66:A3/162; SoDK
!!CBx1/x2/x3&y1>=66/y1<80:A3/161; Helm of Vision
!!CBx1/x2/x3&y1>=80/y1<90:A3/166; Broach of Wealth
!!CBx1/x2/x3&y1>=90 :A3/169; Boots of Rincewind
!!en:;
!!if&x4=1:;
!!FU55462&y1<10 :Px1/x2/x3/1 Px1/x2/x3/1; extra bonus
!!FU55462&y1>=95:Px1/x2/x3/1 Px1/x2/x3/1; extra bonus
!!CBx1/x2/x3&y1>=10/y1<15:A3/170;
!!CBx1/x2/x3&y1>=15/y1<20:A3/168;
!!CBx1/x2/x3&y1>=20/y1<25:A3/167;
!!CBx1/x2/x3&y1>=25/y1<30:A3/165;
!!CBx1/x2/x3&y1>=30/y1<35:A3/164;
!!CBx1/x2/x3&y1>=35/y1<40:A3/163;
!!CBx1/x2/x3&y1>=40/y1<45:A3/158;
!!CBx1/x2/x3&y1>=45/y1<50:A3/140;
!!CBx1/x2/x3&y1>=50/y1<55:A3/139;
!!CBx1/x2/x3&y1>=55/y1<60:A3/138;
!!CBx1/x2/x3&y1>=60/y1<65:A3/137;
!!CBx1/x2/x3&y1>=65/y1<70:A3/136;
!!CBx1/x2/x3&y1>=70/y1<75:A3/135;
!!CBx1/x2/x3&y1>=75/y1<80:A3/132;
!!CBx1/x2/x3&y1>=80/y1<85:A3/131;
!!CBx1/x2/x3&y1>=85/y1<90:A3/130;
!!CBx1/x2/x3&y1>=90/y1<95:A3/83;
!!en:;
!?FU55461; Clean
x1/x2/x3 - Position of Crbank
!!CBx1/x2/x3:A1/?y1;
!!CBx1/x2/x3&y1>0:A4/0;
!!if&x1=1:;
!!CBx1/x2/x3:G0/-1/0 G1/-1/0 G2/-1/0 G3/-1/0 G4/-1/0 G5/-1/0;
!!CBx1/x2/x3:G6/-1/0 G7/-1/0; Clean Guards Slots
!!CBx1/x2/x3:M-1/0; Clean Monster Prize
!!CBx1/x2/x3:R0/0 R1/0 R2/0 R3/0 R4/0 R5/0 R6/0;
!!en:;
!?FU55460;
x1 - Checked hero
x16 - Creature slot
!!FU&x1<0:E;
!!HEx1:C0/x16/?y1/?y2;
!!HEx1&y1>=243/y1<=251:C0/x16/-1/0;
!?FU55457;
x1 - Object type
x2 < 0 Default
x2 > 0 Custom
!!VRy3:S0;
!!if&x2<0:;
!!UN:Ux1/-1/?v5; [objects number]
!!FU&v5<2:E; exit if < 2 objects
!!UN:Ux1/-1/-1/1; [Creature Bank coordinates in v1/v2/v3]
!!OBv1/v2/v3:U?y2; [subtype]
!!el:;
!!IF:M^Custom CreBank^;
!!VRv1:Cx3/x4/x5; [Creature Bank coordinates in v1/v2/v3]
!!UN:Ux1/x2/?v5; [objects number]
!!FU&v5<2:E; exit if < 2 objects
!!VRy2:Sx2;
!!en:;
!_!OBv1/v2/v3&y2>20:U10; If new Creature Bank set type to Dragon Utopia
!!SN:W^Knightmare CreBank %V1 %V2 %V3^/?y77;
!!IF&y77>0:M^Marked new CreBank %Y77^;
!_!FU:E; Debug Exit
!!if&x1=16:; Any new type CRBANK
!!if&y2>20:;
!!VRy3:Sy2 -20;
!!el:;
!!VRy3:S0;
!!en:;
!!en:;
!!if&y77<=0:;
!!if&y2>0/x1=25:;
!!VRy3:Sy2;
!!en:;
!!el:;
!!VRy3&y77>0:Sy77;
!!en:;
!!FU&y3<=0:E;
!!VRy99:S0 R99; Dice
!!if&y3=1:; Moon
!!DO55461/1/99/1:Pv1/v2/v3; Clean Creature Bank
!!CBv1/v2/v3:G0/246/9 G1/247/9 G2/248/9; First 3 slots of Guards
!!CBv1/v2/v3:G3/153/9 G4/154/9 G5/155/9; Next 3 slots of Lv7++
!!CBv1/v2/v3:G6/235/9; G7/242/9; Next 2 slots of Powerul Minions
!!FU55462&y99<65:Pv1/v2/v3/1 Pv1/v2/v3/1;
!!FU55462&y99>=65/y99<90:Pv1/v2/v3/2;
!!FU55462&y99>=90:Pv1/v2/v3/2;
!!en:;
!!if&y3=2:; Sun
!!DO55461/1/99/1:Pv1/v2/v3; Clean Creature Bank
!!CBv1/v2/v3:G0/243/9 G1/244/9 G2/245/9; First 3 slots of Guards
!!CBv1/v2/v3:G3/150/9 G4/151/9 G5/152/9; Next 3 slots of Lv7++
!!CBv1/v2/v3:G6/253/9; G7/240/9; Next 2 slots of Powerul Minions
!!FU55462&y99<65:Pv1/v2/v3/1 Pv1/v2/v3/1;
!!FU55462&y99>=65/y99<90:Pv1/v2/v3/2;
!!FU55462&y99>=90:Pv1/v2/v3/2;
!!en:;
!!if&y3=3:; Stars
!!DO55461/1/99/1:Pv1/v2/v3; Clean Creature Bank
!!CBv1/v2/v3:G0/249/9 G1/250/9 G2/251/9; First 3 slots of Guards
!!CBv1/v2/v3:G3/156/9 G4/157/9 G5/158/9; Next 3 slots of Lv7++
!!CBv1/v2/v3:G6/241/9 ;G7/254/9; Next 2 slots of Powerul Minions
!!FU55462&y99<65:Pv1/v2/v3/1 Pv1/v2/v3/1;
!!FU55462&y99>=65/y99<90:Pv1/v2/v3/2;
!!FU55462&y99>=90:Pv1/v2/v3/2;
!!en:;
!!if&y3=4:; Greed
!!DO55461/1/99/1:Pv1/v2/v3; Clean Creature Bank
!!CBv1/v2/v3:G0/134/29 G1/135/29 G2/132/29; First 3 slots of Dragons
!!CBv1/v2/v3:G0/151/29 G1/155/29 G2/154/29; Next 3 slots of Dragons
!!CBv1/v2/v3:G6/196/29; Next 1 slot of Dracoliches
!!FU55462&y99<65:Pv1/v2/v3/1 Pv1/v2/v3/1;
!!FU55462&y99>=65/y99<90:Pv1/v2/v3/2;
!!FU55462&y99>=90:Pv1/v2/v3/2;
!!en:;
But it still doesn't work :(... I need to find pointer to the structure containing the pointer. On ollydbg it works :P
|
|
majaczek
Supreme Hero
Work at Magic Dimmension
|
posted May 02, 2016 10:17 PM |
|
|
My Reverse Engineering on the topic
Quote:
35184372088831
--------------------------------------
!!VRy2:S4; Name PTR offset
!!VRy3:S56; Type Offset
!!VRy4:S60; Subtype Offset
!!VRy5:S20; Bits1 Offset
!!VRy6:S28; Bits2 Offset
!!VRy7:S36; Bits3 Offset
!!VRy8:S44; EnterMask Offset
!!VRy9:S68; Length in bytes of _Types_ structure
--------------------------------------
AVXprmd0.def
string
65f0a01 number hex
010a5f06 code hex
_types_ of AVXprmd0.def (ptr)
6984108 number hex
08419806 Code hex
_types_ of AVXprmd0.def (dump)
06 F0 AD BA 01 0A 5F 06 0C 00 00 00 1F 00 00 00
02 02 AD BA 00 00 00 00 C0 C0 00 00 FF FF FF FF
FF 3F 00 00 00 00 00 00 40 C0 00 00 00 00 00 00
00 80 00 00 02 00 00 00 3F 00 00 00 00 00 00 00
00 F0 FF FF
Pointed nowhere :(
looks like a stack - maybe +68?
698414C number hex
4c419806 Code Hex
pointed by 066d008c only (in memory map)
Guessed to be part of _Main_ structure
here is structure pattern
struct _Main_{
Dword _u1a; struct _Types_ *Tp0,*Tp1,*_u2a; // +00
Dword _u1b; struct _Position_ *Pp0,*Pp1,*_u2b; // +10
Dword _u1c[4]; // DEFы // +20
Dword _u1d; struct _ArtRes_ *Ap0,*Ap1,*_u2d; // +30
Dword _u1e; struct _Monster_ *Mp0,*Mp1,*_u2e; // +40
Dword _u1f; struct _Event_ *Ep0,*Ep1,*_u2f; // +50
Dword _u1g[4]; // +60
Dword _u1h[4]; // +70
Dword _u1i; struct _GlbEvent_ *GEp0,*GEp1,*_u2i; // +80
Dword _u1j; struct _CastleEvent_ *CEp0,*CEp1,*_u2j; // +90
Dword _u1k[4]; // +A0
Dword _u1l[4]; // +B0
Dword _u1m[4]; // +C0
struct _MapItem_ *MIp0; Dword MapSize; Dword _u1n[2]; // +D0
};
is 066d008c a main+4 or main+8 or main+12?
066d008c is 8c006d06 code :)
guessed +8 from the symetry
066d008c - 8 = 66D0084 number
code 84006d06
Can't find _Main_ address ... hopefully it is statically addressed.
Yeah
__asm{
mov eax,BASE
mov eax,[eax]
add eax,0x1FB70
mov Main,eax
}
#define BASE 0x699538
My new version of script which almost works
Quote:
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.10.5.945
ERMS_ScriptDate=2.5(May).2016
!#SN:W^Temple_SunMoon Enabled^/1;
!#TM1:S1/999/1/255; triggers every color every day
!#TM2:S1/999/1/255; same but triggers only *after* all calculations from TM1 are done
!?FU55442; initialization (called from Knightmare - Town Guardians
!?TM2;
!!VRy88:Sc; !!FU&y88>1:E;
!!FU55468:P;
!?FU55468;
!_!IF:M^FU55468 Function disabled it is not ready^; !_!FU:E;
For Blockmap
!!VRy31:S4294967295 S-1; !!VRy32:S8191;
000111111111111111111111111111111111111111111111
From objects txt
!!VRy35:S4294967295 S-1; !!VRy36:S24351;
010111110001111111111111111111111111111111111111
From objects txt
!!VRy50:S4294967295 S-1; !!VRy51:S7967;
000111110001111111111111111111111111111111111111
From objects txt
For entries
!!VRy38:S0; !!VRy39:S16384;
010000000000000000000000000000000000000000000000
From objects txt
!!DO55467/0/9999/1:P63/69/y31/y32/y38/y39;
!!DO55467/0/9999/1:P63/70/y31/y32/y38/y39;
!!DO55467/0/9999/1:P63/71/y31/y32/y38/y39;
!!DO55467/0/9999/1:P63/72/y31/y32/y38/y39;
!_#FU55468:P;
!?FU55467;
x1/x2 - type/subtype (use only existing ones)
x3/x4 - Bits3
x5/x6 - EnterMask
!!SN:W^Broken DEF patcher^/?y1; !!FU&y1>0:E;
!!VRy70:S6919480; 0x699538 (BASE from WoG Sources)
mov eax,BASE
mov eax,[eax]
add eax,0x1FB70
mov Main,eax
!!UN:Cy70/4/?y71; !!VRy72:Sy71 +129904;
!_!VRy1:S111820656; Offset of _Types_ for Z358o11.def 63/69
(dynamic - sorry doesn't work)
!!VRy2:S4; Name PTR offset
!!VRy3:S56; Type Offset
!!VRy4:S60; Subtype Offset
!!VRy5:S20; Bits1 Offset
!!VRy6:S28; Bits2 Offset
!!VRy7:S36; Bits3 Offset
!!VRy8:S44; EnterMask Offset
!!VRy9:S68; Length in bytes of _Types_ structure
!!VRy99:Sy72 +8;
!_!VRy99:S107806860; 0x066d008c
; _Main_ + 8 ? something other ? Hope it works
!!UN:Cy99/4/?y98; y98 is a bottom of stack of _Types_
!_!VRy98:S110641484; 0x698414C
!!VRy1:Sy98 -y9; Hopefully
; Offset of _Types_ for AVXprmd0.def 63/0
!!VRy21:Sy1 +y3;
!!VRy22:Sy1 +y4;
!!UN:Cy21/4/?y23;
!!UN:Cy22/4/?y24;
!!if|y23<>63/y24<>0:;
!!IF:M^Cannot apply memory patch!
Address Don't Match! expected 63/0 got %Y23/%Y24^;
!!SN:W^Broken DEF patcher^/666;
!!FU:E;
!!en:;
!!VRy44:Sy9 *x16;
!!VRy50:Sy1 +y7 -y44; !!VRy51:Sy50 +4;
!!VRy55:Sy1 +y8 -y44; !!VRy56:Sy55 +4;
!!VRy21:Sy1 -y44 +y3;
!!VRy22:Sy1 -y44 +y4;
!!UN:Cy21/4/?y23;
!!UN:Cy22/4/?y24;
!!IF&x16=9999:M^Def Sprite for Object %X1/%X2 not Found^;
!!FU|x1<>y23/x2<>y24:E;
!!UN:Cy50/4/x3; !!UN:Cy51/4/x4;
!!UN:Cy55/4/x5; !!UN:Cy56/4/x6;
!!VRx16:S999999;
!!FU:E;
!!VRy50:+y9; !!VRy51:+y9;
!!VRy55:+y9; !!VRy56:+y9;
!!UN:Cy50/4/y35; !!UN:Cy51/4/y36;
!!UN:Cy55/4/y38; !!UN:Cy56/4/y39;
!?TM1; Replace objects with Temples
!!FU55466:P;
!?FU55466;
!!UN:P195/?y21; [Check if Replace Objects is enabled: y21=1 if yes]
!!FU&y21=0:E;
!!VRy1:Sc;
!!IF&y1>1:E;
!_!FU55463:P16/1/25/0/63/69/100;
!!FU55463:P16/1/25/2/63/69/100;
!_!FU55463:P16/1/25/0/63/54/100; Test
!_!FU55463:P16/1/25/0/63/69/100; Test
!_!FU55463:P16/1/25/2/-1/-1/100; Test
!_!IF:M^This Mod adds pillageable Temples^;
!_!UN:R6/250;
!?FU55464; Internal for FU55463
!!UN:Ux1/x2/-1/1; [get x/y/l of yellow square of object into v1-v3]
!_!IF:M^Try Replacing^;
!!VRy77:S0 R99; Dice
!!if&y77<x7:;
!_!UN:R6/50;
!_!IF:M^Replacing %X1 %X2 with %X3 %X4^;
!!VRx16:+1;
!!UN:Ov1/v2/v3;
!!if|x5<0/x6<0:;
!!UN:Iv1/v2/v3/x3/x4;
!!el:;
!!VRy99:S99;
!!if&x3=25/x4>0:;
!!VRy99:S25;
!!UN:Iv1/v2/v3/25/0/x5/x6;
!_!UN:Iv1/v2/v3/x5/x6;
!!VRy92:Sv2 -1;
!!VRy82:Sv2 -2;
!!VRy72:Sv2 -3;
!!VRy12:Sv2 +1;
!!VRy22:Sv2 +2;
!!VRy32:Sv2 +3;
!!VRy91:Sv1 -1;
!!VRy81:Sv1 -2;
!!VRy71:Sv1 -3;
!!VRy11:Sv1 +1;
!!VRy21:Sv1 +2;
!!VRy31:Sv1 +3;
!_!SN:W^Debug Marker %V1 %V2 %V3^/x4;
!_!SN:W^Debug Marker %Y91 %Y92 %V3^/666;
!_!SN:W^Debug Marker %Y91 %V2 %V3^/777;
!_!SN:W^Knightmare CreBank %Y91 %Y92 %V3^/x4;
!!SN:W^Knightmare CreBank %V1 %V2 %V3^/x4;
!!if&v1<v1:;
!_!IF:M^Boo !!!^;
!!TRv1 /v2 /v3:P0;
!!TRy81/v2 /v3:P0;
!_!TRy91/v2 /v3:E0 P1;
!!TRy81/v2 /v3:E1 P0;
!!TRv1 /y92/v3:E1 P0;
!_!TRy91/y92/v3:E1 P0;
!!TRy81/y92/v3:E1 P0;
!!en:;
!!if&v1<v1:;
!_!IF:M^Boo !!!^;
!!TRv1 /v2 /v3:E1 P1;
!!TRy91/v2 /v3:E0 P1;
!!TRy81/v2 /v3:E1 P1;
!!TRv1 /y92/v3:E1 P1;
!!TRy91/y92/v3:E1 P1;
!!TRy81/y92/v3:E1 P1;
!!en:;
!_!OBv1/v2/v3:T25;
!_!OBv1/v2/v3:Ux4;
!_!UN:R6/50;
!_!FU55457:P25/x4/v1/v2/v3;
!!OBv1/v2/v3:U?y77;
!_!IF:M^Subtype %Y77^;
!!en:;
!!UN&y99=99:Iv1/v2/v3/x3/x4/x5/x6;
!!en:;
!_!IF&x3=25/x4>0:M^Replaced %X1 %X2 with new CreBank^;
!!en:;
!?FU55463;
x1, x2 - Type and Subtype of Replaced object
x3, x4 - Type and Subtype of New Object
x5, x6 - Apperance of New Object
x7 - Percentage chance
!!UN:Ux1/x2/?v5; [objects number]
!!FU&v5<2:E; exit if < 2 objects
!!VRv5:-1;
!!DO55464/1/v5/1:Px1/x2/x3/x4/x5/x6/x7;
!_#TM81:S1/1/1/255; Once
!_?TM81; Fix new Creature Banks
!?HM-1;
!?TM1;
!!SN:W^Temple_SunMoon initialised^/?y1;
!!FU55465&y1=1:P;
!!SN&y1<9:W^Temple_SunMoon initialised^/d1;
!!SN:W^Debug Marker %V998 %V999 %V1000^/?y4;
!!IF&y4>0:M^Debug Marker %Y4^;
!?FU55465;
!!UN:U25/-1/?y-1; [Dragon Utopias number]
!!VRv1:S-1;
!!DO55457/1/y-1/1:P25/-1; [run through]
!!UN:U16/-1/?y-1; [creature banks number]
!_!VRv1:S-1;
!!DO55457/1/y-1/1:P16/-1; [run through]
!!FU:E; [don't run code below]
!!UN:U63/-1/?y-1; [WoG Objects number]
!!VRv1:S-1;
!!DO55457/1/y-1/1:P25/-1; [run through]
!_?OB16;
!_!FU:E;
!_!OBv998/v999/v1000:U?y1;
!_!SN:W^Last Creature Bank Subtype^/y1;
!_!OBv998/v999/v1000&y1>20:U0;
!_$OB16/0;
!_!FU:E;
!_!SN:W^Last Creature Bank Subtype^/?y1;
!_!OBv998/v999/v1000:Uy1;
!?OB25;
!!VRy92:Sv999 +0;
!!VRy91:Sv998 +1;
!!OBv998/v999/v1000:T?y1;
!!OBv998/v999/v1000:U?y2;
!!SN:W^Knightmare CreBank %Y91 %Y92 %V1000^/?y3;
!!IF:M^Dragon Utopia (%Y1/%Y2) Hidden: %Y3^;
!!FU:E;
!!HE-1:N?y9;
!!DO55460/0/6/1:Py9;
!?FU55462; Add Prize
x1/x2/x3 - Position of Crbank
x4 - Type of prize
1 small combo
2 big combo
3 grail
!!VRy1:S0 R99; Dice
!!CBx1/x2/x3&x4=3:A3/2;
!!if&x4=2:;
!!CBx1/x2/x3&y1>=0 /y1<5 :A3/134; PotDF
!!CBx1/x2/x3&y1>=5 /y1<12:A3/129; AA
!!CBx1/x2/x3&y1>=12/y1<24:A3/133; Legion
!!CBx1/x2/x3&y1>=24/y1<36:A3/126; Dragon Soul Orb
!!CBx1/x2/x3&y1>=36/y1<55:A3/108; Fanatic Courage
!!CBx1/x2/x3&y1>=55/y1<66:A3/162; SoDK
!!CBx1/x2/x3&y1>=66/y1<80:A3/161; Helm of Vision
!!CBx1/x2/x3&y1>=80/y1<90:A3/166; Broach of Wealth
!!CBx1/x2/x3&y1>=90 :A3/169; Boots of Rincewind
!!en:;
!!if&x4=1:;
!!FU55462&y1<10 :Px1/x2/x3/1 Px1/x2/x3/1; extra bonus
!!FU55462&y1>=95:Px1/x2/x3/1 Px1/x2/x3/1; extra bonus
!!CBx1/x2/x3&y1>=10/y1<15:A3/170;
!!CBx1/x2/x3&y1>=15/y1<20:A3/168;
!!CBx1/x2/x3&y1>=20/y1<25:A3/167;
!!CBx1/x2/x3&y1>=25/y1<30:A3/165;
!!CBx1/x2/x3&y1>=30/y1<35:A3/164;
!!CBx1/x2/x3&y1>=35/y1<40:A3/163;
!!CBx1/x2/x3&y1>=40/y1<45:A3/158;
!!CBx1/x2/x3&y1>=45/y1<50:A3/140;
!!CBx1/x2/x3&y1>=50/y1<55:A3/139;
!!CBx1/x2/x3&y1>=55/y1<60:A3/138;
!!CBx1/x2/x3&y1>=60/y1<65:A3/137;
!!CBx1/x2/x3&y1>=65/y1<70:A3/136;
!!CBx1/x2/x3&y1>=70/y1<75:A3/135;
!!CBx1/x2/x3&y1>=75/y1<80:A3/132;
!!CBx1/x2/x3&y1>=80/y1<85:A3/131;
!!CBx1/x2/x3&y1>=85/y1<90:A3/130;
!!CBx1/x2/x3&y1>=90/y1<95:A3/83;
!!en:;
!?FU55461; Clean
x1/x2/x3 - Position of Crbank
!!CBx1/x2/x3:A1/?y1;
!!CBx1/x2/x3&y1>0:A4/0;
!!if&x1=1:;
!!CBx1/x2/x3:G0/-1/0 G1/-1/0 G2/-1/0 G3/-1/0 G4/-1/0 G5/-1/0;
!!CBx1/x2/x3:G6/-1/0 G7/-1/0; Clean Guards Slots
!!CBx1/x2/x3:M-1/0; Clean Monster Prize
!!CBx1/x2/x3:R0/0 R1/0 R2/0 R3/0 R4/0 R5/0 R6/0;
!!en:;
!?FU55460;
x1 - Checked hero
x16 - Creature slot
!!FU&x1<0:E;
!!HEx1:C0/x16/?y1/?y2;
!!HEx1&y1>=243/y1<=251:C0/x16/-1/0;
!?FU55457;
x1 - Object type
x2 < 0 Default
x2 > 0 Custom
!!VRy3:S0;
!!if&x2<0:;
!!UN:Ux1/-1/?v5; [objects number]
!!FU&v5<2:E; exit if < 2 objects
!!UN:Ux1/-1/-1/1; [Creature Bank coordinates in v1/v2/v3]
!!OBv1/v2/v3:U?y2; [subtype]
!!el:;
!!IF:M^Custom CreBank^;
!!VRv1:Cx3/x4/x5; [Creature Bank coordinates in v1/v2/v3]
!!UN:Ux1/x2/?v5; [objects number]
!!FU&v5<2:E; exit if < 2 objects
!!VRy2:Sx2;
!!en:;
!_!OBv1/v2/v3&y2>20:U10; If new Creature Bank set type to Dragon Utopia
!!SN:W^Knightmare CreBank %V1 %V2 %V3^/?y77;
!!IF&y77>0:M^Marked new CreBank %Y77^;
!_!FU:E; Debug Exit
!!if&x1=16:; Any new type CRBANK
!!if&y2>20:;
!!VRy3:Sy2 -20;
!!el:;
!!VRy3:S0;
!!en:;
!!en:;
!!if&y77<=0:;
!!if&y2>0/x1=25:;
!!VRy3:Sy2;
!!en:;
!!el:;
!!VRy3&y77>0:Sy77;
!!en:;
!!FU&y3<=0:E;
!!VRy99:S0 R99; Dice
!!if&y3=1:; Moon
!!DO55461/1/99/1:Pv1/v2/v3; Clean Creature Bank
!!CBv1/v2/v3:G0/246/9 G1/247/9 G2/248/9; First 3 slots of Guards
!!CBv1/v2/v3:G3/153/9 G4/154/9 G5/155/9; Next 3 slots of Lv7++
!!CBv1/v2/v3:G6/235/9; G7/242/9; Next 2 slots of Powerul Minions
!!FU55462&y99<65:Pv1/v2/v3/1 Pv1/v2/v3/1;
!!FU55462&y99>=65/y99<90:Pv1/v2/v3/2;
!!FU55462&y99>=90:Pv1/v2/v3/2;
!!en:;
!!if&y3=2:; Sun
!!DO55461/1/99/1:Pv1/v2/v3; Clean Creature Bank
!!CBv1/v2/v3:G0/243/9 G1/244/9 G2/245/9; First 3 slots of Guards
!!CBv1/v2/v3:G3/150/9 G4/151/9 G5/152/9; Next 3 slots of Lv7++
!!CBv1/v2/v3:G6/253/9; G7/240/9; Next 2 slots of Powerul Minions
!!FU55462&y99<65:Pv1/v2/v3/1 Pv1/v2/v3/1;
!!FU55462&y99>=65/y99<90:Pv1/v2/v3/2;
!!FU55462&y99>=90:Pv1/v2/v3/2;
!!en:;
!!if&y3=3:; Stars
!!DO55461/1/99/1:Pv1/v2/v3; Clean Creature Bank
!!CBv1/v2/v3:G0/249/9 G1/250/9 G2/251/9; First 3 slots of Guards
!!CBv1/v2/v3:G3/156/9 G4/157/9 G5/158/9; Next 3 slots of Lv7++
!!CBv1/v2/v3:G6/241/9 ;G7/254/9; Next 2 slots of Powerul Minions
!!FU55462&y99<65:Pv1/v2/v3/1 Pv1/v2/v3/1;
!!FU55462&y99>=65/y99<90:Pv1/v2/v3/2;
!!FU55462&y99>=90:Pv1/v2/v3/2;
!!en:;
!!if&y3=4:; Greed
!!DO55461/1/99/1:Pv1/v2/v3; Clean Creature Bank
!!CBv1/v2/v3:G0/134/29 G1/135/29 G2/132/29; First 3 slots of Dragons
!!CBv1/v2/v3:G0/151/29 G1/155/29 G2/154/29; Next 3 slots of Dragons
!!CBv1/v2/v3:G6/196/29; Next 1 slot of Dracoliches
!!FU55462&y99<65:Pv1/v2/v3/1 Pv1/v2/v3/1;
!!FU55462&y99>=65/y99<90:Pv1/v2/v3/2;
!!FU55462&y99>=90:Pv1/v2/v3/2;
!!en:;
It is almost done :)
|
|
Hero_Of_Light
Responsible
Supreme Hero
|
posted May 03, 2016 12:39 PM |
|
|
Which script has advanced dwelling hints in it?
I want to edit this script because I changed the names of some of the WoG dwellings and I want to have the advanced dwelling hints to use the same names.
How can I do that?
____________
Not idly do the leaves of Lorien fall.
|
|
majaczek
Supreme Hero
Work at Magic Dimmension
|
posted May 03, 2016 04:00 PM |
|
Edited by majaczek at 16:48, 03 May 2016.
|
why this function doesn't work?
Quote:
!?FU55467;
x1/x2 - type/subtype (use only existing ones)
x3/x4 - Bits3
x5/x6 - EnterMask
x16 - Search Index
!!SN:W^Broken DEF patcher^/?y1; !!FU&y1>0:E;
!!VRy70:S6919480; 0x699538 (BASE from WoG Sources)
mov eax,BASE
mov eax,[eax]
add eax,0x1FB70
mov Main,eax
!!UN:Cy70/4/?y71; !!VRy72:Sy71 +129904;
!_!VRy1:S111820656; Offset of _Types_ for Z358o11.def 63/69
(dynamic - sorry doesn't work)
!!VRy2:S4; Name PTR offset
!!VRy3:S56; Type Offset
!!VRy4:S60; Subtype Offset
!!VRy5:S20; Bits1 Offset
!!VRy6:S28; Bits2 Offset
!!VRy7:S36; Bits3 Offset
!!VRy8:S44; EnterMask Offset
!!VRy9:S68; Length in bytes of _Types_ structure
!!VRy99:Sy72 +4;
!_!VRy99:S107806860; 0x066d008c
; _Main_ + 8 ? something other ? Hope it works
!!UN:Cy99/4/?y98; y98 is a bottom of stack of _Types_
!_!VRy98:S110641484; 0x698414C
!!VRy1:Sy98; -y9; Hopefully
; Offset of _Types_ for AVXprmd0.def 63/0
!!VRy21:Sy1 +y3;
!!VRy22:Sy1 +y4;
!!UN:Cy21/4/?y23;
!!UN:Cy22/4/?y24;
!_!if&v1>v1:; Disable security
!!if|y23<>47/y24<>0:;
!!IF:M^Cannot apply memory patch!
Address Don't Match! expected 47/0 got %Y23/%Y24
Pointer to structure is %Y1^;
!!SN:W^Broken DEF patcher^/666;
!!FU:E;
!!en:;
!_!en:;
!!VRy44:Sy9 *x16;
!!VRy50:Sy1 +y7 +y44; !!VRy51:Sy50 +4;
!!VRy55:Sy1 +y8 +y44; !!VRy56:Sy55 +4;
!!VRy21:Sy1 -y44 +y3;
!!VRy22:Sy1 -y44 +y4;
!!UN:Cy21/4/?y23;
!!UN:Cy22/4/?y24;
!!IF&x16=9999:M^Def Sprite for Object %X1/%X2 not Found^;
!!FU|x1<>y23/x2<>y24:E;
!!IF:M^Sprite DEF %X1/%X2 Patched^;
!!UN:Cy50/4/x3; !!UN:Cy51/4/x4;
!!UN:Cy55/4/x5; !!UN:Cy56/4/x6;
!!VRx16:S999999;
!!FU:E;
It should find the pointer to _Types_ structure from WoG Sources and use it as table to find object with "Type/subtype" as in x1/x2 and if found replace the 4 fields. Currently it seems it fails to find one (probably).
EDIT: Main structure has 3 types pointers (main+4 main+8 and main+12)
EDIT: Nevermind I found better algo in wog sources
Quote: int FindEnterShift(int t,int st,int *dx,int *dy,int silence/*=0*/)
{
#include "templ.h"
int i,j,k,num;
Dword tb;
_Types_ *tps,*tpe,*tp;
*dx=*dy=0;
__asm{
mov ebx,BASE
mov ebx,[ebx]
add ebx,0x1FB74
mov eax,[ebx]
mov tps,eax
mov eax,[ebx+4]
mov tpe,eax
}
num=tpe-tps;
for(i=0;i<num;i++){
tp=&tps;
if(tp->type!=t) continue;
if(tp->subtype!=st) continue;
// +0x14 - 6 байт маска рисования
// +0x24 - 6 байт маска тени
for(k=0;k<6;k++){
for(j=0;j<8;j++){
tb=0x80>>j;
if(tp->EnterMask[5-k]&tb){
*dx=j; *dy=k; RETURN(1)
}
}
}
// MError(""FindEnterShift"-cannot find entrance shift."); return; // не нащли вход
*dx=*dy=0; RETURN(1)
}
*dx=*dy=0;
if(silence==0) MError(""FindEnterShift"-cannot find type of object.");
RETURN(0) // нет такого типа
}
tps is address I wanted :)
|
|
majaczek
Supreme Hero
Work at Magic Dimmension
|
posted May 03, 2016 05:26 PM |
|
Edited by majaczek at 20:21, 03 May 2016.
|
So why IT Crashes?
Quote:
!?FU55468;
!_!IF:M^FU55468 Function disabled it is not ready^; !_!FU:E;
For Blockmap
!!VRy31:S4294967295 S-1; !!VRy32:S8191;
000111111111111111111111111111111111111111111111
From objects txt
!!VRy35:S4294967295 S-1; !!VRy36:S24351;
010111110001111111111111111111111111111111111111
From objects txt
!!VRy50:S4294967295 S-1; !!VRy51:S7967;
000111110001111111111111111111111111111111111111
From objects txt
For entries
!!VRy38:S0; !!VRy39:S16384;
010000000000000000000000000000000000000000000000
From objects txt
!!DO55467/0/9999/1:P63/69/y31/y32/y38/y39;
!!DO55467/0/9999/1:P63/70/y31/y32/y38/y39;
!!DO55467/0/9999/1:P63/71/y31/y32/y38/y39;
!!DO55467/0/9999/1:P63/72/y31/y32/y38/y39;
!_#FU55468:P;
!?FU55467;
x1/x2 - type/subtype (use only existing ones)
x3/x4 - Bits3
x5/x6 - EnterMask
x16 - Search Index
!!SN:W^Broken DEF patcher^/?y1; !!FU&y1>0:E;
__asm{
mov ebx,BASE
mov ebx,[ebx]
add ebx,0x1FB74
mov eax,[ebx]
mov tps,eax
mov eax,[ebx+4]
mov tpe,eax
}
num=tpe-tps;
//from WoG Sources - FindEnterShift
!!VRy70:S6919480; 0x699538 (BASE from WoG Sources)
!!UN:Cy70/4/?y71; [Base]
!!VRy73:Sy71 +129908; + 0x1FB74
!!UN:Cy73/4/?y74; y74 is tps
!!VRy75:Sy73 +4;
!!UN:Cy75/4/?y76; y76 is tpe
!!VRy77:Sy76 -y74; y77 is num
!!VRy1:Sy74;
!!IF&x16=y77:M^Def Sprite for Object %X1/%X2 not Found^;
!!FU&x16>=y77:E;
!!VRy2:S4; Name PTR offset
!!VRy3:S56; Type Offset
!!VRy4:S60; Subtype Offset
!!VRy5:S20; Bits1 Offset
!!VRy6:S28; Bits2 Offset
!!VRy7:S36; Bits3 Offset
!!VRy8:S44; EnterMask Offset
!!VRy9:S68; Length in bytes of _Types_ structure
!!VRy21:Sy1 +y3; +y9;
!!VRy22:Sy1 +y4; +y9;
!!UN:Cy21/4/?y23;
!!UN:Cy22/4/?y24;
!!if|y23<>71/y24<>0:;
!!IF:M^Cannot apply memory patch!
Address Don't Match! expected 71/0 got %Y23/%Y24
Pointer to structure is %Y1^;
!!SN:W^Broken DEF patcher^/666;
!!FU:E;
!!en:;
!!VRy44:Sy9 *x16;
!!VRy50:Sy1 +y7 +y44; !!VRy51:Sy50 +4;
!!VRy55:Sy1 +y8 +y44; !!VRy56:Sy55 +4;
!!VRy21:Sy1 +y44 +y3;
!!VRy22:Sy1 +y44 +y4;
!!UN:Cy21/4/?y23;
!!UN:Cy22/4/?y24;
!_!IF:M^Pause^;
!!FU|x1<>y23/x2<>y24:E;
!!IF:M^Sprite DEF %X1/%X2 Patched^;
!!UN:Cy50/4/x3; !!UN:Cy51/4/x4;
!!UN:Cy55/4/x5; !!UN:Cy56/4/x6;
!!VRx16:S999999;
!!FU:E;
!_?FU55442; initialization (called from Knightmare - Town Guardians
!?TM1;
!!VRy88:Sc; !!FU&y88>1:E;
!?PI;
!!FU55468:P;
EDIT: Fixed Typo :) hope now works
EDIT: :( NOPE
EDIT: I Surrender. I would do it ugly - I would use replacement of WoG objects files :P
|
|
Salamandre
Admirable
Omnipresent Hero
Wog refugee
|
posted May 03, 2016 08:39 PM |
|
|
Hol, 54 wog - enhanced dwelling hint text.ert
|
|
majaczek
Supreme Hero
Work at Magic Dimmension
|
posted May 03, 2016 09:23 PM |
|
|
I found why it didn't work I needed to pass offset to yellow square not to begin of object Anyway replacing blockmaps of default objects via text files works
|
|
Hero_Of_Light
Responsible
Supreme Hero
|
posted May 03, 2016 11:31 PM |
|
|
Thanks but I don't see how I can change the dwelling names, it is not in the script. The script uses variables that seem to be stored somewhere else.
____________
Not idly do the leaves of Lorien fall.
|
|
Salamandre
Admirable
Omnipresent Hero
Wog refugee
|
posted May 03, 2016 11:33 PM |
|
|
|
Hero_Of_Light
Responsible
Supreme Hero
|
posted May 03, 2016 11:58 PM |
|
|
Oh, and I was wondering what the ERT was
Thanks, I'll give it a try!
____________
Not idly do the leaves of Lorien fall.
|
|
Salamandre
Admirable
Omnipresent Hero
Wog refugee
|
posted May 04, 2016 02:00 PM |
|
|
hawaiing, do you know a way to give fearless ability (no fear) to a creature, but without using !!EA?
Like sharpshooters which have it hardcoded.
|
|
majaczek
Supreme Hero
Work at Magic Dimmension
|
posted May 04, 2016 04:40 PM |
|
|
I may know but with using ERM_Hooker Plugin
But currently I am busy with New Creature Banks
|
|
Hawaiing
Adventuring Hero
|
posted May 04, 2016 04:55 PM |
|
|
Salamandre said: hawaiing, do you know a way to give fearless ability (no fear) to a creature, but without using !!EA?
Like sharpshooters which have it hardcoded.
erm_hooker.era is powerful!
PS:173#Santa Gremlin has fearless ability?!!
!?BA0;
!!FU111143:P0;
!?BA1;
!!FU111143:P1;
!?FU111143;
!!SN:L^EraPluginserm_hooker.era^/?y1 Ay1/^SetHook^/?y2 Ay1/^UnsetHook^/?y3;
!!SN&x1=0:Ey2/1/7734401/111144; hook at 760481 => FU111144
!!SN&x1=1:Ey3/1/7734401;
!?FU111144;
!!UN:C42149280/4/?y1;
!!UN:C6919200/4/?y10;
!!VRy31:Sy1-y10-21708:1352;
!!VRy32:Sy1-y10-21708%1352;
!!FU|y32<>0/y31<0/y31>41:E;[y31=STACK_ID]
!!BMy31:T?y33;
!!FU777724:Py31/y33/?y100;
!!FU&y100<>1:E;
!!SN:X?y1/0;
!!VRy99:Sy1+32;
!!UN:Cy99/4/7734480;
!?FU777724;[FU_Trigger]
*x1=STACK_ID,x2=BM:T,x3=?var =1 fearless, <>1 nothing happen
!!VRx3:S0;[default=0]
!_!IF:M^X1=%X1 X2=%X2^;
*put your code here*
*example1
!!VRx3&x2=136:S1; [136#Enchanter fearless]
*example2
!!VRx3&x1=0:S1;[0#STACK fearless]
|
|
majaczek
Supreme Hero
Work at Magic Dimmension
|
posted May 04, 2016 05:28 PM |
|
Edited by majaczek at 18:12, 04 May 2016.
|
HI!
I have a script which works for me (requires replaced objects and text files), but while it operates properly on map-placed "Temples" it gives all random temples same type of guards... (but it anyway look like random), it seems I did some ugly typo or something... could anybody help?
Here is a code:
Quote: 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.10.5.945
ERMS_ScriptDate=4.5(May).2016
!#SN:W^Temple_SunMoon Enabled^/1;
!#TM1:S1/999/1/255; triggers every color every day
!#TM2:S1/999/1/255; same but triggers only *after* all calculations from TM1 are done
!_?FU55442; initialization (called from Knightmare - Town Guardians
!?TM1;
!!VRy88:Sc; !!FU&y88>1:E;
!?PI;
!_!FU55468:P;
!?TM2; Replace objects with Temples
!!VRy88:Sc; !!FU&y88>1:E;
!!FU55466:P;
!?FU55466;
!!UN:P195/?y21; [Check if Replace Objects is enabled: y21=1 if yes]
!!FU&y21=0:E;
!_!FU55463:P16/1/25/0/63/70/100/0/1/0;
!!FU55463:P16/1/25/1/63/69/100/3/1/0; Dwarven Treasuries
!!FU55463:P213/0/25/1/63/69/100/3/1/0; Freelancers Guilds
!!FU55463:P4/0/25/1/63/69/100/3/1/0; Arenas
!_!FU55463:P16/1/25/0/63/54/100/0/1/0; Test
!_!FU55463:P16/1/25/0/63/69/100/0/1/0; Test
!_!FU55463:P16/1/25/2/-1/-1/100/0/1/0; Test
!_!IF:M^This Mod adds pillageable Temples^;
!_!UN:R6/250;
!?FU55463;
x1, x2 - Type and Subtype of Replaced object
x3, x4 - Type and Subtype of New Object
x5, x6 - Apperance of New Object
x7 - Percentage chance
x8 - Additional Dice
x9, x10 - Entry Shift
!!UN:Ux1/x2/?y55; [objects number]
!!FU&y55<2:E; exit if < 2 objects
!_!VRy55:-2;
!!VRv1:S-1;
!!DO55464/1/y55/1:Px1/x2/x3/x4/x5/x6/x7/x8/x9/x10;
!?FU55464; Internal for FU55463
!!UN:Ux1/x2/?y55; [objects number]
!!FU&y55<2:E; exit if no objects
!!UN:Ux1/x2/-1/1; [get x/y/l of yellow square of object into v1-v3]
!_!IF:M^Try Replacing^;
!!VRy77:S0 R99; Dice
!!VRy99:S0 Rx8;
!!VRy44:Sx4 +y99; !!VRy66:Sx6 +y99;
!!if&y77<x7:;
!_!UN:R6/50;
!_!VRx16:+1;
!_!IF:M^Replacing %X1 %X2 with %X3 %Y44^;
!!UN:Ov1/v2/v3;
!!if|x5<0/x6<0:;
!!UN:Iv1/v2/v3/x3/y44;
!!el:;
!!VRy99:S99;
!!if&x3=25/y44>0:;
!!VRy99:S25;
!!VRy77:Sv1 +x9;
!!VRy88:Sv2 +x10;
!!UN:Iy77/y88/v3/25/0/x5/y66;
!_!UN:Iv1/v2/v3/x5/y66;
!_!OBv1/v2/v3:Ux4;
!!VRy92:Sv2 -1;
!!VRy82:Sv2 -2;
!!VRy72:Sv2 -3;
!!VRy12:Sv2 +1;
!!VRy22:Sv2 +2;
!!VRy32:Sv2 +3;
!!VRy91:Sv1 -1;
!!VRy81:Sv1 -2;
!!VRy71:Sv1 -3;
!!VRy11:Sv1 +1;
!!VRy21:Sv1 +2;
!!VRy31:Sv1 +3;
!_!SN:W^Debug Marker %V1 %V2 %V3^/x4;
!_!SN:W^Debug Marker %Y91 %Y92 %V3^/666;
!_!SN:W^Debug Marker %Y91 %V2 %V3^/777;
!_!SN:W^Knightmare CreBank %Y91 %Y92 %V3^/x4;
!!SN:W^Knightmare CreBank %V1 %V2 %V3^/y44;
!_!OBv1/v2/v3:T25;
!_!OBv1/v2/v3:Uy44;
!_!UN:R6/50;
!_!FU55457:P25/y44/v1/v2/v3;
!_!OBv1/v2/v3:T?y95 U?y96;
!_!IF:M^Type %Y95 Subtype %Y96^;
!!en:;
!!UN&y99=99:Iy77/y88/v3/x3/y44/x5/y66;
!!en:;
!_!IF&x3=25/x4>0:M^Replaced %X1 %X2 with new CreBank^;
!!en:;
!_#TM81:S1/1/1/255; Once
!_?TM81; Fix new Creature Banks
!?HM-1;
!_?TM2;
!!SN:W^Temple_SunMoon initialised^/?y1;
!!FU55465&y1=0:P;
!!SN&y1<9:W^Temple_SunMoon initialised^/d1;
!!FU:E;
!!SN:W^Debug Marker %V998 %V999 %V1000^/?y4;
!!IF&y4>0:M^Debug Marker %Y4^;
!?FU55465;
!!UN:U25/-1/?y11; [Dragon Utopias number]
!!VRv1:S-1;
!!DO55457/1/y11/1&y11>1:P25/-1; [run through]
!!FU:E; [don't run code below]
!!UN:U16/-1/?y11; [creature banks number]
!!VRv1:S-1;
!!DO55457/1/y11/1&y11>1:P16/-1; [run through]
!!UN:U63/-1/?y11; [WoG Objects number]
!!VRv1:S-1;
!!DO55457/1/y11/1&y11>1:P25/-1; [run through]
!_?OB16;
!_!FU:E;
!_!OBv998/v999/v1000:U?y1;
!_!SN:W^Last Creature Bank Subtype^/y1;
!_!OBv998/v999/v1000&y1>20:U0;
!_$OB16/0;
!_!FU:E;
!_!SN:W^Last Creature Bank Subtype^/?y1;
!_!OBv998/v999/v1000:Uy1;
!?OB25;
!_!VRy92:Sv999 +1;
!_!VRy91:Sv998 +1;
!!OBv998/v999/v1000:T?y1;
!!OBv998/v999/v1000:U?y2;
!_!SN:W^Knightmare CreBank %Y91 %Y92 %V1000^/?y77;
!!SN:W^Knightmare CreBank %V998 %V999 %V1000^/?y77;
!_!IF:M^Dragon Utopia (%Y1/%Y2 Hidden: %Y77) at %V998/%V999/%V1000^;
!!FU:E;
!!HE-1:N?y9;
!!DO55460/0/6/1:Py9;
!?CM0;
!!CM:I?y99; !!FU&y99<>37:E;
!!CM:P?y1/?y2/?y3;
!!SN:W^Knightmare CreBank %Y1 %Y2 %Y3^/?y77;
!_!IF&y77>0:M^Here is Crebank Marker No %Y77 at %V998/%V999/%V1000^;
!?FU55462; Add Prize
x1/x2/x3 - Position of Crbank
x4 - Type of prize
1 small combo
2 big combo
3 grail
!!VRy1:S0 R99; Dice
!!CBx1/x2/x3&x4=3:A3/2;
!!if&x4=2:;
!!CBx1/x2/x3&y1>=0 /y1<5 :A3/134; PotDF
!!CBx1/x2/x3&y1>=5 /y1<12:A3/129; AA
!!CBx1/x2/x3&y1>=12/y1<24:A3/133; Legion
!!CBx1/x2/x3&y1>=24/y1<36:A3/126; Dragon Soul Orb
!!CBx1/x2/x3&y1>=36/y1<55:A3/108; Fanatic Courage
!!CBx1/x2/x3&y1>=55/y1<66:A3/162; SoDK
!!CBx1/x2/x3&y1>=66/y1<80:A3/161; Helm of Vision
!!CBx1/x2/x3&y1>=80/y1<90:A3/166; Broach of Wealth
!!CBx1/x2/x3&y1>=90 :A3/169; Boots of Rincewind
!!en:;
!!if&x4=1:;
!!FU55462&y1<10 :Px1/x2/x3/1 Px1/x2/x3/1; extra bonus
!!FU55462&y1>=95:Px1/x2/x3/1 Px1/x2/x3/1; extra bonus
!!CBx1/x2/x3&y1>=10/y1<15:A3/170;
!!CBx1/x2/x3&y1>=15/y1<20:A3/168;
!!CBx1/x2/x3&y1>=20/y1<25:A3/167;
!!CBx1/x2/x3&y1>=25/y1<30:A3/165;
!!CBx1/x2/x3&y1>=30/y1<35:A3/164;
!!CBx1/x2/x3&y1>=35/y1<40:A3/163;
!!CBx1/x2/x3&y1>=40/y1<45:A3/158;
!!CBx1/x2/x3&y1>=45/y1<50:A3/140;
!!CBx1/x2/x3&y1>=50/y1<55:A3/139;
!!CBx1/x2/x3&y1>=55/y1<60:A3/138;
!!CBx1/x2/x3&y1>=60/y1<65:A3/137;
!!CBx1/x2/x3&y1>=65/y1<70:A3/136;
!!CBx1/x2/x3&y1>=70/y1<75:A3/135;
!!CBx1/x2/x3&y1>=75/y1<80:A3/132;
!!CBx1/x2/x3&y1>=80/y1<85:A3/131;
!!CBx1/x2/x3&y1>=85/y1<90:A3/130;
!!CBx1/x2/x3&y1>=90/y1<95:A3/83;
!!en:;
!?FU55461; Clean
x1/x2/x3 - Position of Crbank
!!CBx1/x2/x3:A1/?y1;
!!CBx1/x2/x3&y1>0:A4/0;
!!if&x16=1:;
!!CBx1/x2/x3:G0/-1/0 G1/-1/0 G2/-1/0 G3/-1/0 G4/-1/0 G5/-1/0;
!!CBx1/x2/x3:G6/-1/0 G7/-1/0; Clean Guards Slots
!!CBx1/x2/x3:M-1/0; Clean Monster Prize
!!CBx1/x2/x3:R0/0 R1/0 R2/0 R3/0 R4/0 R5/0 R6/0;
!!en:;
!?FU55460;
x1 - Checked hero
x16 - Creature slot
!!FU&x1<0:E;
!!HEx1:C0/x16/?y1/?y2;
!!HEx1&y1>=243/y1<=251:C0/x16/-1/0;
!?FU55457;
x1 - Object type
x2 < 0 Default
x2 > 0 Custom
!!VRy3:S0;
!!if&x2<0:;
!!UN:Ux1/-1/-1/1; [Creature Bank coordinates in v1/v2/v3]
!!OBv1/v2/v3:U?y2; [subtype]
!_!IF:M^Custom Utopia/CreBank %X1/%Y2^;
!!en:;
!!if&x2>0:;
!_!IF:M^Custom Utopia/CreBank %X1/%X2^;
!!VRv1:Cx3/x4/x5; [Creature Bank coordinates in v1/v2/v3]
!!VRy2:Sx2;
!!en:;
!!if&x2=0:;
!!UN:Ux1/-1/-1/1; [Creature Bank coordinates in v1/v2/v3]
!!VRy2:Sx2;
!!en:;
!_!OBv1/v2/v3&y2>20:U10; If new Creature Bank set type to Dragon Utopia
!!SN:W^Knightmare CreBank %V1 %V2 %V3^/?y77;
!_!IF&y77>0:M^Marked new CreBank %Y77^;
!_!FU:E; Debug Exit
!!if&x1=16:; Any new type CRBANK
!!if&y2>20:;
!!VRy3:Sy2 -20;
!!el:;
!!VRy3:S0;
!!en:;
!!en:;
!!if&y2>0/x1=25:;
!!VRy3:Sy2;
!!en:;
!!VRy3&y77>0:Sy77;
!_!IF:M^y2=%Y2 y3=%Y3 y77=%Y77^;
!_!IF&y3<>y77/y77>0:M^y2=%Y2 y3=%Y3 y77=%Y77^;
!_!IF&y77>0:M^y2=%Y2 y3=%Y3 y77=%Y77^;
!!FU&y3<=0:E;
!!VRy99:S0 R99; Artifact Reward Dice
!!if&y3=1:; Moon
!!DO55461/1/99/1:Pv1/v2/v3; Clean Creature Bank
!!CBv1/v2/v3:G0/246/9 G1/247/9 G2/248/9; First 3 slots of Guards
!!CBv1/v2/v3:G3/153/9 G4/154/9 G5/155/9; Next 3 slots of Lv7++
!!CBv1/v2/v3:G6/235/9; G7/242/9; Next 2 slots of Powerul Minions
!!FU55462&y99<65:Pv1/v2/v3/1 Pv1/v2/v3/1;
!!FU55462&y99>=65/y99<90:Pv1/v2/v3/2;
!!FU55462&y99>=90:Pv1/v2/v3/3;
!!en:;
!!if&y3=2:; Sun
!_!IF&y77>0:M^Artificial Sun^;
!!DO55461/1/99/1:Pv1/v2/v3; Clean Creature Bank
!!CBv1/v2/v3:G0/243/9 G1/244/9 G2/245/9; First 3 slots of Guards
!!CBv1/v2/v3:G3/150/9 G4/151/9 G5/152/9; Next 3 slots of Lv7++
!!CBv1/v2/v3:G6/253/9; G7/240/9; Next 2 slots of Powerul Minions
!!FU55462&y99<65:Pv1/v2/v3/1 Pv1/v2/v3/1;
!!FU55462&y99>=65/y99<90:Pv1/v2/v3/2;
!!FU55462&y99>=90:Pv1/v2/v3/3;
!!en:;
!!if&y3=3:; Stars
!!DO55461/1/99/1:Pv1/v2/v3; Clean Creature Bank
!!CBv1/v2/v3:G0/249/9 G1/250/9 G2/251/9; First 3 slots of Guards
!!CBv1/v2/v3:G3/156/9 G4/157/9 G5/158/9; Next 3 slots of Lv7++
!!CBv1/v2/v3:G6/241/9 ;G7/254/9; Next 2 slots of Powerul Minions
!!FU55462&y99<65:Pv1/v2/v3/1 Pv1/v2/v3/1;
!!FU55462&y99>=65/y99<90:Pv1/v2/v3/2;
!!FU55462&y99>=90:Pv1/v2/v3/3;
!!en:;
!!if&y3=4:; Greed
!!DO55461/1/99/1:Pv1/v2/v3; Clean Creature Bank
!!CBv1/v2/v3:G0/134/29 G1/135/29 G2/132/29; First 3 slots of Dragons
!!CBv1/v2/v3:G0/151/29 G1/155/29 G2/154/29; Next 3 slots of Dragons
!!CBv1/v2/v3:G6/196/29; Next 1 slot of Dracoliches
!!FU55462&y99<65:Pv1/v2/v3/1 Pv1/v2/v3/1;
!!FU55462&y99>=65/y99<90:Pv1/v2/v3/2;
!!FU55462&y99>=90:Pv1/v2/v3/3;
!!en:;
:)
|
|
|