Народ, помогите со скриптом с героев. Он прописывает Wogификацию карты и не разрешает стрить Грааль в сопряжении. Кто-нибудь может помочь как снять этот запрет? А то у меня не получается. Вот скрипт. Помогите плиз
CODE
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. 2003.2.13.2353
WoGify Name: script01.erm
WoGify ERM code: 101 (0-4) plus 111-130 (0-1) for individual rules
101 code value:
0=choose map rules each game
1=use rules selected in options dialogue
2=use two random map rules
3=use two random map rules from those selected in options dialogue
4=disable all map rules
** Map Rules ERM script v1.9 - Donald X. Vaccarino
** Requires WOG version 3.55 or later
** Adds rules to a map on day one
** Several rules were suggested by Timothy Pulver
** WoGify Options editing by Timothy Pulver
** Rules: (Number in parenthesis is ERM code)
** 1. Fliers can't fly but instead aren't retaliated against. (111)
** 2. Monster speed is inverted. (112)
** 3. Monsters are half price on 7th day of week. (113)
** 4. Heroes create magic plains each day. (114)
** 5. All monsters attack twice. (115)
** 6. Monster stacks in hero armies grow by 4% each day, to 10000 max. (116)
** 7. Most dwellings also have boars. (117)
** 8. Heroes start at 5th level (+5000 experience). (118)
** 9. Heroes pick up double artifacts. (119)
** 10. Perpetual darkness. (120)
** 11. Heroes have double movement. (121)
** 12. Mines change resources once/week. (122)
** 13. +1 places can be revisited each month. (123)
** 14. Heroes get 9th-10th skills. (124)
** 15. A hero's upgraded 7th level monsters automatically become 8th level. (125)
** 16. Heroes gain an artifact each level. (126)
** 17. Rogues attack heroes at random. (127)
** 18. All creatures have a breath weapon. (128)
** 19. Shooters can't shoot but instead have +50% hit points. (129)
** 20. All towns have a grail (only used if no confluxes on map) (130)
** To use this code, put it into a Global Event, set to never happen.
** Make sure this event is prior to other events that may be affected by it.
** Variables Used: w46, z280-z299, z326-z328, z332-z354, v1-v4, v549-v559,
v564-v579, v600-v602, v610-v639, v700-v739, v1219, v1262
** Flags Used: 1-3, 875
** Functions Used: 690-726
** Timers Used: 84 (was 72)
** Variables w46, v549-v559, v572-v579, z280-z299, and z332-z354 must not be modified by other programs!
** functions for use during initialization
** see if player x16 is with player x1 on team x2, if not use for their shroud
!?FU719;
!!OW:Tx16/?y1; [get team number if any]
!!VRy1&y1=-1:S-2; [treat no team as not the same team]
!!VRvv600&x1<>x16/x2<>y1:Sx16; [store player number if usable for shroud-placing]
** find nonteammate for player x16
!?FU720;
!!VRv600:S564 +x16; [number of variable holding non-teammate]
!!VRvv600:Sx16; [default for 8-player-team game]
!!OW:Tx16/?y1; [get team number if any]
!!DO719/0/7/1:Px16/y1; [check each player for not being on this team]
** end of initialization functions
** Initialization Code
!#VRv1:S0; [make sure v1 starts as 0]
!#UN:P101/?v1; [check wogify options number - 4 means no rules]
!#TM84&v1<>4:S1/999/1/255; [timer every day for all players]
!#VRv579:S0; [first 10 bits of rules - none chosen yet]
!#VRv578:S0; [previous day in game]
!#VRv577:S0; [creatures are normal price]
!#VRv576:S0; [second 10 bits of rules - none chosen yet]
!#UN:X?v574/?v575; [get size/underground]
!#VRv573:Sv574 :2; [get half of size = middle of map]
!#VRv572:S0; [day of last rogue attack]
!#VRv550:C1/2/4/8/16/32/64/128/256/512; [bit table]
!#VRz332:S^Летающие не могут летать, но им не отвечают.^; [rule names for menu/papyrus]
!#VRz333:S^Инвертированная скорость монстров.^;
!#VRz334:S^В 7й день недели монстры вполовину дешевле.^;
!#VRz335:S^Герои каждый день создают магич. равнины.^;
!#VRz336:S^Все монстры атакуют дважды.^;
!#VRz337:S^Армии героев растут на 4% в день.^;
!#VRz338:S^Большинство вн. жилищ продают и кабанов.^;
!#VRz339:S^Герои стартуют на 5-м уровне.^;
!#VRz340:S^Герои поднимают двойные артефакты.^;
!#VRz341:S^Постоянная тьма скрывает карту.^;
!#VRz342:S^Герои ходят в два раза дальше.^;
!#VRz343:S^Шахты меняют ресурсы каждую неделю.^;
!#VRz344:S^Одноразовые места доступны в новый месяц.^;
!#VRz345:S^Герои могут иметь 9й-10й навыки.^;
!#VRz346:S^В армии героя ул. монстры 7 --> 8 ур.^;
!#VRz347:S^Герои с каждым уровнем получают артефакт.^;
!#VRz348:S^Воры случайным образом атакуют героев.^;
!#VRz349:S^Все твари бьют на две клетки.^;
!#VRz350:S^Стрелки не стреляют, но имеют +50% здоровья.^;
!#VRz351:S^Грааль во всех городах (если не Сопряжение).^;
!#DO720/0/7/1&v1<>4:P; [find an enemy for each player, for Perpetual Darkness]
** end of Initialization Code
** Timer routine
!?TM84;
!!VRv1:S0; [make sure v1 starts as 0]
!!UN:P101/?v1; [check wogify options number - 4 means no rules]
!?TM84&v1<>4; [Continue timer only if map rules aren't disabled in wogify options]
!!VRy1:Sc0; [get day of game]
!!VRy2:Sy1 %7; [get day of week in y2]
!!VRy3:S0;
!!VRy3&y1<>v578:S1; [y3=1 if this is the first human turn on this day]
!!VRv578:Sy1; [store day]
!!VRy4:Sy1 %28; [day of month]
!!FU690&y1=1/y3=1:P; [choose rules and implement some]
!!VRv600:S0; [flag for 1st rule announced]
!!DO691/1/20/1&1000/y1=1/y3<>1:P; [announce rules to humans after 1st player on day 1]
!!FU709:P3; [check for rule 3]
!!VRy5:S0; [assume creatures should be normal price]
!!VRy5&3/-1000:S1; [for AI with this rule they're always half price]
!!VRy5&3/1000/y2=0:S1; [for humans just half price on sunday]
!!DO694/0/173/1&y5=1/v577=0:P; [make creatures half price when needed]
!!DO695/0/173/1&y5=0/v577=1:P; [make creatures double price when needed]
!!VRv577:Sy5; [remember whether creatures currently are normal or half price]
!!FU709:P6; [check for rule 6]
!!DO699/0/155/1&3:P; [grow hero monster stacks by 5%]
!!FU709:P8; [check for rule 8]
!!OW:C?y5; [get current player]
!!DO702/0/155/1&3/y1=1:Py5; [upgrade this player's heroes to 5th level on day 1]
!!FU709:P11; [check for rule 11]
!!DO703/0/155/1&3:P; [double hero movement]
!!FU709:P12; [check for rule 12]
!!UN&3/y2=1/y3=1/y1<>1:U53/-1/?y1; [count mines]
!!DO706/1/y1/1&3/y2=1/y3=1/y1<>1:P; [change mine production once/week]
!!FU709:P13; [check for rule 13]
!!DO704/0/155/1&3/y4=1/y1<>1:P; [clear learning stones etc. on day 1 of month]
!!FU709:P4; [check for rule 4]
!!DO696/0/155/1&3:P; [create magic plains by today's heroes]
!!FU709:P15; [check for rule 15]
!!DO697/0/155/1&3:P; [upgraded 7th level creatures become 8th for all heroes]
!!FU709:P10; [check for rule 10]
!!OW:C?y6; [get current player]
!!OW:Iy6/?y5; [get AI 1 or human 0]
!!UN&3/y5=1:Sv573/v573/0/y6/v574; [reveal entire map, surface]
!!UN&3/y5=1/v575=1:Sv573/v573/1/y6/v574; [reveal entire map, underground]
!!FU721&3/y5=0:Py6; [replace shroud for human, to handle AI teammate]
!!UN&3/y5=0:R1; [redraw screen]
** end of timer routine
** function to choose rules and implement rules that only take effect at start
!?FU690;
!!VRv1:S0; [make sure v1 starts as 0]
!!VRv2:S0; [make sure v2 starts as 0]
!!VRv3:S0; [make sure v3 starts as 0]
!!VRv4:S0; [make sure v4 starts as 0]
!!VRv579:S0; [initialize map rules page 1 to none selected]
!!VRv576:S0; [intialize map rules page 2 to none selected]
!!UN:P101/?v1; [check wogify options number: 0=choose rules each game ]
[ 1=use rules selected in wogify options ]
[ 2=means random,3=random from selected,4=disable]
!!IF:V2/0; [Clear flag 2]
!!IF&v1<>2:V2/1; [If v1=2 use random rules]
!!VRz326&2/v1=0:S^Отметьте правила этой игры - на ваш выбор (список 1 из 2).^;
!!IF&2/v1=0:G0/579/0/326/332/333/334/335/336/337/338/339/340/341; [get bit choices in v579]
!!VRz326&2/v1=0:S^Отметьте правила этой игры - на ваш выбор (список 2 из 2).^;
!!IF&2/v1=0:G0/576/0/326/342/343/344/345/346/347/348/349/350/351; [get bit choices in v576]
[Use Map Rules selected in WoGify if this option was chosen]
!!DO723/111/120/1&v1=1:P; [set v579]
!!DO724/121/130/1&v1=1:P; [set v576]
!!UN|-2/v1=3:U98/8/?y1; [count confluxes]
!!VRy2|-2/v1=3:S18; [normally 19 rules]
!!VRy2&-2/y1=0:S19; [20 rules if no confluxes]
!!VRy2&v1=3/y1=0:S19; [20 rules if no confluxes]
!!VRy3&-2:S1 Ry2; [pick a random rule]
!!VRy4&-2:S1 Ry2; [pick another one]
!!VRy4&-2/y3=y4:S1 Ry2; [if the same, try again]
!!VRy4&-2/y3=y4:S1 Ry2; [if the same, try again]
!!VRy4&-2/y3=y4:S1 Ry2; [if the same, try again, just one rule if still the same]
!!DO725/1/100/1&v1=3:Py2; [get 1st random rule from selected rules if that option was chosen]
!!DO726/1/100/1&v1=3:Py2; [get 2nd random rule from selected rules if that option was chosen]
!!VRy3&v1=3:Sv3; [random from selected rule 1]
!!VRy4&v1=3:Sv4; [random from selected rule 2]
!!FU722|-2/v1=3:Py3 Py4; [set the bits for our random rules]
!!DO718/1/20/1:P; [add papyrus messages for any rules that are active]
!!VRv600:S0; [flag for 1st rule announced]
!!DO691/1/20/1:P; [announce rules to first player, who is always human]
!!FU709:P1; [check for rule 1]
!!DO692/0/173/1&3:P; [fliers lose flying but can't be retaliated against]
!!FU709:P2; [check for rule 2]
!!VRv700:C25/21/18/15/13/11/9/7/6/5; [table of new monster speeds]
!!VRv710:C5/5/4/4/4/4/4/3/3/3;
!!DO693/0/173/1&3:P; [invert monster speeds]
!!FU709:P5; [check for rule 5]
!!DO698/0/173/1&3:P; [all monsters attack/shoot twice]
!!FU709:P7; [check for rule 7]
!!UN&3:U17/-1/?y1; [count dwellings]
!!DO701/1/y1/1&3:P; [add boars to dwellings]
!!FU709:P8; [check for rule 8]
!!DO702/0/155/1&3:P-1; [upgrade unowned heroes to 5th level]
!!FU709:P18; [check for rule 18]
!!DO715/0/173/1&3:P; [all monsters gain breath weapon]
!!FU709:P19; [check for rule 19]
!!DO716/0/173/1&3:P; [shooters lose shooting but gain +50% hit points]
!!FU709:P20; [check for rule 20]
!!UN&3:U98/-1/?y1; [count towns]
!!DO717/1/y1/1&3:P; [build grails in towns]
** end of function
** function to announce a rule to human players if set
!?FU691;
!!FU709:Px16; [check for rule x16]
!!VRz326:S^На этой странной земле, ^;
!!VRz326&v600=1:S^А еще, ^;
!!VRv600&3:S1;
!!IF&3/x16=1:M^%Z326нет летающих тварей, а тем, кто когда-то были летающими, теперь не отвечают.^;
!!IF&3/x16=2:M^%Z326медленные твари становятся быстрыми, а быстрые - медленными.^;
!!IF&3/x16=3:M^%Z326на 7й день недели твари стоят лишь половину своей обычной цены.^;
!!IF&3/x16=4:M^%Z326место, где герой стоит в начале дня 'обрастает' магической равниной.^;
!!IF&3/x16=5:M^%Z326все твари атакуют дважды (как крестоносцы или налетчики).^;
!!IF&3/x16=6:M^%Z326каждый отряд в армии героя увеличивает численность на 4% в день, стремясь к максимуму в 10000 тварей.^;
!!IF&3/x16=7:M^%Z326большинство внешних жилищ продают кабанов рядом со своим обычным ополчением.^;
!!IF&3/x16=8:M^%Z326герои стартуют на 5-м уровне (+5000 опыта).^;
!!IF&3/x16=9:M^%Z326герои каждый раз поднимают два одинаковых артефакта там, где на карте лежал один.^;
!!IF&3/x16=10:M^%Z326карта скрыта постоянной тьмой. Видимость сохраняется вокруг своих (и союзных) героев, замков и зданий.^;
!!IF&3/x16=11:M^%Z326каждый ход герои начинают с удвоенным количеством (от обычного) очков передвижения.^;
!!IF&3/x16=12:M^%Z326шахты меняют ресурсы каждую неделю.^;
!!IF&3/x16=13:M^%Z326каждый месяц можно заново посещать одноразовые объекты.^;
!!IF&3/x16=14:M^%Z326герои могут выучить 2 секретных навыка в дополнение к 8ми нормальным.^;
!!IF&3/x16=15:M^%Z326в армии героя улучшенные монстры 7го уровня автоматически улучшаются до 8го в начале дня.^;
!!IF&3/x16=16:M^%Z326каждый раз при повышении уровня герой получает артефакт.^;
!!IF&3/x16=17:M^%Z326шайки воров бродят по сельской местности (невидимы), готовые напасть на героя.^;
!!IF&3/x16=18:M^%Z326все твари бьют на две клетки (если не стреляют).^;
!!IF&3/x16=19:M^%Z326нет стреляющих тварей, а твари, бывшие такими когда-то имеют +50% очков здоровья.^;
!!IF&3/x16=20:M^%Z326все города имеют построенный Грааль (только если это не Сопряжение).^;
** end of function
** function to make monster x16 lose flying but gain no-retaliation if it flew
!?FU692;
!!MA:Xx16/?y1; [get flags]
!!VRy2:Sy1;
!!VRy2:&2; [just look at flying bit]
!!VRy1:&-3; [lose flying]
!!VRy1&y2=2:|65536; [can't be retaliated against]
!!MA&x16<145|x16>149:Xx16/y1; [save flags, except for war machines]
** end of function
** function to invert the speed of monster x16
!?FU693;
!!MA:Sx16/?y1; [get speed]
!!VRy2:S3; [default of 3 for very fast monsters]
!!VRy3:S700 +y1;
!!VRy2&y1<20:Svy3; [look up new speed]
!!MA&x16<145|x16>149:Sx16/y2; [set speed, except for war machines]
** end of function
** function to make monster x16 cost half as much
!?FU694;
!!MA:Cx16/6/?y1; [get gold cost]
!!VRy1::2; [half price]
!!MA&x16<145|x16>149:Cx16/6/y1; [save gold cost, except for war machines]
** end of function
** function to make monster x16 cost twice as much
!?FU695;
!!MA:Cx16/6/?y1; [get gold cost]
!!VRy1:*2; [double price]
!!VRy2:Sy1 %10; [check low digit of price]
!!VRy1&y2=4:+1; [turn 4's to 5's]
!!MA&x16<145|x16>149:Cx16/6/y1; [save gold cost, except for war machines]
** end of function
** function to place magic plains by current player's hero
!?FU696;
!!OW:C?y1; [get current player]
!!HEx16:O?y2; [get hero's owner]
!!HEx16:P?y3/?y4/?y5; [get hero x/y/l]
!!VRy3:+2;
!!VRy4:+1; [place so that hero is kind of in the middle]
!!TRy3/y4/y5:P?y6; [get y6=0 if red square]
!!TRy3/y4/y5:E?y7; [get y7=0 if yellow square]
!!TRy3/y4/y5:T?y8/d/d/d/d/d/d/d; [get terrain in y8, 8 = water]
!!UN&y1=y2/y5=0/y6<>0/y7<>0/y8<>8:Iy3/y4/y5/46/0; [place magic plains]
** end of function
** function to make hero's upgraded 7th level troops into 8th level
!?FU697;
!!OW:C?y1; [get current player]
!!HEx16:O?y2; [get hero's owner]
!!DO708/0/6/1&y1=y2:Px16; [check each slot]
** end of function
** function to make monster x16 attack/shoot twice
!?FU698;
!!MA:Xx16/?y1; [get flags]
!!VRy1:|32768; [set attack twice bit]
!!MA&x16<145|x16>149:Xx16/y1; [save flags, except for war machines]
** end of function
** function to make hero x16's monster stacks grow by 4%, to 10000
!?FU699;
!!OW:C?y1; [get current player]
!!HEx16:O?y2; [get hero's owner]
!!DO700/0/6/1&y1=y2:Px16; [handle each slot if it's this hero's player's turn]
** end of function
** function to make slot x16 of hero x1's army grow by 4%, to 10000
!?FU700;
!!HEx1:C0/x16/?y1/?y2; [get y1 type y2 qty]
!!VRy3:Sy2 *104 :100; [add 4%]
!!VRy3&y3>10000/y2<10000:S10000; [limit to 10000]
!!HEx1&y2<10000:C0/x16/y1/y3; [store new qty]
** end of function
** function to add boars to dwelling number x16 if not first level
!?FU701;
!!UN:U17/-1/x16/600; [get dwelling location into v600-v602]
!!DW600:M0/?y1/?y2; [get y1 type y2 qty in slot 0]
!!VRy3:S1; [assume we will add boars]
!!VRy1::2; [divide type by 2 to factor in upgraded 1st level creatures]
!!VRy3&y1=59:S0; [pixies/sprites]
!!VRy3&y1=69:S0; [halflings/peasants]
!!VRy1&y1<56:%7; [now all normal level 1's are 0]
!!VRy3&y1=0:S0;
!!DW600&y3=1:M1/140/12; [12 boars in slot 1]
** end of function
** function to make hero x16 at least 5th level if it has owner x1
!?FU702;
!!HEx16:O?y1; [get hero's owner]
!!HEx16&y1=x1:Ed5000; [give 5000 experience]
** end of function
** function to double hero x16's movement
!?FU703;
!!OW:C?y1; [get current player]
!!HEx16:O?y2; [get hero's owner]
!!IF:Wx16; [set w for hero being checked]
!!VRw46&y1=y2:S0; [reset hero's w46 variable if it's this hero's player's turn]
** end of function
** artifact trigger
!?OB5;
!!VRv1:S0; [make sure v1 starts as 0]
!!UN:P101/?v1; [check wogify options number - 4 means no rules]
!?OB5&v1<>4; [Continue trigger only if rules aren't disabled]
!!FU709:P9; [check for rule 9]
!!OB998:U?y1; [get artifact number]
!!HE-1:A2/y1/?y2/?y3; [get y2 number carried y3 number equipped]
!!HE-1&y2=0/3:Ay1; [give an extra copy if they don't already have one]
!!UN:N0/326/y1; [get name of artifact into z326]
!!IF&1000/y2=0/3:M^Вы нашли еще один %Z326 рядом с первым.^;
** end of artifact trigger
** hero movement trigger
!?HM-1;
!!VRv1:S0; [make sure v1 starts as 0]
!!UN:P101/?v1; [check wogify options number - 4 means no rules]
!!FU709&v1<>4:P10; [check for rule 10]
!!FU711&3/v1<>4:P; [handle replacing shroud]
!!FU709&v1<>4:P11; [check for rule 11]
!!IF&3/v1<>4:W-1; [set to current hero]
!!HE-1&3/v1<>4/w46=0:W?v2; [get movement]
!!VRv2&3/v1<>4/w46=0:*2; [double it]
!!HE-1&3/v1<>4/w46=0:Wv2; [set hero's movement to double value]
!!VRw46&3/v1<>4/w46=0:S-1; [set hero's w46 variable to -1]
** end of hero movement trigger
** function to let hero x16 revisit objects
!?FU704;
!!HEx16:O?y1; [get owner]
!!OW:C?y2; [get current player]
!!DO705/0/9/1&y1=y2:Px16; [mark learning stones through schools of war as unvisited]
** end of function
** function to let hero x1 revisit object x16
!?FU705;
!!HEx1:Vx16/0; [set hero to have not visited all objects of this type]
** end of function
** function to change a mine's produced resource
!?FU706;
!!UN:U53/-1/x16/600; [get mine location into v600-v602]
!!VRy1:S0 R6; [random 0-6]
!!MN600:Ry1/1; [set random resource produced]
** end of function
** hero level-up trigger
!?HL-1;
!!VRv1:S0; [make sure v1 starts as 0]
!!UN:P101/?v1; [check wogify options number - 4 means no rules]
!!FU709&v1<>4:P14; [check for rule 14]
!!FU710&3/v1<>4:P; [handle giving hero a 9th-10th skill]
!!FU709&v1<>4:P16; [check for rule 16]
!!FU712&3/v1<>4:P; [give hero an artifact]
** end of hero level-up trigger
** function to count skills for a hero
!?FU707;
!!HE-1:Sx16/?y1; [check for presence of skill]
!!VRv549&y1>0:+1; [count it]
** end of function
** function to convert a stack of upgraded 7th level to 8th level
** hero x1, slot x16
!?FU708;
!!HEx1:C0/x16/?y1/?y2; [get y1 type y2 qty]
!!VRy1&y1=13:S150; [archangel]
!!VRy1&y1=27:S151; [gold dragon]
!!VRy1&y1=41:S152; [titan]
!!VRy1&y1=55:S153; [archdevil]
!!VRy1&y1=69:S154; [ghost dragon]
!!VRy1&y1=83:S155; [black dragon]
!!VRy1&y1=97:S156; [ancient behemoth]
!!VRy1&y1=111:S157; [chaos hydra]
!!VRy1&y1=131:S158; [phoenix]
!!HEx1:C0/x16/y1/y2; [set creature type/qty]
** end of function
** function to set flag 3 if rule x1 has been chosen
!?FU709;
!!IF:V3/0;
!!VRy1:S579; [variable # of rule]
!!VRy1&x1>10:S576;
!!VRx1:-1 %10 +550; [variable # of bit value]
!!VRy2:Svy1 &vx1; [get just our bit]
!!IF&y2>0:V3/1; [set flag 3 if our bit set]
** end of function
** function to handle giving a 9th-10th skill to a hero going up a level
!?FU710;
!!VRv549:S0; [count of skills for this hero]
!!DO707/0/27/1:P; [count the skills]
!!VRy1:S0 R27; [pick a random skill to offer]
!!HE-1:Sy1/?y2; [check for presence of random skill]
!!HE-1:B0/?z352; [get hero name]
!!UN:N4/353/y1; [get skill name]
!!HE-1:R2/?y3; [get hero sex]
!!VRz354&y3=0:S^он^;
!!VRz354&y3=1:S^она^;
!!VRy4:Sy1 *3 +3; [get picture of skill]
!!IF:V2/0; [assume won't learn skill]
!!IF&1000/y2=0/v549>=8/v549<=9:Q2/20/y4/2^%Z352 может выучить секретный навык, %Z353. Хочет ли %Z354 выучить это?^;
!!IF&-1000/y2=0/v549>=8/v549<=9:V2/1; [AI always learns it]
!!HE-1&2:Sy1/1; [give skill]
** end of function
** function to handle replacing shroud for a hero
!?FU711;
!!HE-1:O?y1; [get owner]
!!OW:Iy1/?y2; [get AI 1 or human 0]
!!FU721&y2=0:Py1; [do a Cover Of Darkness for a non-teammate of a human player]
** end of function
** function to give hero an artifact based on experience
!?FU712;
!!HE-1:E?y2; [get experience]
!!VRv700:C7/13/19/20/25/37/41/45/46/47; [table of treasure artifacts]
!!VRv710:C48/49/50/51/52/53/54/60/63/64;
!!VRv720:C73/74/75/76/77/78/84/85/94/97;
!!VRv730:C100/102/103/104/105/107/118;
!!VRy1:S700 R36; [now vy1 is a random treasure artifact]
!!VRy3:Svy1; [default is treasure]
!!VRv700:C8/9/14/15/21/22/26/27/31/38; [table of minor artifacts]
!!VRv710:C42/55/61/65/70/95/98/112/114/119;
!!VRv720:C120;
!!VRy1:S700 R20; [now vy1 is a random minor artifact]
!!VRy3&y2>=6200/y2<20600:Svy1; [6th-12th level gets minor]
!!VRy6:S39; [y6 is initial number of relics in table if none banned]
!!UN:A83/?y7; [y7=1 if Recanter's Cloak is disabled]
!!VRy6&y7=1:-1; [subtract 1 if artifact disabled]
!!VRv700:C10/11/16/17/23/28/29/39/43/56; [table of major artifacts]
!!VRv710:C57/58/62/66/67/68/69/70/71/79;
!!VRv720:C80/81/82/83/91/92/96/99/101/106;
!!VRv730:C108/109/110/111/113/116/117/121/122/125;
!!VRy1:S700 Ry6; [now vy1 is a random major artifact]
!!VRy1&y7=1/y1>=723:+1; [Recanter's Cloak banned]
!!VRy3&y2>=20600/y2<57533:Svy1; [12th-18th level gets major]
!!VRy6:S39; [y6 is initial number of relics in table if none banned]
!!UN:A72/?y7; [y7=1 if Angel Wings is disabled]
!!VRy6&y7=1:-1; [subtract 1 if artifact disabled]
!!UN:A86/?y8; [y8=1 if Tome of Fire Magic is disabled]
!!VRy6&y8=1:-1; [subtract 1 if artifact disabled]
!!UN:A87/?y9; [y9=1 if Tome of Air Magic is disabled]
!!VRy6&y9=1:-1; [subtract 1 if artifact disabled]
!!UN:A88/?y10; [y10=1 if Tome of Water Magic is disabled]
!!VRy6&y10=1:-1; [subtract 1 if artifact disabled]
!!UN:A89/?y11; [y11=1 if Tome of Earth Magic is disabled]
!!VRy6&y11=1:-1; [subtract 1 if artifact disabled]
!!UN:A90/?y12; [y12=1 if Boots of Levitation is disabled]
!!VRy6&y12=1:-1; [subtract 1 if artifact disabled]
!!UN:A93/?y13; [y13=1 if Orb of Vulnerability is disabled]
!!VRy6&y13=1:-1; [subtract 1 if artifact disabled]
!!UN:A123/?y14; [y14=1 if Sea Captain's Hat is disabled]
!!VRy6&y14=1:-1; [subtract 1 if artifact disabled]
!!UN:A124/?y15; [y15=1 if Spellbinder's Hat is disabled]
!!VRy6&y15=1:-1; [subtract 1 if artifact disabled]
!!UN:A126/?y16; [y16=1 if Orb of Inhibition is disabled]
!!VRy6&y16=1:-1; [subtract 1 if artifact disabled]
!!VRv700:C12/18/24/30/32/33/34/35/36/40; [table of relics]
!!VRv710:C44/59/72/86/87/88/89/90/93/115;
!!VRv720:C123/124/126/127/128/129/130/131/132/133;
!!VRv730:C134/135/136/137/138/139/140/141/142/143;
!!VRy1:S700 Ry6; [now vy1 is a random relic]
!!VRy1&y7=1/y1>=712:+1; [Angel Wings banned]
!!VRy1&y8=1/y1>=713:+1; [Tome of Fire Magic banned]
!!VRy1&y9=1/y1>=714:+1; [Tome of Air Magic banned]
!!VRy1&y10=1/y1>=715:+1; [Tome of Water Magic banned]
!!VRy1&y11=1/y1>=716:+1; [Tome of Earth Magic banned]
!!VRy1&y12=1/y1>=717:+1; [Boots of Levitation banned]
!!VRy1&y13=1/y1>=718:+1; [Orb of Vulnerability banned]
!!VRy1&y14=1/y1>=720:+1; [Sea Captain's Hat banned]
!!VRy1&y15=1/y1>=721:+1; [Spellbinder's Hat banned]
!!VRy1&y16=1/y1>=722:+1; [Orb of Inhibition banned]
!!VRy3&y2>=57533:Svy1; [18th level on gets relic]
!!HE-1:Ay3; [give artifact]
!!HE-1:B0/?z352; [get hero name]
!!HE-1:O?y4; [get hero owner]
!!OW&y4<>-1:Iy4/?y5; [get AI 1 or human 0]
!!IF&y4<>-1/y5=0:Q2/8/y3/1^За старания, %Z352 награжден артефактом.^;
** end of function
** Object triggers for Rogue fights
!?OB12/-1; [campfire]
!!VRv1:S0; [make sure v1 starts as 0]
!!UN:P101/?v1; [check wogify options number - 4 means no rules]
!!FU713&v1<>4:P; [handle generating roving bands of Rogues]
!?OB17/-1; [most creature dwellings]
!!VRv1:S0; [make sure v1 starts as 0]
!!UN:P101/?v1; [check wogify options number - 4 means no rules]
!!FU713&v1<>4:P; [handle generating roving bands of Rogues]
!?OB29/-1; [flotsam]
!!VRv1:S0; [make sure v1 starts as 0]
!!UN:P101/?v1; [check wogify options number - 4 means no rules]
!!FU713&v1<>4:P; [handle generating roving bands of Rogues]
!?OB32/-1; [garden of revelation]
!!VRv1:S0; [make sure v1 starts as 0]
!!UN:P101/?v1; [check wogify options number - 4 means no rules]
!!FU713&v1<>4:P; [handle generating roving bands of Rogues]
!?OB39/-1; [lean to]
!!VRv1:S0; [make sure v1 starts as 0]
!!UN:P101/?v1; [check wogify options number - 4 means no rules]
!!FU713&v1<>4:P; [handle generating roving bands of Rogues]
!?OB47/-1; [school of magic]
!!VRv1:S0; [make sure v1 starts as 0]
!!UN:P101/?v1; [check wogify options number - 4 means no rules]
!!FU713&v1<>4:P; [handle generating roving bands of Rogues]
!?OB51/-1; [mercenary camp]
!!VRv1:S0; [make sure v1 starts as 0]
!!UN:P101/?v1; [check wogify options number - 4 means no rules]
!!FU713&v1<>4:P; [handle generating roving bands of Rogues]
!?OB53/-1; [mine]
!!VRv1:S0; [make sure v1 starts as 0]
!!UN:P101/?v1; [check wogify options number - 4 means no rules]
!!FU713&v1<>4:P; [handle generating roving bands of Rogues]
!?OB55/-1; [mystical garden]
!!VRv1:S0; [make sure v1 starts as 0]
!!UN:P101/?v1; [check wogify options number - 4 means no rules]
!!FU713&v1<>4:P; [handle generating roving bands of Rogues]
!?OB57/-1; [obelisk]
!!VRv1:S0; [make sure v1 starts as 0]
!!UN:P101/?v1; [check wogify options number - 4 means no rules]
!!FU713&v1<>4:P; [handle generating roving bands of Rogues]
!?OB58/-1; [redwood observatory]
!!VRv1:S0; [make sure v1 starts as 0]
!!UN:P101/?v1; [check wogify options number - 4 means no rules]
!!FU713&v1<>4:P; [handle generating roving bands of Rogues]
!?OB60/-1; [pillar of fire]
!!VRv1:S0; [make sure v1 starts as 0]
!!UN:P101/?v1; [check wogify options number - 4 means no rules]
!!FU713&v1<>4:P; [handle generating roving bands of Rogues]
!?OB61/-1; [star axis]
!!VRv1:S0; [make sure v1 starts as 0]
!!UN:P101/?v1; [check wogify options number - 4 means no rules]
!!FU713&v1<>4:P; [handle generating roving bands of Rogues]
!?OB79/-1; [resource]
!!VRv1:S0; [make sure v1 starts as 0]
!!UN:P101/?v1; [check wogify options number - 4 means no rules]
!!FU713&v1<>4:P; [handle generating roving bands of Rogues]
!?OB82/-1; [sea chest]
!!VRv1:S0; [make sure v1 starts as 0]
!!UN:P101/?v1; [check wogify options number - 4 means no rules]
!!FU713&v1<>4:P; [handle generating roving bands of Rogues]
!?OB88/-1; [shrine of magic incantation]
!!VRv1:S0; [make sure v1 starts as 0]
!!UN:P101/?v1; [check wogify options number - 4 means no rules]
!!FU713&v1<>4:P; [handle generating roving bands of Rogues]
!?OB94/-1; [stables]
!!VRv1:S0; [make sure v1 starts as 0]
!!UN:P101/?v1; [check wogify options number - 4 means no rules]
!!FU713&v1<>4:P; [handle generating roving bands of Rogues]
!?OB100/-1; [learning stone]
!!VRv1:S0; [make sure v1 starts as 0]
!!UN:P101/?v1; [check wogify options number - 4 means no rules]
!!FU713&v1<>4:P; [handle generating roving bands of Rogues]
!?OB101/-1; [treasure chest]
!!VRv1:S0; [make sure v1 starts as 0]
!!UN:P101/?v1; [check wogify options number - 4 means no rules]
!!FU713&v1<>4:P; [handle generating roving bands of Rogues]
!?OB102/-1; [tree of knowledge]
!!VRv1:S0; [make sure v1 starts as 0]
!!UN:P101/?v1; [check wogify options number - 4 means no rules]
!!FU713&v1<>4:P; [handle generating roving bands of Rogues]
!?OB104/-1; [university]
!!VRv1:S0; [make sure v1 starts as 0]
!!UN:P101/?v1; [check wogify options number - 4 means no rules]
!!FU713&v1<>4:P; [handle generating roving bands of Rogues]
!?OB105/-1; [wagon]
!!VRv1:S0; [make sure v1 starts as 0]
!!UN:P101/?v1; [check wogify options number - 4 means no rules]
!!FU713&v1<>4:P; [handle generating roving bands of Rogues]
!?OB107/-1; [school of war]
!!VRv1:S0; [make sure v1 starts as 0]
!!UN:P101/?v1; [check wogify options number - 4 means no rules]
!!FU713&v1<>4:P; [handle generating roving bands of Rogues]
!?OB109/-1; [water wheel]
!!VRv1:S0; [make sure v1 starts as 0]
!!UN:P101/?v1; [check wogify options number - 4 means no rules]
!!FU713&v1<>4:P; [handle generating roving bands of Rogues]
!?OB112/-1; [windmill]
!!VRv1:S0; [make sure v1 starts as 0]
!!UN:P101/?v1; [check wogify options number - 4 means no rules]
!!FU713&v1<>4:P; [handle generating roving bands of Rogues]
!?OB113/-1; [witch hut]
!!VRv1:S0; [make sure v1 starts as 0]
!!UN:P101/?v1; [check wogify options number - 4 means no rules]
!!FU713&v1<>4:P; [handle generating roving bands of Rogues]
** end of set of object triggers
** function to generate roving bands of Rogues
!?FU713;
!!FU709:P17; [check for rule 17]
!!OW:C?y1; [get current player]
!!OW:Iy1/?y2; [get AI 1 or human 0]
!!VRy1&y2=0:S0 R15; [1 in 16 chance for human]
!!VRy1&y2=1:S0 R63; [1 in 64 chance for AI]
!!VRy3:Sc0; [get current day]
!!IF&3:V875/0;
!!FU714&3/y1=0/y3<>v572:Py2; [continue if odds are met and rule active and no other Rogues today]
** end of function
** function to actually cause a Rogue fight
!?FU714;
!!HE-1:B0/?z326; [get hero name]
!!IF&x1=0:M^%Z326 атакован шайкой воров!^;
!!VRy1:Sc0; [get day of game]
!!VRy1:+6;
!!VRy1::7; [get week of game]
!!VRv1262:Sy1 *20; [20 Rogues per elapsed week: v1262]
!!HE-1:P?y2/?y3/?y4; [get hero location]
!!IF:V875/1; (For mithril and chest scripts)
!!HE-1:N?v1219; [get hero number]
!!HE-1:Ty2/y3/y4/143/v1262; [provoke Rogue battle]
!!HEv1219:O?y2; [get hero owner]
!!VRv1262:*25; [25 gold per Rogue]
!!OW&y2<>-1:Ry2/6/dv1262; [give gold if hero lived]
!!IF&y2<>-1:V875/0; (For mithril and chest scripts)
!!IF&x1=0/y2<>-1:Q2/6/v1262/1^У воров есть сокровище!^;
!!VRv572:Sc0; [set day of last Rogue fight]
** end of function
** function to make monster x16 gain a breath weapon
!?FU715;
!!MA:Xx16/?y1; [get flags]
!!VRy1:|8; [breath weapon]
!!MA&x16<145|x16>149:Xx16/y1; [save flags, except for war machines]
** end of function
** function to make monster x16 lose shooting but gain +50% hit points if it shot
!?FU716;
!!MA:Xx16/?y1; [get flags]
!!VRy2:Sy1;
!!VRy2:&4; [just look at shooting bit]
!!VRy1:&-5; [lose shooting]
!!VRy1:|4096; [no penalty in close combat]
!!MA&x16<145|x16>149:Xx16/y1; [save flags, except for war machines]
!!MA:Px16/?y3; [get hit points]
!!VRy3&y2=4:*15 :10; [+50% if creature shot]
!!MA&x16<145|x16>149:Px16/y3; [set hit points, except for war machines]
** end of function
** function to build a grail in town # x16
!?FU717;
!!UN:U98/-1/x16/600; [get town location into v600-v602]
!!CA600:B1/26; [build grail]
!!CA600:T?y1; [get town type]
!!CA600:O?y2; [get town owner]
!!UN&y1=2:Sv573/v573/0/y2/v574; [remove entire shroud, surface, for tower's skyship]
!!UN&y1=2:Sv573/v573/1/y2/v574; [remove entire shroud, underground]
** end of function
** function to add rule x16 to the papyrus if active
!?FU718;
!!FU709:Px16; [check for rule x16]
!!VRy1:S331 +x16; [z variable for this rule]
!!QW&3:Ay1/-2/-2/y1; [set papyrus message]
** end of function
** function to replace shroud for player x1 via Cover Of Darkness for their enemy
!?FU721;
!!VRy1:S564 +x1; [variable # of non-teammate player]
!!UN:Hv573/v573/0/vy1/v574; [replace entire shroud, surface]
!!UN&v575=1:Hv573/v573/1/vy1/v574; [replace entire shroud, underground]
** end of function
** function to set rule bit for numbered rule x1
!?FU722;
!!VRy1:S579; [variable # of bit]
!!VRy1&x1>10:S576;
!!VRx1:-1 %10 +550; [variable # of bit value]
!!VRvy1:|vx1; [set bit]
** end of function
** functions to add map rules selected in WoGify options dialogue
!?FU723;
!!UN:Px16/?y1; [Check if each map rule is enabled (111-120)
!!VRy2:Sx16 -111; [Get loop number]
!!VRy3&y1=1:S550 +y2; [Get corresponding variable with bit number]
!!VRv579&y1=1:+vy3; [If it's enabled, add bit number to v579]
!?FU724;
!!UN:Px16/?y1; [Check if each map rule is enabled (121-130)
!!VRy2:Sx16 -121; [Get loop number]
!!VRy3&y1=1:S550 +y2; [Get corresponding variable with bit number]
!!VRv576&y1=1:+vy3; [If it's enabled, add bit number to v579]
** end of functions
** functions choose two random rules, calling themselves again a rule wasn't selected
** If it can't find two unique selected rules after 100 loops, use only 1 or none.
!?FU725;
!!VRv3:S1 Rx1; [Random rule]
!!VRy1:Sv3 +110; [Convert to ERM number]
!!UN:Py1/?y2; [See if it's selected in Wogify options]
!!VRv3&y2=0:S0; [set no rule found if it wasn't a selected rule]
!!VRx16&y2=1:S101; [exit loop if a selected rule is found]
!?FU726;
!!VRv4:S1 Rx1; [Random rule]
!!VRy1:Sv4 +110; [Convert to ERM number]
!!UN:Py1/?y2; [See if it's selected in Wogify options]
!!VRv4&y2=0:S0; [set no rule found if it wasn't a selected rule]
!!VRx16&y2=1/v3<>v4:S101; [exit loop if a unique selected rule is found]
** end of functions