** Tranformation Altar ERM Script Version 1.1 created by Timothy E. Pulver
** This script lets all "Lightning Altars" on a map function as transformation ** devices. When a hero climbs the altar, his or her army will be transformed ** into different random creatures, while maintaining approximately the same ** level of power. For example, a stack of 10 archers may become a stack of ** 10 dwarves or 10 gargoyles instead. Powerful neutral dragons in the game ** are immune to transformation, as are some of the new WoG creatures. ** Each Transformation Altar on the map can only be visited once per week.
** The "Lightning Altar" is a new WoG object that can be found in the WoG ** Heroes map editor in the Town Objects section. It's the 5th object beneath ** the Conflux castle. It appears as an altar with steps leading up to a pillar ** with a light on top. From the light comes dancing lightning bolts.
** To install this script in a map, simply copy & paste the code into a global ** (timed) event. Copy the entire code, from ZVSE to the end. Make sure ** that you disable ALL colours from receiving the event and/or change ** the event day to something like 500 or later to avoid the ERM script ** popping up as if it were a regular event message. The title of the event ** is unimportant, but I would suggest something like "Transformation Altar". ** And of course, you'll also need to put one or more "Lightning Altars" on ** your map for the heroes to visit. Happy transforming! :-)
Flags Used in this Script: 1,2,77, 209-211 Variables Used in this Script: f,g,i,j,k,l,v88-v90,x16,z75, Functions Used in this Script: 18001
!?OB63/20; [Triggers when any "Lightning Altar" is visited]
!!IF:V209/0 V210/0 V211/0; [Sets flags 209, 210 and 211 to false]
[Set up right-click hint text for altar object] !!VRz75:S^Altar of Transformation^; !!OB998:H75;
[Ask if hero wishes to visit the altar] !!IF&1000:Q1^Do you climb the steps of the mysterious altar?^;
[If player is AI, generate random response] !!VRv90&-1000:S0 T1; !!IF&v90=0/-1000:V1/0; !!IF&v90=1/-1000:V1/1;
[Check if someone has already visited the altar this week. If noone has and hero visits, set control word to indicate that it has now been visited this week] !!IF&1:V77/0; [Reset flag 77 to 0] !!OB998:C?v89; [Get control word of this altar] !!OB998&v89>999:C0; [If altar hasn't been visited, set its control word to 0] !!VRv88:Sc0 -1 :7 *7 +1; [Determine most recent Day 1] !!IF&v88<=v89/1:V77/1; [If most recent Day 1 is earlier or the same as the the day last visited, don't allow visit] !!OB998&1:Cc0; [If visiting, set control word to current day]
[If altar has been visited this week, display this message and set flag 1 to false] !!IF&77/1/1000:M^You climb to the top of the altar but the energy merely sputters around you as if it had recently been drained. Try returning at the beginning of next week.^; !!IF&77:V1/0;
[If hero visits altar, display this message] !!IF&1/1000:M^{Flickering Energies}
~~ CRACKLE ~~
{all around you...}^;
[If hero visits altar, set v77 variable to true and make a "teleport hero" sound] !!IF&1:V77/1; !!HE-1&1/1000:Pv998/v999/v1000;
[If hero visits altar, perform transformation function 7 times -- once for each army slot] !!DO18001/0/6/1&1:P;
[After transformation, display this message plus second message if appropriate] !!IF&1/1000:M^You step down from the altar with your army transformed!^; !!IF&209/-211/1000:M^The powerful dragons in your army resist the transformation!^; !!IF&211/-209/1000:M^The strange new creatures in your army resist the transformation!^; !!IF&209/211/1000:M^The powerful dragons and the strange new creatures in your army resist the transformation!^;
!!VRi:S-1; [Sets variable i to -1] !!HE-1:C0/x16/?i/d0; [Stores value of troop type found in hero's slot x16 in variable i]
!!VRg:S0; [Sets variable g to 0] !!VRf:S0; [Sets variable f to 0] !!VRl:S-1; [Sets variable l to -1] !!IF:V2/0 V210/0; [Sets flag 2 and flag 210 to false]
[If existing troop type is a powerful neutral dragon, set flags 209 and 210 to 1] !!IF&i>131/i<136:V209/1 V210/1;
!!VRg&i>101/i<104:S4; [If troop type is a gorgon or mighty gorgon, set variable g to 4] !!VRg&i>103/i<108:S-2; [If troop type is a serpent fly, dragon fly, basilisk or greater basilisk, set variable g to -2]
!!VRi&g<>0:+g; [If variable g does NOT equal 0, add value of g to variable i] !!IF&g<>0:V2/1; [If variable g does NOT equal 0, set flag 2 to true]
!!VRj&i<112:S0 R8; [If troop type is less than 112, set j to random # from 0 to 8] !!VRj&f>180:S0 R8; [If troop type is greater than 180, set j to random # from 0 to 8]