Fractal Softworks Forum

Please login or register.

Login with username, password and session length

Author Topic: how do I make a custom weapon for my mod?  (Read 5252 times)

sKarpunch

  • Lieutenant
  • **
  • Posts: 69
    • View Profile
how do I make a custom weapon for my mod?
« on: September 12, 2012, 02:57:13 AM »

Heya Guys,

Right, i have done the coding in the weapon_data.csv, that's pretty easy, but i dont know how to do the actual weapon file (eg. plasma.wpn). Could a modder with some experience gimmie a hand?
This is my very first serious attempt at modding so sorry for being so blatantly nooby.

cheers  ;D , sKarpunch
Logged
One should be a well of knowledge, not a fountain.-Reddit

-----------------------
END TRANSMISSION
-----------------------

ValkyriaL

  • Admiral
  • *****
  • Posts: 2145
  • The Guru of Capital Ships.
    • View Profile
Re: how do I make a custom weapon for my mod?
« Reply #1 on: September 12, 2012, 08:40:31 AM »

Copy the weapon and projectile file of the weapon most similar to the one you are going to make and work from there, you find them in the same place you are going to put your own,"see below" and to start out from that weapon's stats, go into the vanilla weapon.csv and copy the weapons stats and place it in your own.

folder structure for this would be data/weapons*place weapon.wpn file here along with your weapon.csv*/proj*place projectile file in here*

here is the weapon/projectile files for my custom Vulcan cannon so you can see what they look like.
WEAPON
Code
{
"id":"burst",  # this id must match what's in the spreadsheet
"specClass":"projectile",
"type":"BALLISTIC",
"size":"SMALL",
"displayArcRadius":250,
"turretSprite":"graphics/weapons/burst_cannon_turret_base.png",
"turretGunSprite":"graphics/weapons/burst_cannon_turret_recoil.png",
"hardpointSprite":"graphics/weapons/vulcan_cannon_hardpoint_base.png",
"hardpointGunSprite":"graphics/weapons/vulcan_cannon_hardpoint_recoil.png",
"renderHints":[RENDER_BARREL_BELOW],
"visualRecoil":3.0,  # the gun sprites are only used if this is non-0
"turretOffsets":[10, -2, 10, 2],
"turretAngleOffsets":[0, 0],
"hardpointOffsets":[15, -2, 15, 2],
"hardpointAngleOffsets":[0, 0],
"barrelMode":"ALTERNATING", # or LINKED.  whether barrels fire at the same time or alternate.
"animationType":"MUZZLE_FLASH",
"muzzleFlashSpec":{"length":20.0,   # only used if animationType = MUZZLE_FLASH
  "spread":6.0,
  "particleSizeMin":6.0,
  "particleSizeRange":8.0,
  "particleDuration":0.15,
  "particleCount":7,
  "particleColor":[255,240,165,200]},
"projectileSpecId":"vulcan_shot",  # projectile that will be fired
"fireSoundOne":"gun_mechanicals_light_up_whirr",
"fireSoundTwo":"gun_rapid_2",
}
PROJ
Code
{
"id":"burst_shot",
"specClass":"projectile",
"spawnType":"BALLISTIC_AS_BEAM",
"collisionClass":"RAY",
"collisionClassByFighter":"RAY_FIGHTER",
"hitGlowRadius":15,
#"spawnType":"BALLISTIC",
#"collisionClass":"PROJECTILE_FF",
#"collisionClassByFighter":"PROJECTILE_FIGHTER",
"length":45.0,
"width":3.5,
"fadeTime":0.3,
"fringeColor":[240,220,180,200],
"coreColor":[245,245,225,80],
"textureScrollSpeed":64.0,
"pixelsPerTexel":5.0,
"bulletSprite":"graphics/missiles/shell_small_yellow.png"
}
If you need more help il come back.
« Last Edit: September 12, 2012, 08:42:48 AM by ValkyriaL »
Logged

sKarpunch

  • Lieutenant
  • **
  • Posts: 69
    • View Profile
Re: how do I make a custom weapon for my mod?
« Reply #2 on: September 12, 2012, 05:30:01 PM »

thanks very much, I've encountered another problem, sorry if im being a nuisance but this shows up after using trylobot's ship editor and putting the (very in dev) mod in the mod file:



thanks for any help i recieve, sKarpunch

Logged
One should be a well of knowledge, not a fountain.-Reddit

-----------------------
END TRANSMISSION
-----------------------

