Ship Patching - Stage One


(HWRM Resurgence) #44

Can confirm this works for me.

Here’s copy pasta from my patched battlecruiser.

I use HW2 Classic models to get accurate positions for my new hardpoints.
Program is obviously blender 3d.

This is just one hardpoint.

Patch_Priority = 3.0
Patch_Exclusive = 0
Patch_Ops = {
hp_1 = {
    root = "Root",
    name = "Hardpoint_Af1_Position",

	--WIDTH(x) HEIGHT(y) LENGHT(z)
	--In Blender 3D lenght(z) is (y) and it is inversed.

    pos = { 76.99847, 20.8371, 297.27725 },

	--RADIANS Z is inversed in Blender.
	-- 3.141R = 180D
	-- 1.570R = 90D

    rot = { 0.0766, 0.0157, -0.2067 },
    axis = { 0, 0, 0 },

    subs = {
        hp_2 = {
            root    = "Hardpoint_Af1_Position",
            name    = "Hardpoint_Af1_Rest",
            pos        = { 0, 0, 10 },
            rot        = { 0, 0, 0 },
            axis    = { 0, 0, 0 },
        },
        hp_3 = {
            root    = "Hardpoint_Af1_Position",
            name    = "Hardpoint_Af1_Direction",
            pos        = { 0, 10, 0 },
            rot        = { 0, 0, 0 },
            axis    = { 0, 0, 0 },
      },
    },
  },
}

In battlecruiser.ship file it looks like this
StartShipHardPointConfig(NewShipType,“Hardpoint_Af1”,“Hardpoint_Af1”,“Weapon”,“Innate”,“Damageable”,“hgn_pds_turret”,"","","","","","","","");

EDIT: Missed one } from patch code. Fixed now.


(Sastrei) #45

Sure enough! Awesome work @unifin. For the math impaired among us, how did you get the rot values?

Also, missing a closing curly brace at the very end of your example.


(HWRM Resurgence) #46

Online calculators like this one. http://www.rapidtables.com/convert/number/degrees-to-radians.htm

Basically just converting degrees to radians. As rot(rotation) values use radians.


(ajlsunrise) #47

Using:

hp_1 = 
{
    root = "Root",
    name = "Hardpoint_Turret2_Position",
    pos = { 0, 13, -207 },
    rot = { 0, 3, 0 }, // 3 radians should rotate the hardpoint to face (mostly) backwards
    axis = { 0, 0, 0 },
},

And:

StartShipHardPointConfig(NewShipType,"Weapon IonBeam 2","Hardpoint_Turret2","Weapon","Innate","Damageable","Hgn_BattleCruiserIonBeamTurret","","","","","","","","");

Yields:

I chose 3 instead of 3.141… just in case of rounding/“overflow” errors.

For kicks and giggles, I tried

hp_1 =
{
    root = "Root",
    name = "Hardpoint_Turret2_Position",
    pos = { 0, 13, -207 },
    rot = { 0.0766, 0.0157, -0.2067 },
    axis = { 0, 0, 0 },
},

And got the same result.


(ajlsunrise) #48
hp_1 =
{
    root = "Root",
    name = "Hardpoint_Turret2_Position",
    pos = { 0, 13, -207 },
    rot = { 0.0766, 0.0157, -0.2067 },
    axis = { 0, 0, 0 },
    
    subs = {
        hp_20 = {
            root    = "Hardpoint_Turret2_Position",
            name    = "Hardpoint_Turret2_Rest",
            pos        = { 0, 0, 10 },
            rot        = { 0, 0, 0 },
            axis    = { 0, 0, 0 },
        },
        hp_21 = {
            root    = "Hardpoint_Turret2_Position",
            name    = "Hardpoint_Turret2_Direction",
            pos        = { 0, 10, 0 },
            rot        = { 0, 0, 0 },
            axis    = { 0, 0, 0 },
        },
    },
},

Same result. Version 2.1 is displayed on the Main Menu Screen.


@Unifin: Using the exact code you provided (with a different subsystem):


(HWRM Resurgence) #49

Strange because for me it works.


(ajlsunrise) #50

Are you in any of the public patch-previews/betas or whatever they’re called?


Well at the very least, children positioning work:

hp_20 =
{
    root = "Root",
    name = "Hardpoint_Rotate",
    pos = { 0, 15, -300 },
    rot = { 0, 3.1415927, 0 },
    axis = { 0, 0, 0 },
},
hp_21 =
{
    root = "Hardpoint_Rotate",
    name = "Hardpoint_Turret3_Position",
    pos = { 0, 5, 0 },
    rot = { 0, 0, 0 },
    axis = { 0, 0, 0 },
},


(Sastrei) #51

I’m on v2.205


(HWRM Resurgence) #52

Same here. v2.205


(Liuruoyang1995=Lone Wolf Akela) #53

There‘s a built-in function in Lua: rad()
So you can use things like “rot = { rad(45), rad(45), rad(45) }” to convert degrees to radians.


(Gregorymthompso1) #54

i didn’t realize there was a new version and will update to 2.205 to see what happens then


(Taiidan Republic Mod) #55

I thought steam updated automatically. Since when do we have to manually update?


(Gregorymthompso1) #56

steam does when you’reconnected. i have really slow internet and meager download limits so i keep my game computer offline except when necessary (things like the windows login page needlessly use up bandwidth that i’d like to save for other things).


(HWRM Resurgence) #57

since this :smiley: Announcement - Public Patch Preview


(ajlsunrise) #58

Just opt-ed in to the patch preview… Downloading now…


(Gregorymthompso1) #59

i updated HWRM and tried your code and it still doesn’t work.

with -taceHODs on, i get a log error w “data:\Ship\HGN_BATTLECRUISER\Patches\HARPOINTS.LUA” – parameter: expected…

i even changed the weapon to hgn_KinetcBirstCannonDestroyer to make it more noticeable if it did work. no crash, but no luck


(HWRM Resurgence) #60

I think you need to add one } to end of your hardpoints.lua

Because i did not paste it into code which i previously posted here.

I actually tried it without } and got same result.

LUA 'data:Ship\HGN_BATTLECRUISER\Patches\PATCH_BATTLECRUISER.LUA' -- parameter: <name> or `[' expected;
  last token read: `<eof>' at line 495 in string ""

Fixed original code reply.

Linky to code reply


(ajlsunrise) #61

Version 2.205: rot = {0, 3.14, 0} and rot = {3.14, 0, 3.14} both have no effect.


(Sastrei) #62

See if the LUA rad function works:


(ajlsunrise) #63

I don’t see why it would have an effect if straight numbers don’t.

And it didn’t.

Interestingly enough, I can effect rotation changes to pre-existing hardpoints, just not new ones.