[QUESTION] Add (max) HP on taking damage? / [now: Veterancy Mod]

It’s still quite buggy… (tons of errors!) :frowning:

I’m working on it right now as we speak, though.

No worries! It’s pretty complex – I’m elated that we’ve (you’ve* :smiley: ) got this far already; it’s a far cry from a week ago, when I didn’t even know an “exp” system was possible, and thought I had weeks of puzzling out Homeworld’s Lua dialect ahead just to do a crude approximation.

As you may have guessed, I’m hardly a software engineer, but I’m trying to go from “completely useless” to “slightly competent” in programming, and one thing I’ve found is that for anything above a couple lines, my first version never works perfectly. (One reason I really like working in an interpreted language is that I can repeatedly edit and run the code, instead of waiting on a compile… because I need to do a LOT of testing, heh.)

BTW, do you have a Steam wishlist? :slight_smile:

Edit: I believe the problem lies somewhere in getting the subsystem added itself, rather than in the “exp” – telling the script that starting rank and exp = 1 and 30 respectively (just to cover both bases) doesn’t appear to result in addition of vet subsystem. I added SobGroup_CreateSubSystem(CustomGroup, "vet_mod_rank1") to the Create_VeteranShip function, thinking that this would be the most direct way, and no dice either. I’ll try some other stuff; not sure if this is helpful, but just in case it saves you some time!

There was an error in the calculation for how the script determines if the ship get’s the subsystem mod.

Version 2.0a will be uploaded shortly…

ok, so it’s ATI modification, not UI. I’ll have to look into it. Disregard my previous statement ^^

Ah, yeah. That one. Still, my previous statement stands.


Edit: Here is the promised upload (currently CTDs, see below). Use the link in post #46.

You’ll notice that there is a couple of lines that read:

-- local subsName = "vet_mod_rank"..ship.rank -- DEBUG
local subsName = "hgn_veteranrank"..ship.rank -- DEBUG
print("local variable `subsName' is a "..type(subsName).." and has value `"..tostring(subsName).."'") -- DEBUG
SobGroup_CreateSubSystem(CustomGroup, subsName) -- This line generates an error

That last line generates the following error:

I’m not sure why… No tables are actually passed to the SobGroup_CreateSubSystem function.

@BitVenom, Did the function definition for SobGroup_CreateSubSystem change, or is there something else I’m missing? The rest of the code appears to be working as expected (many thanks for the custom code command!!! :slight_smile: )

Yes, I was just saying that because my previous “there’s nearly no limit to what can be done ingame” is now “I don’t know I’ve never touched the ATI system” ^^

Isn’t ::= , not = LUA’s syntax to make variable assignments?

http://www.lua.org/manual/5.1/manual.html#2.3

Wow, nice work; it’s grown quite a bit since last time I saw it. Totally baffled as to why it thinks it’s getting a table, but will keep looking, just in case I can contribute. @pascal76680, wanna help us debug it? :smiley: :stuck_out_tongue:

[quote=“Hell_Diguner, post:34, topic:1245263, full:true”]
Isn’t ::= , not = LUA’s syntax to make variable assignments?

http://www.lua.org/manual/5.1/manual.html#2.3
[/quote]No. And HWRM still uses good old Lua 4.0 (Add print(_VERSION) to any Lua file and it will return “Lua 4.0”).

With a rapid first look: seems no problem. But the game generates an error… So need to make second look.

But the error say ‘You used table but i accept string only’.

Just in case, send file where you call this function. [Update_VeteranShip() ]

It’s not the line of code itself that is the problem; it’s something to do with the subsystem…

I changed that one line of code to SobGroup_CreateSubSystem(CustomGroup, "FighterProduction") just as a test, and it worked just fine.

Ha! Apparently if it’s not a type string that the game recognizes (such as "FighterProduction", "Research", etc.), the subsystem name has to be in all caps ("VET_MOD_RANK1").

oO strange, to say the least !

Okay, nope, I lied… It does not have to be in all caps.

But!!! The ship building the subsystem has to have the line addAbility(NewShipType,"CanBuildShips",1,"","");, and the subsystem to be built has to be included in the race’s def_build.lua.

The downside is that now your build list is cluttered…

doesn’t explain why it worked when you changed to SobGroup_CreateSubSystem(CustomGroup, “FighterProduction”)
The need of the addAbility “CanBuildShips” should exist in the two cases, no ?

[quote=“Dwarfinator, post:43, topic:1245263”]
The need of the addAbility “CanBuildShips” should exist in the two cases, no ?
[/quote]I had that in there before. It’s when I started removing lines of debug code that I discovered that particular requirement.

ah ok, makes sense

Version 2.1

Rank 1: Gains +15% health
Rank 2: Gains +15% speed
Rank 3: Gains hyperspace capability
Rank 4: Gains +15% damage, +15% accuracy
Rank 5: Gains cloak ability

2 Likes

Holy smokes! NICE. :smiley: I see that a good bit of extra stuff ended up being necessary… well done! This is really impressive, and it works fantastically over here: all upgrades applied and working on schedule. Absolutely beautiful.

So my intent now is to go ahead and add veterancy to all frigates and capital ships.

  • Will my previous tactic of using CFHodEd to quickly add hardpoints be sufficient? I notice that your testfrigate UI drawing looks different, so I’m thinking maybe you did something extra to the model?

  • What code needs to be added to .ship files – same as before? The .ship file for the test frigate has “addShield” and “addAbility” lines that are new, and probably others I’m missing (and is arranged differently!), but I’m not sure if they’re part of the testing process or absolutely necessary.

(And, just in case you didn’t see above, do you happen to have a Steam wishlist with anything on it? :slight_smile: )

Thanks!

I didn’t mess with the model you sent at all. Honestly, I’m a little hesitant to use the new CFHodEd, given @BitVenom’s persistent insistence, and I’m still feeling my way around 3DSMax… But, that’s just me. :slight_smile: And no, I didn’t do anything with the UI.

The only necessary lines of code to add are:

addAbility(NewShipType,"CanBuildShips",1,"","");
addCustomCode(NewShipType,"data:scripts/lib/veteran.lua","","Create_VeteranShip","Update_VeteranShip","Destroy_VeteranShip","hgn_torpedofrigate_test",1);
StartShipHardPointConfig(NewShipType,"Veteran1","Hardpoint_Veteran1","System","Innate","Indestructible","","vet_mod_rank1","","","","","","","");
StartShipHardPointConfig(NewShipType,"Veteran2","Hardpoint_Veteran2","System","Innate","Indestructible","","vet_mod_rank2","","","","","","","");
StartShipHardPointConfig(NewShipType,"Veteran3","Hardpoint_Veteran3","System","Innate","Indestructible","","vet_mod_rank3","","","","","","","");
StartShipHardPointConfig(NewShipType,"Veteran4","Hardpoint_Veteran4","System","Innate","Indestructible","","vet_mod_rank4","","","","","","","");
StartShipHardPointConfig(NewShipType,"Veteran5","Hardpoint_Veteran5","System","Innate","Indestructible","","vet_mod_rank5","","","","","","","");

The only other line of code I added to the ship file was addAbility(NewShipType,"CloakAbility",0,2,0,4000,1,1,1,1000); since the final rank granted cloaking. (The addShield line was already present, it just got jumbled around in the midst of my code changes.)

Mind you, you don’t actually have to use the rank bonuses I did; those was just arbitrary choices on my part, just to fill the void.

I did see it, but… http://steamcommunity.com/profiles/76561198030787818/wishlist :wink:
Edit: Well, it was empty when I posted the link…

1 Like