ValkyriaL

  • Admiral
  • *****
  • Posts: 2145
  • The Guru of Capital Ships.
    • View Profile
Re: how do I make a custom weapon for my mod?
« Reply #3 on: September 12, 2012, 05:48:41 PM »

"Battle barge" is not a ship size, you chose from the category when you make the .ship file in Trylobot's editor.

"spritename" is the name of the picture that is your ship and the class path to find it, "graphics/ships/battlebarge.png", for example

"style" is the epoch your ship belongs to, you have CAPITAL_SHIP in that, when you should have LOW_TECH or any of the others.
this also applies when making engines.
In the list it should look like this, but with your text of course
Spoiler
[close]
and like this in the .ship file if you open it, but with whatever info you have on your ship of course :P "this quote is huge so prepare to scroll"
Spoiler
Quote
{
  "bounds": [
    159.0,
    13.0,
    124.0,
    13.0,
    124.0,
    32.0,
    115.0,
    38.0,
    115.0,
    77.0,
    95.0,
    92.0,
    -141.0,
    92.0,
    -177.0,
    76.0,
    -177.0,
    24.0,
    -148.0,
    10.0,
    -110.0,
    10.0,
    -107.0,
    3.0,
    -107.0,
    -3.0,
    -110.0,
    -10.0,
    -148.0,
    -10.0,
    -177.0,
    -24.0,
    -177.0,
    -76.0,
    -141.0,
    -92.0,
    95.0,
    -92.0,
    115.0,
    -77.0,
    115.0,
    -38.0,
    124.0,
    -32.0,
    124.0,
    -13.0,
    159.0,
    -13.0
  ],
  "center": [
    104.0,
    222.0
  ],
  "collisionRadius": 257.048645,
  "engineSlots": [
    {
      "angle": 180.0,
      "contrailSize": 12.0,
      "length": 45.0,
      "location": [
        -184.0,
        50.0
      ],
      "style": "LOW_TECH",
      "width": 12.0
    },
    {
      "angle": -180.0,
      "contrailSize": 12.0,
      "length": 45.0,
      "location": [
        -184.0,
        -50.0
      ],
      "style": "LOW_TECH",
      "width": 12.0
    },
    {
      "angle": 180.0,
      "contrailSize": 12.0,
      "length": 45.0,
      "location": [
        -184.0,
        70.0
      ],
      "style": "LOW_TECH",
      "width": 12.0
    },
    {
      "angle": -180.0,
      "contrailSize": 12.0,
      "length": 45.0,
      "location": [
        -184.0,
        -70.0
      ],
      "style": "LOW_TECH",
      "width": 12.0
    },
    {
      "angle": 180.0,
      "contrailSize": 12.0,
      "length": 45.0,
      "location": [
        -184.0,
        30.0
      ],
      "style": "LOW_TECH",
      "width": 12.0
    },
    {
      "angle": -180.0,
      "contrailSize": 12.0,
      "length": 45.0,
      "location": [
        -184.0,
        -30.0
      ],
      "style": "LOW_TECH",
      "width": 12.0
    }
  ],
  "height": 404.0,
  "width": 210.0,
  "hullId": "valkyria",
  "hullName": "Valkyria",
  "hullSize": "CAPITAL_SHIP",
  "shieldCenter": [
    -25.0,
    -0.0
  ],
  "shieldRadius": 218.735565,
  "spriteName": "graphics/ships/valkyria.png",
  "style": "MIDLINE",
  "viewOffset": 0.0,
  "weaponSlots": [
    {
      "angle": 135.0,
      "arc": 90.0,
      "id": "WS0001",
      "locations": [
        -99.0,
        20.0
      ],
      "mount": "TURRET",
      "size": "MEDIUM",
      "type": "BALLISTIC"
    },
    {
      "angle": -135.0,
      "arc": 90.0,
      "id": "WS0002",
      "locations": [
        -99.0,
        -20.0
      ],
      "mount": "TURRET",
      "size": "MEDIUM",
      "type": "BALLISTIC"
    },
    {
      "angle": 90.0,
      "arc": 90.0,
      "id": "WS0003",
      "locations": [
        50.0,
        20.0
      ],
      "mount": "TURRET",
      "size": "MEDIUM",
      "type": "BALLISTIC"
    },
    {
      "angle": -90.0,
      "arc": 90.0,
      "id": "WS0004",
      "locations": [
        50.0,
        -20.0
      ],
      "mount": "TURRET",
      "size": "MEDIUM",
      "type": "BALLISTIC"
    },
    {
      "angle": 180.0,
      "arc": 360.0,
      "id": "WS0005",
      "locations": [
        -79.0,
        -0.0
      ],
      "mount": "TURRET",
      "size": "SMALL",
      "type": "BALLISTIC"
    },
    {
      "angle": 0.0,
      "arc": 360.0,
      "id": "WS0006",
      "locations": [
        30.0,
        -0.0
      ],
      "mount": "TURRET",
      "size": "SMALL",
      "type": "BALLISTIC"
    },
    {
      "angle": 90.0,
      "arc": 180.0,
      "id": "WS0007",
      "locations": [
        -83.0,
        92.0
      ],
      "mount": "TURRET",
      "size": "SMALL",
      "type": "BALLISTIC"
    },
    {
      "angle": -90.0,
      "arc": 180.0,
      "id": "WS0008",
      "locations": [
        -83.0,
        -92.0
      ],
      "mount": "TURRET",
      "size": "SMALL",
      "type": "BALLISTIC"
    },
    {
      "angle": 90.0,
      "arc": 180.0,
      "id": "WS0009",
      "locations": [
        34.0,
        92.0
      ],
      "mount": "TURRET",
      "size": "SMALL",
      "type": "BALLISTIC"
    },
    {
      "angle": -90.0,
      "arc": 180.0,
      "id": "WS0010",
      "locations": [
        34.0,
        -92.0
      ],
      "mount": "TURRET",
      "size": "SMALL",
      "type": "BALLISTIC"
    },
    {
      "angle": 180.0,
      "arc": 180.0,
      "id": "WS0011",
      "locations": [
        -165.0,
        57.0
      ],
      "mount": "TURRET",
      "size": "SMALL",
      "type": "BALLISTIC"
    },
    {
      "angle": -180.0,
      "arc": 180.0,
      "id": "WS0012",
      "locations": [
        -165.0,
        -57.0
      ],
      "mount": "TURRET",
      "size": "SMALL",
      "type": "BALLISTIC"
    },
    {
      "angle": 45.0,
      "arc": 90.0,
      "id": "WS0013",
      "locations": [
        93.0,
        20.0
      ],
      "mount": "TURRET",
      "size": "MEDIUM",
      "type": "BALLISTIC"
    },
    {
      "angle": -45.0,
      "arc": 90.0,
      "id": "WS0014",
      "locations": [
        93.0,
        -20.0
      ],
      "mount": "TURRET",
      "size": "MEDIUM",
      "type": "BALLISTIC"
    },
    {
      "angle": 0.0,
      "arc": 180.0,
      "id": "WS0015",
      "locations": [
        113.0,
        -0.0
      ],
      "mount": "TURRET",
      "size": "SMALL",
      "type": "BALLISTIC"
    },
    {
      "angle": 0.0,
      "arc": 360.0,
      "id": "WS0016",
      "locations": [
        72.0,
        -0.0
      ],
      "mount": "TURRET",
      "size": "LARGE",
      "type": "MISSILE"
    },
    {
      "angle": 0.0,
      "arc": 360.0,
      "id": "LB 1",
      "locations": [
        -71.0,
        -39.0,
        -71.0,
        -56.0,
        -71.0,
        -51.0,
        -71.0,
        -42.0,
        -64.0,
        -56.0,
        -55.0,
        -56.0,
        -45.0,
        -56.0,
        -35.0,
        -56.0
      ],
      "mount": "HIDDEN",
      "size": "LARGE",
      "type": "LAUNCH_BAY"
    },
    {
      "angle": 0.0,
      "arc": 360.0,
      "id": "LB 2",
      "locations": [
        -24.0,
        -56.0,
        -14.0,
        -56.0,
        -4.0,
        -56.0,
        6.0,
        -56.0,
        16.0,
        -56.0,
        22.0,
        -56.0,
        22.0,
        -51.0,
        22.0,
        -42.0,
        22.0,
        -39.0
      ],
      "mount": "HIDDEN",
      "size": "LARGE",
      "type": "LAUNCH_BAY"
    },
    {
      "angle": 0.0,
      "arc": 360.0,
      "id": "LB 3",
      "locations": [
        -71.0,
        39.0,
        -71.0,
        42.0,
        -71.0,
        50.0,
        -71.0,
        55.0,
        -64.0,
        55.0,
        -54.0,
        55.0,
        -44.0,
        55.0,
        -34.0,
        55.0
      ],
      "mount": "HIDDEN",
      "size": "LARGE",
      "type": "LAUNCH_BAY"
    },
    {
      "angle": 0.0,
      "arc": 360.0,
      "id": "LB 4",
      "locations": [
        -25.0,
        55.0,
        -15.0,
        55.0,
        -5.0,
        55.0,
        5.0,
        55.0,
        15.0,
        55.0,
        22.0,
        55.0,
        22.0,
        51.0,
        22.0,
        42.0,
        22.0,
        39.0
      ],
      "mount": "HIDDEN",
      "size": "LARGE",
      "type": "LAUNCH_BAY"
    },
    {
      "angle": 0.0,
      "arc": 360.0,
      "id": "LB 5",
      "locations": [
        11.0,
        13.0,
        11.0,
        7.0,
        11.0,
        2.0,
        11.0,
        -2.0,
        11.0,
        -7.0,
        11.0,
        -13.0,
        9.0,
        10.0,
        9.0,
        -0.0,
        9.0,
        -10.0
      ],
      "mount": "HIDDEN",
      "size": "LARGE",
      "type": "LAUNCH_BAY"
    }
  ]
}
[close]

hope i am of any help, simply post again and we will help you.  ;D

BTW, the log actually tells you more in detail what is wrong and points out where and what is wrong, should be at the bottom of it, makes things easier, but you probably already know that since you are doing weapon coding.  :D
« Last Edit: September 12, 2012, 06:00:49 PM by ValkyriaL »
Logged

sKarpunch

  • Lieutenant
  • **
  • Posts: 69
    • View Profile
Re: how do I make a custom weapon for my mod?
« Reply #4 on: September 12, 2012, 11:31:37 PM »

thanks very much, the problem was the editor changing to ship name to the ship class, so instead of CAPITAL_SHIP it showed up in the .ship as the shipname or ID

i dunno why could be something to do with the wrapper im using, thanks for the help
 ;D sKarpunch
Logged
One should be a well of knowledge, not a fountain.-Reddit

-----------------------
END TRANSMISSION
-----------------------

sKarpunch

  • Lieutenant
  • **
  • Posts: 69
    • View Profile
Re: how do I make a custom weapon for my mod?
« Reply #5 on: September 13, 2012, 04:09:24 AM »

I once again call for aid, this time, its missions. i have a test mission all set up (i made sure to use a working mod as a guide), and when i install and go to the missions menu, the mission does not appear. I get no start-up errors and all the coding seems alright, all i have done is replace the example mission's ships with mine and copied it to my mod pack.

i'm stumped,
sKarpunch
Logged
One should be a well of knowledge, not a fountain.-Reddit

-----------------------
END TRANSMISSION
-----------------------

ValkyriaL

  • Admiral
  • *****
  • Posts: 2145
  • The Guru of Capital Ships.
    • View Profile
Re: how do I make a custom weapon for my mod?
« Reply #6 on: September 13, 2012, 05:02:26 AM »

You are probably missing your mission in the mission.csv that tells the game to look for your mission. or your mission csv is called Mission"s", the S is not supposed to be there, or you are missing a colon after the mission name, small things like this determine if things work or not, i made a guide on how to do this a while back.

http://fractalsoftworks.com/forum/index.php?topic=4211.0

need more help, simply post again.
« Last Edit: September 13, 2012, 05:06:08 AM by ValkyriaL »
Logged

ValkyriaL

  • Admiral
  • *****
  • Posts: 2145
  • The Guru of Capital Ships.
    • View Profile
Re: how do I make a custom weapon for my mod?
« Reply #7 on: September 13, 2012, 11:48:12 PM »

What it could be if you haven't solved it yet which i think you have, is the top line in "MissionDefinition.java"
that contains the class path to find this mission. data.missions.<missionname>, you probably have the name of the old mission here. that can also cause it. otherwise follow the guide i made, takes about 30 mins to get a mission up and running.
Logged

sKarpunch

  • Lieutenant
  • **
  • Posts: 69
    • View Profile
Re: how do I make a custom weapon for my mod?
« Reply #8 on: September 15, 2012, 02:02:32 AM »

thanks, i'll keep going at it, i'm spriting currently, so you can have a break from my endless cries for help ;D, i'll probably be back though

thanks for the help, sKarpunch
Logged
One should be a well of knowledge, not a fountain.-Reddit

-----------------------
END TRANSMISSION
-----------------------