PDA

View Full Version : the woes of .lua editing



rocket_Magnet
25th Sep 03, 11:31 AM
i know theres several requests for this kind of stuff, but none are that specific (yes i used the search function! :omg: )

well i had a pop at it, and it went all horribly worng
now when i start up several of the missions nothing jumps in and i get mission failed

so this is a humbel request for the 2 files i need

persist3.lua and persist4.lua both with sajuuk and a dreadnaught added if its not too much to ask for

even when i tried deleting what i had put in i get the same, and i forgot to back them up :bombface: so pleaaseee someone hand over the two files, there only about 20kb combined.. go on you know want to help a helping noob in need :)

Sandalpocalypse
25th Sep 03, 11:36 AM
Persist3.lua (http://www.deadlyshoe.com/Homeworld/persist3.lua) and Persist4.lua (http://www.deadlyshoe.com/Homeworld/persist4.lua), unmodified, from my campaign.

You'll have to get someone else to mod in the ships, though...sorry.

rocket_Magnet
25th Sep 03, 11:40 AM
thanks
:)

id have a pop at modding again, but i have a sneaking suspicion the same thing would happen again :)

Mnementh
25th Sep 03, 12:59 PM
A bit of advice when modding the persist files. { begins a section } ends one. Make sure these parenthesis match up and encase each section they exist for (usually one set per ship) otherwise ships will not hyper in.

Ghent
25th Sep 03, 1:36 PM
here's how to edit your persist##.lua file:

- first scroll down until you see this line

