Advertisement
Guest User

FFV lua script

a guest
Oct 4th, 2011
1,050
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 29.04 KB | None | 0 0
  1. -- -------------------------- --
  2. -- Final Fantasy V LUA script --
  3. --                            --
  4. -- By: samurai goroh          --
  5. -- -------------------------- --
  6.  
  7.  
  8. -- ------- --
  9. -- GLOBALS --
  10. -- ------- --
  11.  
  12. wwidth  = 256   -- window width
  13. wheight = 224   -- window height
  14. offsetX = 0     -- To move things in coord X
  15. offsetY = 0     -- To move things in coord Y
  16. gapX    = 7     -- Text gap in coord X
  17. gapY    = 7     -- Text gap in coord Y
  18.  
  19. -- ------ --
  20. -- Tables --
  21. -- ------ --
  22. TableStatusCurable  = {  'Darkness',
  23.                          'Zombie',
  24.                          'Poison',
  25.                          'Float',
  26.                          'Mini',
  27.                          'Toad',
  28.                          'Petrify',
  29.                          'Dead'
  30.                       }
  31.  
  32. TableStatusTemporary = { 'Image (x1)',
  33.                          'Image (x2)',
  34.                          'Mute',
  35.                          'Berserk',
  36.                          'Charm',
  37.                          'Paralyze',
  38.                          'Sleep',
  39.                          'Aging'
  40.                        }
  41.  
  42. TableStatusDispellable = { 'Regen',
  43.                            'Invul',
  44.                            'Slow',
  45.                            'Haste',
  46.                            'Stop',
  47.                            'Shell',
  48.                            'Armor',
  49.                            'Wall'
  50.                          }
  51.  
  52. TableStatusPermanent = { 'Hidden',
  53.                          'Near Death',
  54.                          'Singing',
  55.                          'Hp Leak',
  56.                          'Countdown',
  57.                          'Controlled',
  58.                          'False Image',
  59.                          'Erased'
  60.                        }
  61.  
  62. TableElement = { 'Fire',
  63.                  'Ice',
  64.                  'Lightning',
  65.                  'Poison',
  66.                  'Holy',
  67.                  'Earth',
  68.                  'Wind',
  69.                  'Water'
  70.                }
  71.  
  72. TableCantEvade = { 'Blue',
  73.                    'White',
  74.                    'Black',
  75.                    'Dimen',
  76.                    'Summon',
  77.                    'Song',
  78.                    'Aerial',
  79.                    'Physical'
  80.                  }
  81.  
  82. TableCreature = { 'Undead',
  83.                   'Archaetoad',
  84.                   'Creature',
  85.                   'Avis',
  86.                   'Dragon',
  87.                   'Heavy',
  88.                   'Desert',
  89.                   'Human'
  90.                 }
  91.  
  92. TableAttackFormula = { 'No effect',
  93.                   'Monster Attack',
  94.                   'Monster Specialty',
  95.                   'Magic Sword - Type 1',
  96.                   'Magic Sword - Type 2',
  97.                   'Magic Sword - Type 3',
  98.                   'Offensive Magic',
  99.                   'Fractional HP based damage',
  100.                   'Pierce Magic defense',
  101.                   'Random Damage',
  102.                   'Physical magic',
  103.                   'Level based damage (+ Status?)',
  104.                   'HP leak',
  105.                   'HP drain',
  106.                   'MP drain',
  107.                   'HP to critical',
  108.                   'Restore HP (Magic)',
  109.                   'Restore full HP (Magic)',
  110.                   'Status 0 infliction',
  111.                   'Status 1 infliction',
  112.                   'Status 2 infliction',
  113.                   'Toggle Status',
  114.                   'Speed Status(Exclusive)',
  115.                   'Instant death',
  116.                   'Instant destroy',
  117.                   'Status removal',
  118.                   'Resurrection(fractional)',
  119.                   'Whispering Wind',
  120.                   'Element attribute change',
  121.                   'View stats',
  122.                   'Drag',
  123.                   'Void',
  124.                   'End battle',
  125.                   'Reset battle',
  126.                   'Double commands',
  127.                   'Earth Wall',
  128.                   'Restore HP (Item)',
  129.                   'Restore MP (Item)',
  130.                   'Restore HP / MP',
  131.                   'Inflict status, ignore immunity',
  132.                   'Fixed damage, ignore defense',
  133.                   'Countdown destroy',
  134.                   'Max HP based damage + HP leak',
  135.                   'Current user HP based damage',
  136.                   'Random effect',
  137.                   'Ground attacks',
  138.                   "Reaper's Sword",
  139.                   '?',
  140.                   'Unarmed',
  141.                   'Swords',
  142.                   'Knives',
  143.                   'Spears',
  144.                   'Axes , Staves',
  145.                   'Bows (Status effect)',
  146.                   'Bows (Elemental)',
  147.                   'Katanas',
  148.                   'Whips',
  149.                   'Bells',
  150.                   'Long reach axes',
  151.                   'Rods',
  152.                   'Rune weapons',
  153.                   'Reduce HP to critical + Status',
  154.                   'Reduce HP to critical or HP Leak',
  155.                   'Zombie Breath',
  156.                   'Change Row',
  157.                   '?',
  158.                   'HP and status restored',
  159.                   '!Steal (command)',
  160.                   'Escape (enemy)',
  161.                   '!Throw (command)',
  162.                   '!GilToss (command)',
  163.                   '!Tame (command)',
  164.                   '!Catch (command)',
  165.                   'Flirt',
  166.                   '!Dance(Command)',
  167.                   'Lv5 Doom',
  168.                   'Lv2 Old',
  169.                   'Lv4 Quarter',
  170.                   'Lv3 Flare',
  171.                   'Revive + Status',
  172.                   'Goblin Punch',
  173.                   'Level/Defense modifier',
  174.                   'HP Leak + Status',
  175.                   'Current MP damage',
  176.                   'Max - Current HP damage',
  177.                   'Kill Caster, Heal Raget',
  178.                   '?',
  179.                   'HP Leak + Status',
  180.                   'Flare damage + HP Leak + Status',
  181.                   'HP boost',
  182.                   'Heal HP based on current suser HP',
  183.                   '?',
  184.                   'Full Heal + Status',
  185.                   'Zombie magic',
  186.                   'Increase stats while Singing',
  187.                   'Damage creature type while Singing',
  188.                   'Unhide Monster',
  189.                   'Stalker Attack',
  190.                   'Unhide Next Page',
  191.                   'Grand Cross',
  192.                   'Chicken Knife',
  193.                   'Interceptor Rocket',
  194.                   'Targeting',
  195.                   'Pull',
  196.                   'Terminate',
  197.                   '!Control (command)',
  198.                   "? (Sandworm's Death)",
  199.                   'Status Immunity, Magic Element UP, Creature Type',
  200.                   'Strong vs. Creature type',
  201.                   'Drain HP based on current HP',
  202.                   'Brave Blade',
  203.                   'Strong Fight',
  204.                   'Wormhole',
  205.                   'Level Down',
  206.                   'Bows strong vs. Creature type',
  207.                   'Spears Strong vs. Creature type',
  208.                   'Unhide Monster',
  209.                   'Terminate',
  210.                   '?',
  211.                   '?',
  212.                   '?',
  213.                   '?',
  214.                   '?',
  215.                   '?',
  216.                   '?',
  217.                   '?',
  218.                   'Innefective',
  219.                   'No Action'
  220.                 }
  221.  
  222. TableCharacter = { 'Butz',
  223.                    'Lenna',
  224.                    'Galuf',
  225.                    'Faris',
  226.                    'Cara',
  227.                    '',
  228.                    '',
  229.                    ''
  230.                  }
  231.  
  232. TableJob = { 'Knight',
  233.              'Monk',
  234.              'Thief',
  235.              'Dragoon',
  236.              'Ninja',
  237.              'Samurai',
  238.              'Berserker',
  239.              'Ranger',
  240.              'Mystic Knight',
  241.              'White Mage',
  242.              'Black Mage',
  243.              'Time Mage',
  244.              'Summoner',
  245.              'Blue Mage',
  246.              'Red Mage',
  247.              'Beastmaster',
  248.              'Chemist',
  249.              'Geomancer',
  250.              'Bard',
  251.              'Dancer',
  252.              'Mimic',
  253.              'Freelancer'
  254.            }
  255.  
  256. TableBattleground = { 'Plain',
  257.                       'Forest',
  258.                       'Desert',
  259.                       'Swamp',
  260.                       'Beach',
  261.                       'Indoor Ghost Ship',
  262.                       'Cave',
  263.                       'Water',
  264.                       'Castle',
  265.                       'Outdoor Castle',
  266.                       'Castle 2',
  267.                       'Castle 3',
  268.                       'Outdoor Castle 2',
  269.                       'Library',
  270.                       'Indoor Ship',
  271.                       'Forest 2',
  272.                       'Plain 2',
  273.                       'Castle 4',
  274.                       'Pier',
  275.                       'Tree Root',
  276.                       'Castle 5',
  277.                       'Outdoor Ship',
  278.                       'Steel Floor',
  279.                       'Crystal Floor',
  280.                       'Indoor Ruins',
  281.                       'Outdoor Ghost Ship',
  282.                       'Castle in Fire',
  283.                       'Wall',
  284.                       'Space',
  285.                       'Underwater Castle',
  286.                       'Desert 2',
  287.                       'Distorted Space',
  288.                       'Outdoor Castle 3',
  289.                       'Wet Plains'
  290.                     }
  291.  
  292. TableEnemy = { 'Goblin',
  293.                'Killer Bee',
  294.                'Nut Eater',
  295.                'Stray Cat',
  296.                'Steel Bat',
  297.                'Dearo',
  298.                'Stroper',
  299.                'Black Goblin',
  300.                'White Snake',
  301.                'Mold Wind',
  302.                'ManiWizard',
  303.                'Magic Pot',
  304.                'Sucker',
  305.                'Octoraken',
  306.                'Gatlings',
  307.                'Bighorn',
  308.                'Tatu',
  309.                'Bander S.',
  310.                'Galura',
  311.                'Skeleton',
  312.                'Carcurser',
  313.                'UndeadRusk',
  314.                'PsychoHead',
  315.                'RockGarter',
  316.                'Gala Cat',
  317.                'Cockatrice',
  318.                'Blocks',
  319.                'Elf Toad',
  320.                'IceSoldier',
  321.                'RikaldMage',
  322.                'Wyvern',
  323.                'Padosule',
  324.                'Byblos',
  325.                'Aegil',
  326.                'Zuu',
  327.                'Wild Nack',
  328.                'GrassTurtle',
  329.                'Silent Bee',
  330.                'Mithril Drgn',
  331.                'Ramuh',
  332.                'Crew Dust',
  333.                'Poltergeist',
  334.                'Motor Trap',
  335.                'Defeater',
  336.                'Garkimasra',
  337.                'Sergeant',
  338.                'Sorcerer',
  339.                'Karnak',
  340.                'Gigas',
  341.                'Page 32',
  342.                'Page 64',
  343.                'Page 128',
  344.                'Page 256',
  345.                'Ifrit',
  346.                'Bomb',
  347.                'TwinLizard',
  348.                'BioSoldier',
  349.                'Crescent',
  350.                'BlackFlame',
  351.                'StoneGolem',
  352.                'MiniDragon',
  353.                'Prototype',
  354.                'D.Chimera',
  355.                'Sand Porky',
  356.                'Sand Killer',
  357.                'Sand Bear',
  358.                'Ra Mage',
  359.                'LonkaKnght',
  360.                'StonedMask',
  361.                'Whirl Demon',
  362.                'Lamia',
  363.                'ArchaeToad',
  364.                'Hyudora',
  365.                'Hydra',
  366.                'Water Buzz',
  367.                'Torrent',
  368.                'Rock Brain',
  369.                'Tarantula',
  370.                'Jail Bear',
  371.                'Lunenta',
  372.                'Dilure',
  373.                'Faery Orc',
  374.                'Devourer',
  375.                'Mandrake',
  376.                'Kuzar',
  377.                'Cactus',
  378.                'Sand Crawl',
  379.                'ShieldDrgn',
  380.                'Blood Slime',
  381.                'Acrophese',
  382.                'MooglEater',
  383.                'Lopros',
  384.                'Skull Eater',
  385.                'Aquathone',
  386.                'Weresnake',
  387.                'Conago',
  388.                'Ridicule',
  389.                'Andagranda',
  390.                'Drippy',
  391.                'Likaon',
  392.                'BoneDragon',
  393.                'Sting Eagle',
  394.                'ZombieDrgn',
  395.                'Golem',
  396.                'Neon',
  397.                'Magnetes',
  398.                'Wall Knight',
  399.                'Traveler',
  400.                'Tricker',
  401.                'Gravido',
  402.                'Ziggurat',
  403.                'Cure Beast',
  404.                'Land Turtle',
  405.                'Bold Mani',
  406.                'Shoat',
  407.                'MiniMage',
  408.                'GajraGajri',
  409.                'Mammon',
  410.                'Imp',
  411.                'Wyrm',
  412.                'Twin Lizard',
  413.                'Blind Wolf',
  414.                'Arage',
  415.                'Wall Mage',
  416.                'Magic Drgn',
  417.                'DarkWizard',
  418.                'AdamaGolem',
  419.                'BalderKuar',
  420.                'Motodrive',
  421.                'BlueDragon',
  422.                'Red Dragon',
  423.                'Yellow Drgn',
  424.                'Sleepy',
  425.                'Treeman',
  426.                'Hedgehog',
  427.                'Python',
  428.                'Shadow',
  429.                'Elm Gigas',
  430.                'Pao',
  431.                'Radiator',
  432.                'Metamorpha',
  433.                'Unknown',
  434.                'Desertpede',
  435.                'Barette',
  436.                'Sekmet',
  437.                'BlandLamia',
  438.                'Pyra Layer',
  439.                'Nile',
  440.                'Archaesaur',
  441.                'ZephyrZone',
  442.                'ExdethSoul',
  443.                'Slug',
  444.                'GloomWidow',
  445.                'Mukare',
  446.                'Ixecrator',
  447.                'Owazoral',
  448.                'ShdwDancer',
  449.                'Cursed one',
  450.                'Slownin',
  451.                'TinyMage',
  452.                'Dim Master',
  453.                'Bone Dragon',
  454.                'Flare',
  455.                'DuelKnight',
  456.                'Ion',
  457.                'Berserker',
  458.                'Zombie Dragon',
  459.                'Druid',
  460.                'Iron Dress',
  461.                'Statue',
  462.                'Blizzard',
  463.                'Isteritos',
  464.                'Spizner',
  465.                'Unknown',
  466.                'Unknown',
  467.                'Unknown',
  468.                'Unknown',
  469.                'Mercury Bat',
  470.                'Coral',
  471.                'Tonberi',
  472.                'Gel Water',
  473.                'Fall Guard',
  474.                'Alcumia',
  475.                'Red Dragon (Alcumia)',
  476.                'Hydra (Alcumia)',
  477.                'BoneDragon (Alcumia)',
  478.                'Grenade',
  479.                'Sword Dancer',
  480.                'Bardandels',
  481.                'Doom Dealer',
  482.                'Anku Heggu',
  483.                'Ammona',
  484.                'Land Crawl',
  485.                'Chamcubia',
  486.                'Bella Donna',
  487.                'Cherie',
  488.                'White Flame',
  489.                'MossFungus',
  490.                'Orcat',
  491.                'Iron Gigas',
  492.                'Death Claw',
  493.                'K.Behemoth',
  494.                'Fanfarerro',
  495.                'Necromancr',
  496.                'Ninja',
  497.                'Great Drgn',
  498.                'AvisDragon',
  499.                'Gorchimera',
  500.                'LevelCheck',
  501.                'Mind Mage',
  502.                'Fury',
  503.                'Thing',
  504.                'Mover',
  505.                'CrysDragon',
  506.                'Achelone',
  507.                'Bodyguard',
  508.                'Gilgamesh (Void)',
  509.                'Sahagin',
  510.                'Th.Anemone',
  511.                'Sea Avis',
  512.                'Corvette',
  513.                'Armon',
  514.                'SeaScorpio',
  515.                'Silvune',
  516.                'Gel Fish',
  517.                'Giant Bird',
  518.                'Sea Devil',
  519.                'Stingray',
  520.                '???? (Golem)',
  521.                'Golem',
  522.                'Chimera',
  523.                'Shiva (Metamorpha)',
  524.                'Ifrit (Metamorpha)',
  525.                'Ramuh (Metamorpha)',
  526.                'Gala Cat (Metamorpha)',
  527.                'Wyvern (Metamorpha)',
  528.                'Elf Toad (Metamorpha)',
  529.                'Crew Dust (Metamorpha)',
  530.                'Whirl Demon (Metamorpha)',
  531.                'ZombieDrgn (Metamorpha)',
  532.                'D.Chimera (Zephyr Zone)',
  533.                'AdamaGolem (Zephyr Zone)',
  534.                'Ziggurat (Zephyr Zone)',
  535.                'LonkaKnght (Zephyr Zone)',
  536.                'BioSoldier (Zephyr Zone)',
  537.                'Lunenta (Zephyr Zone)',
  538.                'Tote Avis',
  539.                'Belfegor',
  540.                'Imp (Exdeath Castle)',
  541.                'Owazoral (Exdeath Castle)',
  542.                'Garkimasra (Exdeath Castle)',
  543.                'Gabbledegak',
  544.                'Gil Turtle',
  545.                'Omega',
  546.                'Big Boss',
  547.                'None',
  548.                'WingRaptor (1st Form)',
  549.                'WingRaptor (2nd Form)',
  550.                'Karlaboss',
  551.                'Twin Tania (2nd form)',
  552.                'Siren (1st Form)',
  553.                'Siren (2nd Form)',
  554.                'Forza',
  555.                'Magisa',
  556.                'Galura',
  557.                'LiquiFlame (Human)',
  558.                'LiquiFlame (Hand)',
  559.                'LiquiFlame (Whirlwind)',
  560.                'Commander',
  561.                'Sandworm',
  562.                'Hole (Sandworm)',
  563.                '____ (Sandworm)',
  564.                'AdamanTiMi',
  565.                'FlameGun',
  566.                'Rocket',
  567.                'Exdeath (Final Battle)',
  568.                'Sol Cannon',
  569.                'Archaeavis (1st Form)',
  570.                'Archaeavis (2nd Form)',
  571.                'Archaeavis (3rd Form)',
  572.                'Archaeavis (4th Form)',
  573.                'Archaeavis (Undead)',
  574.                'Chim.Brain',
  575.                'Titan',
  576.                'Puroboros',
  577.                'Abductor (Butz Battle)',
  578.                'Gilgamesh (Dungeon)',
  579.                'Fishman',
  580.                'FlyingKillr',
  581.                "Lil'Chariot",
  582.                'NeoGalura',
  583.                'Gilgamesh (Bridge)',
  584.                'Tyrasaurus',
  585.                'Shiva',
  586.                'Abductor (Val Castle)',
  587.                'HiryuuPlant',
  588.                'HiryuuFlowr (1)',
  589.                'HiryuuFlowr (2)',
  590.                'HiryuuFlowr (3)',
  591.                'HiryuuFlowr (4)',
  592.                'HiryuuFlowr (5)',
  593.                "Gilgamesh (Zeza's Fleet)",
  594.                'Enkidou',
  595.                'Atmos',
  596.                '(Seal Guardian - Fire)',
  597.                '(Seal Guardian - Earth)',
  598.                '(Seal Guardian - Water)',
  599.                '(Seal Guardian - Air)',
  600.                'Carbunkle ()',
  601.                'Merugene (*Demo)',
  602.                'Gilgamesh (Morphed - Exdeath Castle)',
  603.                'Exdeath (Exdeath Castle)',
  604.                'Antlion',
  605.                'Mummy',
  606.                'Aspis',
  607.                'MachinHead',
  608.                'Merugene (Form 1)',
  609.                'Merugene (Form 2)',
  610.                'Merugene (Form 3)',
  611.                'Merugene (Form 4)',
  612.                'Odin',
  613.                'Gargoyle',
  614.                'Triton',
  615.                'Neregeid',
  616.                'Phobos',
  617.                'Omniscient',
  618.                'Minotauros',
  619.                'Leviathan',
  620.                'Stalker',
  621.                'Gogo',
  622.                'Bahamut',
  623.                'Jura Avis',
  624.                'Halicarnaso',
  625.                'Exdeath (vs Galuf)',
  626.                'NeoExdeath (Fake 1)',
  627.                'NeoExdeath (Fake 2)',
  628.                'Goblin (Butz Fight)',
  629.                'Iron Claw',
  630.                'Sergeant ()',
  631.                'Karnak ()',
  632.                'Crayclaw',
  633.                'NeoGoblin',
  634.                'Calofisteri',
  635.                'Apocalypse',
  636.                'Catastroph',
  637.                'Necrofobia',
  638.                'Twin Tania (1st form)',
  639.                'Launcher',
  640.                'Launcher',
  641.                'Gigamesh (Exdeath Castle)',
  642.                'Carbunkle ()',
  643.                'GrandMummy',
  644.                'Apanda',
  645.                'Alte Roite',
  646.                'Invisible',
  647.                'Abductor (Exdeath Castle)',
  648.                'BandelKuar (Phoenix Tower)',
  649.                'LiquiFlame (Phoenix Tower)',
  650.                'Kuzar (Phoenix Tower)',
  651.                'Sol Cannon (Phoenix Tower)',
  652.                'Pantera',
  653.                'Shinryuu',
  654.                'Barrier',
  655.                'Neo Exdeath (Part 1)',
  656.                'Neo Exdeath (Part 2)',
  657.                'Neo Exdeath (Part 3)',
  658.                'Neo Exdeath (Part 4)',
  659.                'Gilgamesh (Necrofobia)',
  660. }
  661.  
  662. function BitOn(number, size)    -- Determine which bits are 1's
  663.     local bit = {}
  664.     local pos = 0
  665.  
  666.     for i=1, size do
  667.         bit[i] = 0
  668.     end
  669.  
  670.     while number > 0 do
  671.         pos = pos+1
  672.         if number % 2 == 1 then
  673.             bit[pos] = 1
  674.         end
  675.         number = math.floor(number / 2)
  676.     end
  677.  
  678.     return bit
  679. end
  680.  
  681. function drawEmptyBox(X, Y, Width, Height, Color)   -- Paints an empty box unlike "gui.drawbox"
  682.     local x0 = X
  683.     local y0 = Y
  684.     local x1 = X+Width
  685.     local y1 = Y+Height
  686.    
  687.     gui.drawline( x0,y0, x1,y0, Color)
  688.     gui.drawline( x1,y0, x1,y1, Color)
  689.     gui.drawline( x1,y1, x0,y1, Color)
  690.     gui.drawline( x0,y1, x0,y0, Color)
  691. end
  692.  
  693. function EnemyInfo(Enemy)    -- Table with the parameters of monsters
  694.     local enemy = Enemy - 1
  695.     local enemyinfo = {}
  696.    
  697.     enemyinfo = {
  698.         Name            = memory.readword(0x7E4008 + enemy*(0x02)) ,
  699.       --Type            = memory.readword(0x7E4038 + enemy*(0x04)) ,
  700.  
  701.         Level           = memory.readbyte(0x7E2202 + enemy*(0x80)) ,
  702.         CurrentHp       = memory.readword(0x7E2206 + enemy*(0x80)) ,
  703.         TotalHp         = memory.readword(0x7E2208 + enemy*(0x80)) ,
  704.         CurrentMp       = memory.readword(0x7E220A + enemy*(0x80)) ,
  705.         TotalMp         = memory.readword(0x7E220C + enemy*(0x80)) ,
  706.         StatusC         = memory.readbyte(0x7E221A + enemy*(0x80)) ,
  707.         StatusT         = memory.readbyte(0x7E221B + enemy*(0x80)) ,
  708.         StatusD         = memory.readbyte(0x7E221C + enemy*(0x80)) ,
  709.         StatusP         = memory.readbyte(0x7E221D + enemy*(0x80)) ,
  710.       --MagicPower      = memory.readbyte(0x7E2227 + enemy*(0x80)) ,
  711.       --MagicPower      = memory.readbyte(0x7E222B + enemy*(0x80)) ,
  712.         Evade           = memory.readbyte(0x7E222C + enemy*(0x80)) ,
  713.         Defense         = memory.readbyte(0x7E222D + enemy*(0x80)) ,
  714.         MagicEvade      = memory.readbyte(0x7E222E + enemy*(0x80)) ,
  715.         MagicDefense    = memory.readbyte(0x7E222F + enemy*(0x80)) ,
  716.         ElementAbsorb   = memory.readbyte(0x7E2230 + enemy*(0x80)) ,
  717.         ElementWeakness = memory.readbyte(0x7E2231 + enemy*(0x80)) ,
  718.         ElementImmune   = memory.readbyte(0x7E2232 + enemy*(0x80)) ,
  719.         StatusImmunity1 = memory.readbyte(0x7E2235 + enemy*(0x80)) ,
  720.         StatusImmunity2 = memory.readbyte(0x7E2236 + enemy*(0x80)) ,
  721.         StatusImmunity3 = memory.readbyte(0x7E2237 + enemy*(0x80)) ,
  722.         Attack          = memory.readbyte(0x7E2244 + enemy*(0x80)) ,
  723.         AttackMult      = memory.readbyte(0x7E2262 + enemy*(0x80)) ,
  724.         CantEvade       = memory.readbyte(0x7E2264 + enemy*(0x80)) ,
  725.         Type            = memory.readbyte(0x7E2265 + enemy*(0x80)) ,
  726.         CommandImmunity = memory.readbyte(0x7E2266 + enemy*(0x80)) ,
  727.         Experience      = memory.readword(0x7E2267 + enemy*(0x80)) ,
  728.         Gil             = memory.readword(0x7E2269 + enemy*(0x80)) ,
  729.         InitialStatus1  = memory.readbyte(0x7E2270 + enemy*(0x80)) ,
  730.         InitialStatus2  = memory.readbyte(0x7E2271 + enemy*(0x80)) ,
  731.         InitialStatus3  = memory.readbyte(0x7E2272 + enemy*(0x80)) ,
  732.         InitialStatus4  = memory.readbyte(0x7E2273 + enemy*(0x80)) ,
  733.  
  734.         AttackGauge     = memory.readbyte(0x7E3DAB + enemy*(0x0B)) ,
  735.         Position        = memory.readbyte(0x7E4000 + enemy*(0x01)) ,
  736.         PositionY       = memory.readbyte(0x7E4000 + enemy*(0x01)) % 16 ,                  -- low nibble
  737.         PositionX       = math.floor( memory.readbyte(0x7E4000 + enemy*(0x01)) / 16 ) ,    -- high nibble
  738.     }
  739.  
  740.     return enemyinfo
  741. end
  742.  
  743. function CharacterInfo(Character)    -- Table with the parameters of allies
  744.     local character = Character - 1
  745.     local characterinfo = {}
  746.    
  747.     characterinfo = {
  748.         Character       = memory.readbyte(0x7E2000 + character*(0x80)) ,
  749.         Job             = memory.readbyte(0x7E0501 + character*(0x50)) ,
  750.         Level           = memory.readbyte(0x7E2002 + character*(0x80)) ,
  751.         CurrentHp       = memory.readword(0x7E2006 + character*(0x80)) ,
  752.         TotalHp         = memory.readword(0x7E2008 + character*(0x80)) ,
  753.         CurrentMp       = memory.readword(0x7E200A + character*(0x80)) ,
  754.         TotalMp         = memory.readword(0x7E200C + character*(0x80))
  755.     }
  756.    
  757.     return characterinfo
  758. end
  759.  
  760. while true do  -- Idle loop. Prevents pre-lua pause state
  761.     local character = {}            -- Holds the character's information
  762.     local NoCharacters = 4          -- Number of characters in a battle
  763.  
  764.     local enemy = {}                -- Holds the enemy's information
  765.     local NoEnemies = 8             -- Number of enemies in a battle
  766.     local visible = {}              -- Determines if an enemy is visible
  767.  
  768.     local DisplayBattleInfo = true  -- Display Battle Information
  769.     local boxwidth = 60             -- Enemy's ATB box width
  770.     local timer = 0                 -- In-game clock timer
  771.  
  772.  
  773.     if DisplayBattleInfo then
  774.          -- Draws character's Box
  775.         gui.transparency(0)                         -- Have no transparency
  776.         drawEmptyBox( 104, 159, 143,  55, 'white')
  777.         gui.transparency(1)                         -- Have small transparency
  778.         gui.drawbox ( 105, 160, 246, 213, 'blue')
  779.  
  780.         -- Draws enemy's Box
  781.         gui.transparency(0)                         -- Have no transparency
  782.         drawEmptyBox(   9, 159,  94,  55, 'white')
  783.         gui.transparency(1)                         -- Have small transparency
  784.         gui.drawbox (  10, 160, 102, 213, 'blue')
  785.     end
  786.  
  787.     -- Determine which enemies are hidden or visible
  788.     visible = BitOn( memory.readbyte(0x7E3EF2), 8)
  789.  
  790.     for i=1,NoEnemies do
  791.         -- Populate the enemy's information
  792.         enemy[i] = EnemyInfo(i)
  793.  
  794.         -- Display the enemy's information
  795.         -- Need to find a way to hide info when running away from battle
  796.         if DisplayBattleInfo and enemy[i].CurrentHp > 0 and visible[9-i] == 1 then
  797.             -- HP
  798.             gui.text ( offsetX + 10*(enemy[i].PositionX) ,
  799.                        offsetY + 10*(enemy[i].PositionY) + 0*(gapY),
  800.                        i .. ') HP: ' .. enemy[i].CurrentHp .. '/' .. enemy[i].TotalHp )
  801.  
  802.             gui.transparency(1)
  803.             -- Attack Gauge (painted)
  804.             gui.drawbox( offsetX + 10*(enemy[i].PositionX),
  805.                          offsetY + 10*(enemy[i].PositionY) + 1*(gapY),
  806.                          offsetX + 10*(enemy[i].PositionX) + boxwidth,
  807.                          offsetY + 10*(enemy[i].PositionY) + 1*(gapY) + 4,
  808.                          'blue')
  809.             gui.drawbox( offsetX + 10*(enemy[i].PositionX) + boxwidth*(enemy[i].AttackGauge / 128),
  810.                          offsetY + 10*(enemy[i].PositionY) + 1*(gapY),
  811.                          offsetX + 10*(enemy[i].PositionX) + boxwidth,
  812.                          offsetY + 10*(enemy[i].PositionY) + 1*(gapY) + 4,
  813.                          'black')
  814.         end
  815.     end
  816.  
  817.  
  818.     for i=1,NoCharacters do
  819.         gui.transparency(0)     -- Have no transparency
  820.  
  821.         -- Populate the character's information
  822.         character[i] = CharacterInfo(i)
  823.  
  824.         -- Display the character's information
  825.         if DisplayBattleInfo then
  826.             if math.floor(character[i].Character / 0x40) % 2 == 0 then  -- Display only info of current party
  827.                 gui.text ( 108,
  828.                            154 + 12*i,
  829.                            TableCharacter[(character[i].Character) % 8 + 1] .. ' - ' .. TableJob[(character[i].Job)+1]
  830.                          )
  831.  
  832.                 gui.transparency(1)     -- Have small transparency
  833.                 gui.text ( 205,
  834.                            47 + 24*i,
  835.                            'HP: ' ..  character[i].CurrentHp .. '/' .. character[i].TotalHp
  836.                          )
  837.  
  838.                 gui.text ( 205,
  839.                            54 + 24*i,
  840.                            'MP: ' .. character[i].CurrentMp .. '/' .. character[i].TotalMp
  841.                          )
  842.              end
  843.          end
  844.     end
  845.  
  846.  
  847.     gui.transparency(0)     -- Have no transparency
  848.  
  849.     -- In-game clock timer
  850.     gui.text ( offsetX + 225,
  851.                offsetY + 0*(gapY),
  852.                memory.readdword(0x7E094A) )
  853.  
  854.     -- In-game event timer
  855.     gui.text ( offsetX + 225,
  856.                offsetY + 1*(gapY),
  857.                memory.readword(0x7E0AFC) )
  858.  
  859.     -- # of steps in world map
  860.     gui.text ( offsetX + 225,
  861.                offsetY + 2*(gapY),
  862.                memory.readbyte(0x7E16A9) )
  863.  
  864.     -- Coordinates
  865.     gui.text ( offsetX + 225,
  866.                offsetY + 3*(gapY),
  867.                memory.readbyte(0x7E0AD8) .. ', ' .. memory.readbyte(0x7E0AD9))
  868.  
  869.     -- # of battles
  870.     gui.text ( offsetX + 225,
  871.                offsetY + 4*(gapY),
  872.                memory.readbyte(0x7E09C0) )
  873.  
  874.     snes9x.frameadvance()
  875.  
  876. end
  877.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement