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

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

Thanks for the quick help!

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…

Gotcha! Yeah, I saw him saying that CFHodEd is likely to foul up on you; but it seems to take quite a bit more effort to just add an empty hardpoint with 3DS or Blender, and my hope was that something so small would be okay.

(The thing I meant is the wireframe-ish drawing when selecting a unit – looks different than default torpedo frigate, but maybe it’s actually from when I edited the hardpoints – no problem, I’d go without a UI at all if it got in veteran units!)

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 like 'em! I actually wrote up a little explanation for each of them, either just for fun or possibly to be included in the “readme”, if you’re looking in that direction :wink: : “Rank 2: The crew learns to squeeze a little extra juice out of the engines. Rank 4: The gunners hone their craft and begin to target weak points. Rank 5: HQ presents your ship with a medal of honor… and a cloak generator.” Etc!

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

Ah, wishlist goblins – big problem over here too. But maybe another item can be scratched off soon… :smiley:

Hmmm, I don’t see that at all…

Haha! :smiley: