Results 1 to 29 of 29

How do I edit LUA files?

  1. #1
    Mike_TDH_WI
    Guest

    How do I edit LUA files?

    Hi folks. I'm brand new here. Just recently(and finally) got a new pc to handle HW2. I have downloaded SpookRAT's big file utility and have succesfully extracted the files. However, upon opening files in notepad I get a lot of garbage....text words seem to appear fine but wherever there should be a number(digit values) I see "boxes ". What do I need to correctly view these files so that I can edit them? I have successfully done the WinBig modification process many times for HW1 and Cataclysm. The 'lua' thing is new to me.

  2. #2
    Err Crimson Editor... and a set of decompiled LUA scripts first
    Webmaster of SWRebellion.com
    SWCIC Administrator

  3. #3
    Lost in the code... Mikali's Avatar
    Join Date
    Jun 2003
    Location
    %HW2_ROOT%
    Read the FAQ.
    Download my HW2 mods, maps & tools. link
    Username|SF on Gamespy/Xfire/Hamachi/Gameranger

  4. #4
    EhraniNavy
    Guest
    LUA is a free programming language based on C, and it is used to write many things in HW2, such as Single Player Missions.

    You can also use Age2uN's LuaDC at this URL: http://www.extreme-archive.de/LuaDC.zip

  5. #5
    Member
    Join Date
    Mar 2005
    Location
    ENG-ER-LAND!
    Once decompiled, any text editor will do the job but for editing .ship, .wepn and subsytem files use the RDN spreasheets, they are a lot quicker.

  6. #6
    After you extracted the files ,at the top of the SpookRAT tool go to OPTIONS and select OVERWRITE LUA.

    Then go and select the Lua file in the left SpookRAT window that you want to decompile,click on it and go back up to the icon that has the clamp with the floppy in it and click on that.

    Your file will be decompiled so you can read it.

    Do that with each file that you want to read...thats it.

  7. #7
    Member
    Join Date
    Dec 2004
    Location
    Hafilax N.S. Can.
    Finally, try not to pull your hair out, and welcome to the asylum.

  8. #8
    Mike_TDH_WI
    Guest
    Hi there:

    Adamstrange has been working with me on trying to get my simple mod to work. I have downloaded SpookyRAT's extractor and it works fine...as far as extracting and overwriting the lua files for editting. I can extract from the bigfile(Homeworld2) and overwrite the lua files to edit. According to Adamstrange the overwritten lua files do not need to be recompressed. As far as you know...is this correct? I am editting the overwritten files in Notepad.

    I have only made numeric value edits to Health, BuildCost and BuildTime values and some numeric value edits to the singleplayer unitcaps file. And I have been careful not to add any extra spaces. I then copy the folders/files to the main data folder of HW2. And I have added '-overridebigfile' to the end of the command line of the launch icon. The game fires up for about 3 seconds and then exits out. I have installed the official V1.1 patch. The game runs fine in normal mode.

    I have also downloaded the RDN tools...ModPackager...which extracts just fine and reproduces the same extraction as SpookyRAT's tool. However...when I re-build an archive with ModPackager...the bigfile ends up some 20MB smaller than the original. And of course the game doesn't even fire up.

  9. #9
    Devil's Advocate Zatch's Avatar
    Join Date
    Feb 2004
    Location
    CA, USA
    Are you copying just the files you've edited, or all of them? I recommend only copying the files you've changed because many files are not decompiled properly (especially *.level files and almost everything in the ..\Data\UI folder.) If you're just copying the ones you've changed and it still crashes, add '-luatrace' to your Homeworld2 shortcut and then copy the contents of ..\Homeworld 2\Bin\Release\Hw2.log into a new post in this thread.

    Repackaging is useful for redistributing mods, since people only need to add '-mod <YourModName>' to their shortcuts to get it to work (I think...never actually tried it .) It is not, however, a necessity, so long as you have all of your decompiled & edited scripts in the right places (e.g. *.ship files go in ..Data\Ship\<shipname\.) If all you're doing are a couple script mods for your own education, keep things simple and avoid repackaging/recompiling.
    ~

  10. #10
    Banned BmB's Avatar
    Join Date
    Apr 2004
    Location
    Denmark
    And check ZaTcH's signature... both shipscript and wepscript is worth a look.

  11. #11
    Spartan III
    Guest
    Quote Originally Posted by Mike_TDH_WI
    Hi there:

    Adamstrange has been working with me on trying to get my simple mod to work. I have downloaded SpookyRAT's extractor and it works fine...as far as extracting and overwriting the lua files for editting. I can extract from the bigfile(Homeworld2) and overwrite the lua files to edit. According to Adamstrange the overwritten lua files do not need to be recompressed. As far as you know...is this correct? I am editting the overwritten files in Notepad.

    I have only made numeric value edits to Health, BuildCost and BuildTime values and some numeric value edits to the singleplayer unitcaps file. And I have been careful not to add any extra spaces. I then copy the folders/files to the main data folder of HW2. And I have added '-overridebigfile' to the end of the command line of the launch icon. The game fires up for about 3 seconds and then exits out. I have installed the official V1.1 patch. The game runs fine in normal mode.

    I have also downloaded the RDN tools...ModPackager...which extracts just fine and reproduces the same extraction as SpookyRAT's tool. However...when I re-build an archive with ModPackager...the bigfile ends up some 20MB smaller than the original. And of course the game doesn't even fire up.
    I have this same problem. I tested a few things, and it crashes when I try to start up a game. AFAIK it only does this when I have copied the "Scripts" file into the data file. I only changed the unit caps in the unit cap subfolder of the scripts file, but when I put and unedited scripts dile into the data it stoped working then as well.

    I have windows 2k, could this be the problem? If not does anyone know what the problem is?

    If this is not how I am supposed to edit unit caps please tell me thanks.

  12. Child's Play Donor Technical Help Senior Member General Discussions Senior Member Boardwars Senior Member  #12
    Gimme your lunch Moeney! Moe's Avatar
    Join Date
    Oct 2003
    Location
    #homeworld
    Read this:
    http://forums.relicnews.com/showthread.php?t=76627

    Also, you guys should remove any of the scripts subfolders that you are not planning on changing, especially the "formations" one seems to cause trouble.

  13. #13
    Spartan III
    Guest
    Yeah I had already read through your thread before i posted here.

    Removing the subfolders other than the one(s) I modded did the trick and I now have whatever unit caps I want.

    One last thing though: I can change the existing unit caps (LOW, Default, and High) but I want to create more options in addition to those so I can keep the old ones but also create new ones with names such as "Frigates", "Fighters" ect...
    How do I do this?

    Thanks!

  14. #14
    Mike_TDH_WI
    Guest
    Here is the contents of my 'singleplayer.lua' unitcap file;

    UC_Family("Fighter", 200);
    UC_FamilyOverride("Vaygr","Fighter", 24);
    UC_Family("Drone", 80);
    UC_Family("HeavyFighter", 50);
    UC_FamilyOverride("Hiigaran", "HeavyFighter", 50);
    UC_Family("Corvette", 200);
    UC_FamilyOverride("Vaygr", "Corvette", 12);
    UC_Family("Frigate", 200);
    UC_ShipType("EscortFrigate",20);
    UC_ShipType("TorpedoFrigate",20);
    UC_ShipType("HeavyFrigate",20);
    UC_ShipTypeOverride("Vaygr", "HeavyFrigate", 15);
    UC_ShipType("DefenseFieldFrigate",20);
    UC_ShipType("CaptureFrigate",20);
    UC_ShipTypeOverride("Hiigaran","CaptureFrigate",20);
    UC_ShipType("Monitor",20);

    UC_Family("Capital", 200);
    UC_FamilyOverride("Vaygr", "Capital", 20);
    UC_ShipType("Destroyer", 20);
    UC_ShipType("DestroyerLeader", 20);
    UC_ShipType("Carrier", 6);
    UC_ShipType("DroneCarrier", 20);
    UC_ShipType("StrikeCarrier", 6);
    UC_ShipTypeOverride("Vaygr", "Carrier", 6);
    UC_ShipType("Battlecruiser",20);
    UC_ShipType("Shipyard", 2);

    UC_Family("Utility", 50);
    UC_ShipType("ResourceCollector", 20);
    UC_ShipType("ResourceController", 4);
    UC_ShipType("Probe", 10);
    UC_ShipType("ECMProbe", 10);
    UC_ShipType("ProximitySensor", 10);

    UC_Family("Platform", 50);
    UC_FamilyOverride("Hiigaran", "Platform", 50);
    UC_ShipType("HyperspacePlatform", 4);

    UC_Family("Mothership", 1);
    UC_Family("DreadNaught", 5);
    UC_Family("SinglePlayerMisc", 100);
    UC_FamilyOverride("Hiigaran","SinglePlayerMisc", 0 );
    UC_ShipType("Mover", 10);

    UC_Family("SPMovers", 30);
    UC_Family("CommStation", 1 );

  15. #15
    EhraniNavy
    Guest
    I have windows 2k too.

    Put only the necessary files in the c:\progra~1\sierra\homeworld2\data\... folder.

    Then put -overrideBigFile.

    I am working on my SP Mod by just copying the leveldata folder into the data folder, and running with -overrideBigFile.

    Also, add -luatrace and find out what's going wrong that way as well.

  16. #16
    EvE jUnKiE
    Guest
    im sooo glad i have a friend familiar with C++, i have no idea what anyone just said.
    EDIT: im checking for help for modding, and i just replied without thinking, Moe. :loco:
    Last edited by EvE jUnKiE; 30th Nov 05 at 5:25 PM.

  17. Child's Play Donor Technical Help Senior Member General Discussions Senior Member Boardwars Senior Member  #17
    Gimme your lunch Moeney! Moe's Avatar
    Join Date
    Oct 2003
    Location
    #homeworld
    I'm so glad you told us that.

  18. #18
    Pax_Empyrean
    Guest
    I've been having some trouble with editing the research.lua file. I've got a decompiled version from data.exe and I can edit it, but the changes I've made are not showing up in the game itself. It's kind of strange; I've got two different files, both named research.lua, although one is called a "LUA file" and the other is an "LUADC file". I'm assuming DC stands for decompiled, since that's the one I can edit.

    Changes I've made to .ship files have gone through, but not the changes I've made to the upgrades in the research.lua file. I tried deleting the one that isn't decompiled, but no luck with that either. I'm guessing that the game just used the data from the Homeworld2.big file when it couldn't find the research.lua file it was looking for.

    Is there some step that I'm missing? Do I have to recompile the research.lua file somehow, or convert it to some other format to get it to work?

  19. #19
    Mostly_Harmless
    Guest
    You are using -overrideBigFile on your hw2 shortcut?

  20. #20
    Pax_Empyrean
    Guest
    Yes.

    I've got other changes implemented successfully, but the research.lua changes aren't doing anything. I have the vb6 runtime files installed, and I've got all the .dll files I need in my windows\system32 folder. I registered them, too. I really have no idea what else I could do.
    Last edited by Pax_Empyrean; 6th Jan 07 at 11:25 AM.

  21. #21
    Member
    Join Date
    Oct 2005
    Location
    City of Lights
    Make sure that the research.lua is in the proper directory and that there is no typo in folder and file names.

    Than check if the syntax of the file contents is correct. Among other things make sure that:
    - tables are effectively closed by a curly brace,
    - all lines end by a coma except when you are opening or closing the research table,
    - all strings are quoted or double quoted,
    - string indexes are properly spelled, with the proper case (for example ThingToBuild, thingtobuild, ThingtoBuild and ThingToBulid are different indexes and the game code will look only for the first ).

    A text editor with syntax highlight like notepad++ can spare a lot of screen headbanging with those small errors.

  22. #22
    Pax_Empyrean
    Guest
    Thanks for the help, I'm really stuck on this.

    The only things I've changed are the ship speed and armor upgrades. I changed their values to 1.25 and 1.5 for level one and two upgrades. The syntax hasn't been touched. Also, the files are where they were when I got them from the data.exe self-extracting archive. They're in data\scripts\building and research\hiigaran. Any other ideas what it might be?

  23. #23
    Member
    Join Date
    Oct 2005
    Location
    City of Lights
    I don't know if the files were correctly decompiled. LuaDC has often a hard time with large tables.

    You should use the research.lua file from the RDN docs.

  24. #24
    Pax_Empyrean
    Guest
    Ok, I'll do that and let you know how it went. Thanks.

  25. #25
    Bloodbane
    Guest
    Hi folks,
    I'm trying to edit LUA files but when i'm open them,all i can see is things like this.Please help me!

    Lua@  æ[¡°¹²A%���@X:\Homeworld2\Data\Scripts\Race.lua����������

    Lua@  æ[¡°¹²A%���@X:\Homeworld2\Data\Scripts\Race.lua����������

    ���NotPlayable� ���Playable����races����Invalid����� ���Hiigaran����$1100����hyperspace_gate�,���etg/special/SPECIAL_ABILITIES_HYPERSPACE_IN����HGN_����Vaygr����$1101����hyperspace_gate_vgr����VGR_� ���Keeper����$1102����hyperspace_gate_kpr����KPR_����Bentusi����$1103����hyperspace_gate_bentusi����BEN_����������#@������)@�����€2@����5���Æÿÿ�����€S���Q��Ñ��Ç���Ç��� �� ��Æÿÿ






  26. #26
    Devil's Advocate Zatch's Avatar
    Join Date
    Feb 2004
    Location
    CA, USA
    Read before posting, your question was already answered in this thread.

  27. #27
    EhraniNavy
    Guest
    Just a note:

    The link I posted earlier in this thread does not direct you to download LuaDC.

    I have mirrored it on my site, http://www.spheniscidae.co.nr/hw2sp/LuaDC.exe

    EhraniNavy

  28. #28
    gorankm
    Guest

    Plea

    Xm, Hi to ewer wane.
    I am a Homeworld believer.
    I walk true the Homeworld 2 from beginning to the end, in one breath, with no trainer and I loved and enjoy. BUT I was annoyed from copula STUPID thinks, teed Relic do.
    Sorry gays from Relic, but you rile kill some of my expectations and little of in game filing.
    So:
    - don’t have salvage corvette
    - no more ships allow to salvage than you are normally allowed (HOM1 can do)
    - no ships allow to salvage, you aren't supposed to have ( in HOM1 you don’t haw destroyer and cant build, but can salvage, normally)
    - and marine frigates are to wick
    If same remember in Homeworld you can salvage any enemy ship regardless to the number of the ships you have. O, and haw cloak generator, and can trigger hyperspace on my discretion.
    And teed my peoples are biiig field for strategy and tactics. Whit no trainers.
    So I haw a big plea for ewer vane ho wrote moods, do programming and staff, to the gays from Relic. Please make some mood al these things to bi lake in Homeworld.

  29. #29
    Devil's Advocate Zatch's Avatar
    Join Date
    Feb 2004
    Location
    CA, USA
    If I catch anybody else typing like that, mayhem will ensue.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •