Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2016
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.62 KB | None | 0 0
  1. I've written the script , which allow us to start arcomage game from anywhere, also i've added game event - end of arcomage games launched this method (though i did not understand classical concept for events in this system, so it just memhook, which calls empty function, which user can define), and function to recieve result of last arcomage match (it would be logical to have this result as returning value of StartArcomage() function, but it is impossible due to the system).
  2.  
  3. It is stable (at least i've fixed everything i could find for now), but it consists of six asm-injections, so, in theory, it could confront with other's hooks. Game mechanism is very hard to understand in disassembly, so i could not just write something, what will call arcomage in one asm-command, and i even dont sure if it is posible due to many functions called before and between arcomage initialiazation and start. I did not inspect all of them, but i've tried to pass one or another, and always it ended with failure or game crash. (Tested only on mm8 GOG version)
  4.  
  5. I would to ask you to publish this script in your theme, because i'm not able to do it myself.
  6.  
  7. Description for it:
  8.  
  9. "Arcomage.lua - script to manage arcomage games in Might and Magic 8. Put it into your "...\Scripts\General" folder.
  10.  
  11. Functions:
  12. 1. StartArcomage(TowerToWin, ResourceToWin, PlayersStartTower, PlayersStartWall, PlayerStartHammers, PlayerStartGems, PlayerStartMonsters, PlayerStartProduction, PlayerStartMagic, PlayerStartRecruitment, [Same 8 (from StartTower to Recruitment) params for enemy player in same order], Ai)
  13. All params is numbers between 1 and 65355 (though, i cannot imagine any point to set anything to more than 1000). Params after PlayerStartRecruitment is not neccessary, if you will not define them, they'll be copied from player's params, Ai will become random.
  14. I feel your question like: "What is Ai?", - i dont know. It is not even straight Ai. Game mechanism use house index to define arcomage rules, i found that if all rules just defined manualy, enemy in match will do nothing. So Ai - it is number between 1 and 11 accordingly to 107 - 117 - indexes of taverns in 2Devents.txt for mm8. This index will be set inside arcomage initialization function in mm8.exe where it should be to prevent lack of Ai in game. I dont know if diffrent indexes will provide diffrent Ai behaivor.
  15.  
  16. 2. GetLastAMresult() - nothing to add. No params. Will return: 0 - dead heat, 1 - player won, 2 - enemy won, 3 - game was interrupted by player.
  17.  
  18. 3. Eventual function - ArcomageMatchEnd() - empty by deafult. Triggered after end of match started by StartArcomage(). Define it before start of match by standart construction: function ArcomageMatchEnd(!params must be empty!) <your commands> end. Most casual way it is to use GetLastAMresult() as first command in ArcomageMatchEnd, and then do something depends on match result. Dont forget to make ArcomageMatchEnd() empty again after.
  19.  
  20. Thats all. It is briefly tested only on mm8 GOG version, for any bugs - answer in this theme, i can read it, though i can not answer due to profanity of... mmm... issues in the site registration system."
  21.  
  22. End of description.
  23.  
  24. Also on your site you've asked about adresses in game memory, so it is list of revealed durning script creation:
  25.  
  26. Arcomage variables:
  27.  
  28. Dwords - 0x516CC0, 0x516CC4, 0x516CC8, 0x516CCC, 0x516CD0, 0x516CD4, 0x516CD8, 0x516CDC - player resources on start of arcomage.
  29. Dwords - 0x516C04, 0x516C08, 0x516C0C , 0x516C10, 0x516C14, 0x516C18, 0x516C1C, 0x516C20 - enemy resources on start of arcomage.
  30.  
  31. 0x516BE0 - Name in upper left corner of arcomage screen (Player).
  32. 0x516C9C - Name in upper right corner of arcomage screen (Enemy).
  33.  
  34. Dword - 0x4f2d58 - Tower tallness for victory.
  35. Dword - 0x4F2D5C - Amount of any resource for victory.
  36.  
  37. Dword - 0x516e1c - storing AM match result.
  38.  
  39. All adresses above represent variables for arcomage game. Game-mechanism setting them durning AM initialization depending on current house index (house index == 0, while you are not in any house, this could cause crash, but Ai param in StartArcomage() fixing it). Arcomage preset rules are stored somewhere near 0x4f2d5c (I've found ones for Regna), but i did not spend time for them, in my opinion, there is no point to change something in preset arcomage games in taverns. "Enemy" and "Player" lines depends on house index too, but in each preset rules they are same: "Enemy" and "Player". I've tried to set them in StartArcomage() too, but words longer than 8 chars looks really weird in interface and it is not something important, so i've left them untouched.
  40.  
  41. Global variables (mostly thoughts, i can not be 100% sure about any):
  42.  
  43. Dword 0x519328 - equal 0x51865c while you in any house screen, otherwise - 0... "Do not seek reason. You can not comprehend!"
  44. Dword 0x51e330 - equal 0x1 at game-way arcomage start, otherwise - 0, defines few further jumps.
  45.  
  46. And few more which i forgot durning this four days of waitig, because i saw their affects, but avoid to touch them in current version of script.
  47.  
  48. Function 0x40A811 - arcomage initializaton, Ai param used there.
  49. Function 0x40a9f1 - arcomage module itself.
  50. Function 0x42edd8 - most interesting thing. Looks like it is event handler. As "event" here i mean any user's action plus lots of background tasks. First i did use call, which on some point launched this function and then arcomage by it (was buggy), now i just set params and it launchs arcomage at next iteration.
  51.  
  52. Also, i use few adresses from .data segment (one of worst crutches): from 0x5015fc to 0x50161f for asm-injections variables. By deafult it is error message text, which i've never saw in game : "D:\mm7src\mm8\...".
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement