| 04-21-2008, 12:07 AM | #1 |
As some people already know, I have recently created an AMHS for Wc3 which is essentially an engine that emulates unit shadows/graphics and then hides those unit graphics/shadows for units that are not visible by a player (the link to the system is in my signature) What is however the major disadvantage of the system is that the users have to manually input the shadow data for EVERY unit in the object editor that is used by the map. I am basically hoping to automate this process using GrimeX using an lua script however im not sure how exactly how to script is (since this is the first time im using LUA). Basically what the script needs to do is to search through every Unit Object ID, see if it used by the map, read the UnitShadow/ShadowX/ShadowY/ShadowH/Shadow values, alter the configuration trigger to add those values into the RegisterUnitShadow function. What is also very important is that the script must update the changes made by the object editor to unit shadows. What is very handy about this is that it means that users can update the shadow values in the object editor and it will automatically update in the configuration script when they run it What is even more vitally important however is that the script must also alter the UnitShadow value to NONE when the map is saved. When the map is loaded, the UnitShadow value will be changed to its appropriate value in the shadow configuration trigger HOWEVER when the map is saved then the UnitShadow value in the object editor gets set to NONE (since the AMHS emulates shadow's they need to be disabled when the map is saved) This is how my first approach to what the script would do Map Save Script 1. Firstly check through wc3script.j and get every Unit Rawcode that is seen in the map and place it in an array 2. Loop through array for every unit in the object editor and read the shadow data for that unit 3. Find the configuration trigger, and update the values read from the object editor into the configuration trigger. Map Load Script 1. Read through every Unit Rawcode - UnistShadow in the configuration trigger and change the Object Editor UnitShadow value for that unit to the value in the configuration trigger Obviously the map load script will be put inside a trigger (possible the map configuration trigger itself) however if possible the Map Save Script should be automatically executed whenever the user saves their map -> if this however increases the save time by a lot then don't bother |
| 04-21-2008, 05:39 PM | #2 |
None of the grimex tools allows to scan the script for units. Getting and resetting the unit editor properties is possible with the ObjectMerger. Changing an existing trigger is not possible, but you could simply generate a configuration.j file that gets included with a vJass //! import (requires minimal imporovement of the ObjectMeger tool first). However as stated above, you can't scan for units with it. You could of course create a custom command line tool that finds the units and integrate it with the existing toolset with little effort, provided you know some real programming language like c++ or delphi. Finally, having the tool run on every save can be achieved by a simple edit of Grimoire's wehack.lua. |
| 04-21-2008, 10:30 PM | #3 | |
Quote:
What about every load? Also is there a reason why you cant scan units, can't you make a direct reference to the war3script.j file with LUA and then use LUA's functions to parse the script? |