Squadrons = {

- immediately under that, add these lines, just copy paste

{
tactic = 0,
type = "Hgn_Dreadnaught",
subsystems = {
},
buildjobs = {
},
size = 1,
shiphold = {
},
name = "",
teamColourHandle = 0,
hotkey = 4096,
},
{
tactic = 0,
type = "Hgn_Battlecruiser",
subsystems = {
{
index = 0,
name = "HGN_BATTLECRUISERIONBEAMTURRET",
},
{
index = 0,
name = "HGN_BATTLECRUISERIONBEAMTURRET",
},
{
index = 0,
name = "HGN_BATTLECRUISERENGINE",
},
{
index = 0,
name = "HGN_C_MODULE_FIRECONTROL",
},
},
buildjobs = {
},
size = 1,
shiphold = {
},
name = "",
teamColourHandle = 0,
hotkey = 1088,
},

what this does is give you a Hiigaran Dreadnaught, hotkeyed to group 10, with colorscheme "0". The name section really isn't important unless you want it to be controlled by a sequence in a .nis movie inside the mission.

The second entry/group is for the Hiigaran battlecruiser, same deal, group 8 hotkey this time, colorscheme 0.

- General formatting -
you'll notice the { and } brackets. They have to be all matched up, opening and closing brackets, around each ship, subsystem, color values, etc, otherwise the .lua file is b0rked, and basically it won't read all the ships right, won't position your mothership in the mission, and thus you fail right after it loads up. IF there's anything after the bracket, include a comma (,) after it, no spaces, then hit enter. I don't know if blank lines are ok or not, but to be safe, dont include any. Make sure each bracket is opened and closed properly, and each bracket is on it's own line.

Want a battlecruiser with some fighters in it? Try this:

{
tactic = 0,
type = "Hgn_Battlecruiser",
subsystems = {
{
index = 0,
name = "HGN_BATTLECRUISERIONBEAMTURRET",
},
{
index = 0,
name = "HGN_BATTLECRUISERIONBEAMTURRET",
},
{
index = 0,
name = "HGN_BATTLECRUISERENGINE",
},
{
index = 0,
name = "HGN_C_MODULE_FIRECONTROL",
},
},
buildjobs = {
},
size = 1,
shiphold = {
{
index = 0,
type = "Hgn_Interceptor",
hotkey = 0,
teamColourHandle = 0,
size = 5,
tactic = 1,
},
{
index = 0,
type = "Hgn_Interceptor",
hotkey = 0,
teamColourHandle = 0,
size = 5,
tactic = 1,
},
{
index = 0,
type = "Hgn_ECMProbe",
hotkey = 0,
teamColourHandle = 0,
size = 1,
tactic = 0,
},
},
name = "",
teamColourHandle = 0,
hotkey = 1088,
},

...now if you wanted that battlecruiser to NOT have a firecontrol tower, but be working on building it, then paste in something like this:

{
tactic = 0,
type = "Hgn_Battlecruiser",
subsystems = {
{
index = 0,
name = "HGN_BATTLECRUISERIONBEAMTURRET",
},
{
index = 0,
name = "HGN_BATTLECRUISERIONBEAMTURRET",
},
{
index = 0,
name = "HGN_BATTLECRUISERENGINE",
},
},
buildjobs = {
[0] = {
[0] = {
name = "HGN_C_MODULE_FIRECONTROL",
rusSpent = 50,
},
},
},
size = 1,
shiphold = {
{
index = 0,
type = "Hgn_Interceptor",
hotkey = 0,
teamColourHandle = 0,
size = 5,
tactic = 1,
},
{
index = 0,
type = "Hgn_Interceptor",
hotkey = 0,
teamColourHandle = 0,
size = 5,
tactic = 1,
},
{
index = 0,
type = "Hgn_ECMProbe",
hotkey = 0,
teamColourHandle = 0,
size = 1,
tactic = 0,
},
},
name = "",
teamColourHandle = 0,
hotkey = 1088,
},

Please note that the variable "size = #," ONLY works for ships that comes in squadrons. This isn't like HW map making, for ships other than fighters & vettes that come out in squads of 5 or 3, you MUST specify EACH individual ship you want to start with.


- Color Schemes -

near the top, just after the research section, you'll scroll down and see this:

TeamColours = {
...this is the colorscheme section... and one of my biggest gripes with Relic right now, other than the fact that I STILL dont think they did the mechanics of turrets right in HW2, just like in HW1. GRRR! IT's incredibly stupid, while also allowing a lot of customization. EVERY single fricking time a mission starts up, the stupid game pastes in an entirely new section of default team colors at the top of this list, thus shifting up all the colorscheme numbers you worked so hard to get in order last mission, and DEFAULTING your nifty custom colorscheme that you just set up all over again. You will still start the next mission with all your custom colored ships and custom badge, but anything new you build will be back to the old boring blue & white default colors with the Hiigaran badge. By the time you get to around mission 9 or 12, there's OVER 37 CUSTOM COLORSCHEMES!!!!!!!!!!!!! This is fricking ridiculous relic. THey aren't even all used! Almost all of them are redundant and identical. :madashel: :flame: :mad:

Anyways... here's how to modify colorscheme 0, which is the top most colorscheme and what I usually use as my most common "default" colorscheme for a mission. Look again at the brackets and make sure they're opened & closed properly:

{
trailColour = {
0.36500,
0.55300,
0.66700,
},
badgeTexName = "PROFILES:badges/DPWHITE3D.TGA",
baseColour = {
0.50588,
0.38040,
0.12941,
},
stripeColour = {
0,
0,
0,
},
},

...what i've done here is leave the default trail color in, a light blue to match the engine color on most Hiigaran ships. Then I put in a custom badge from my badges folder, notice this is different from most of the other default badges in a persist#.lua file (like "DATA:Badges/Hiigaran.tga"). Then I put my own custom base & stripe colors in. Dark brown/tan and black to be specific. The colors are not in RGB 256 color # format, but in decimal format, where 1 = white, and 0 = black. Top is Red, Middile is Green, Bottom is Blue. Simply take the normal color # that you would use like in Paint Shop or Photoshop, and divide it by 255 (because the numbers actually go from 0-255 for a total of 256 colors). So in other words, this would give all red:
baseColour = {
1,
0,
0,
},

this would give magenta:
baseColour = {
1,
0,
1,
},

this would give yellow
baseColour = {
1,
1,
0,
},

and this would be some sort of light khaki desert color (rgb 192, 177, 141)
baseColour = {
0.75294,
0.69412,
0.55294,
},

rocket_Magnet
25th Sep 03, 1:40 PM
thanks for the advice mnementh :)
thank you very very much for the tutorial ghent :D

i would suspect that i was putting cpaital ships and or frigates into shipholds hence it buggering up :)

one last question is it possible to put a hyperspace module in sp (onto yer ms or a bc) and would the line be HGN_C_MODULE_HYPERSPACE ?

EDIT: well i can get the bcs in ok, but if i try the above line it comes up with mission failed :/ should it be _BC_ ?

Ghent
25th Sep 03, 1:54 PM
I'm not sure, but i doubt it. Hyperspace is disabled for SP unless it's scripted or by a hypergate. Never give up till you try tho :)

Follow the patterns outlined above for ships & modules, and give it a try.

rocket_Magnet
25th Sep 03, 1:58 PM
ok, its just i havent tried jumping to the command post with bcs yet.... but when it went to the cinematic of the ms jumping closer to the command post (m04) the dreads were left behind, and with both of them (the bc and the dread) travelling at 69 i cant wait around for them :x

Camelot One
25th Sep 03, 5:22 PM
I just tested. I tried to hyperspace a sajuuk in mission 8. Worked just fine. (though it quickly died because I jumped right up on one of the radiation panels) I would say that maybe hyperspacing isn't an option for ships that are supposed to be there, but it seems to work with add-ins.

Langy
25th Sep 03, 6:56 PM
Sajuuk can always hyperspace - it's just a part of that ship, as seen by m15. Now, other ships might not be able to, though I've heard that it DOES work if you add in the hypermodule. I, personally, haven't tried it, though.

Miguel
25th Sep 03, 8:55 PM
The ship is a freaking GOD, and it is defeated by the smoldering remains of a Bentusi ship? So stupid. Sajuuk ought to be invulnerable to that.

I'm kind of confused, if M8 is the Hyperspace FOundy level it's equally if not more stupid. The movers aren't damaged but Sajuuk is?

Langy
25th Sep 03, 9:54 PM
They didn't script Sajuuk to be invulnerable to those things, as he normally wouldn't be anywhere near them, thus they didn't need to.

rocket_Magnet
26th Sep 03, 2:27 PM
alas! i reuqire your assitance again!, ive tried fiddling with sajuuk, but the name i use seems to be wrong, same goes for either destroyer (vgr or hgn) and i still dont have a clue what the right name for the hyperspace module is.... i tried HGN_C_MODULE_HYPERSPACE but it got a bit angry and said mission failed

DABhand
26th Sep 03, 3:54 PM
Am I right in thinking that the lua files is in connection with the LUA language created by Tefal (Scientists with big foreheads) boffins?

rocket_Magnet
26th Sep 03, 4:59 PM
ok i seem to have found the solution to my question above in a way... to add a hyperspace module the hyperspace research permissions need to be there (the lines at the top saying what you can and cant have) problem is i dont have a clue what the value for hyperspace is :x

nickersonm
26th Sep 03, 5:15 PM
http://www.lua.org/

DABhand
26th Sep 03, 5:18 PM
yeah that would be that language lol

I grabbed some spreadsheet stuff etc, but damn they dont work well on a NT platform :(

Ghent
27th Sep 03, 12:03 AM
Rocket, you might try different permutations of the word "hyperspace" , like "HSPACE" or somet...

Also, module names seem to change between ships, such as these:

HGN_DES_ENGINE - on a Hiigaran destroyer, main engines

HGN_C_ENGINE - on a carrier

HGN_MS_MODULE_FIRECONTROL - on the MS
HGN_MS_INNATE_ENGINE - also on the MS, main engines

HGN_SY_INNATE_ENGINE - on the shipyards
HGN_MS_MODULE_FIRECONTROL - also on the shipyards :\ wierd

HGN_C_MODULE_FIRECONTROL - on the battlecruiser
HGN_BATTLECRUISERENGINE - also on the battlecruiser

...so as you can see, we're definitely NOT dealing with any sort of nice neat naming convention here. (hint Relic - nice neat naming convention would have been really nice! ;) ) .........unfortunately.......... seems to be a very proprietary naming convention, with no set rules other than that sometimes the module follows with the name of the ship it is on.

Thought
27th Sep 03, 12:16 AM
hgn_ms_module_hyperspace for Hyperspace module for the Mothership.

It works like this, race_ship_type_name.

:)

rocket_Magnet
27th Sep 03, 4:17 AM
/me mumbles at relic... ill try HGN_BC_HSPACE or HYPERSPACE then and see what happens:muffy:


wierd HGN_C_HYPERSPACE worked this time Oo

mecha
27th Sep 03, 9:07 AM
the subsytem names are names of subsystems... so check out the file names in data/subsystems/...

Also, naming schemes and artists sometimes curdle when mixed.

Actually hw2 had some of the most technically sympathetic artists I've ever worked with and mostly the naming schemes make sense.

Smeerak
27th Sep 03, 10:35 AM
Originally posted by rockeT_magnet
ok i seem to have found the solution to my question above in a way... to add a hyperspace module the hyperspace research permissions need to be there (the lines at the top saying what you can and cant have) problem is i dont have a clue what the value for hyperspace is :x


hmmm ... very tempted to code a C++ proggie to read in and mod the files ... could be a lot fun actually. Dosen't look to be too hard either ... anyone else already doing this?

Ghent
27th Sep 03, 8:55 PM
well... anyways... yes I can understand that mecha, and thanks for your comments; however, at the same time it is a bit unconventional to have a HGN_C_MODULE_HYPERSPACE work for a battlecruiser and a carrier, instead of the conventional HGN_BC_MODULE_HYPERSPACE

Then of course the engines vs. engine_innate issue was a bit confusing also, but already pointed that one out.

Any chance of getting this docked as a persist#.lua tutorial thread? or should I re-write up a new post about it all with an appropriate title?

Dragon Lord
28th Sep 03, 6:56 AM
about hyperspacing in sp:

(Spoiler warning)

The vaygr battlecruisers which guard the gate to sajuuk have hyperspace modules and when you capture one (I did because it was way faster than building a new one :) ) it can hyperspace, and all ships in its hyperspace sphere can do too, just like in multi.

It's really handy in the mission which follows: you can just jump your dreadnought and bc's right onto the shipyard and after its killed to the vaygr mothership(which has a hyperspace inhibitor but doesn't use it :twisted: )

rocket_Magnet
28th Sep 03, 11:12 AM
getting this docked, with more helpful tips would be good
as more and more people are starting to edfit the .lua files and generally mess about with homeworld2 :)