Author Topic: Can't add weapon to turok (Programming help)  (Read 1555 times)

Offline marchhill

  • Iguana
  • *
  • Posts: 3
  • T:REP 16
    • View Profile
Can't add weapon to turok (Programming help)
« on: November 13, 2017, 01:13:23 PM »
 :turok:

I am trying to add a custom weapon called "blaster" to turok 2, however, the weapon is not showing up in the weapon selection carousel or anywhere else ingame. I set up developer mode and the filesystem then made these changes:

  • Added the converted models to char/ and materials to material/
  • Added an icon in gfx/hud/weapons/
  • Added this code to defs/common.txt:
Code: [Select]
#define kActor_Wpn_Blaster              1525
#define kActor_Item_WpnBlaster          2113
#define kWpn_Blaster            33
#define kWpnChar_Blaster        18
  • Added this code to defs/weaponInfo.txt
Code: [Select]
Weapon kWpn_Blaster
{
    offset                  "6 7 10"
    actor                   kActor_Wpn_Blaster
    defaultWeapon           FALSE
    owned                   TRUE
    allowUnderwater         FALSE
    allowLand               TRUE
    allowMultiplayer        TRUE
    icon                    "gfx/hud/weapons/h_w_blaster.png"
    ammo                    "Ammo_Bullet"
initialAmmoAmount       100
    ammoConsumption         1
    projectileParticle      kParticle_PlasmaShot
    charMeshIndex           kWpnChar_Blaster
    priority                9000
    slot                    3
    pickupTypeID            kActor_Item_WpnBlaster
    quickslot               2
}
  • Added this code to defs/actors/weapons.txt
Code: [Select]
Blaster kActor_Wpn_Blaster
{
    className                   "kexPlayerWeapon"
    initialScale                "1 1 1"
   
    Begin_Component "kexRenderMeshComponent"
        mesh                    "char/blaster.skinnedmesh"
        anim                    "anims/Weapon_Magnum_Pistol.anim"
        bRenderAsWeapon         TRUE
    End_Component
   
    Begin_Component "kexAnimTrackComponent"
    End_Component
   
    Begin_Component "kexScriptComponent"
        scriptClass             "TurokWeapon"
    End_Component
}

    Any help would be greatly appreciated I would love to start making mods for this great game!

    Offline BehemothProgrammer

    • Endtrail
    • ****
    • Posts: 225
    • T:REP 801
      • View Profile
    Re: Can't add weapon to turok (Programming help)
    « Reply #1 on: November 13, 2017, 06:00:47 PM »
    I copy and pasted what you did and it works just fine for me. It shows up in the weapon selection carousel. You need to lower the priority value to something like 7950 for it to show up on the weapon wheel with those slot and quickslot values, but other than that it should be working fine. Maybe you did something else and forgot about it? Try starting over. Copy just the script additions you've done and don't copy the materials, icons, models just yet and see if it works.
    « Last Edit: November 13, 2017, 06:03:29 PM by BehemothProgrammer »
    Turok 2 Co-Op Mod

    QTurok | Turok: Mountain of the Sun | WolfenTurok 3D | and more...

    Offline Duke64

    • Administrator
    • *****
    • Posts: 2080
    • T:REP 7130
    • Sixty Four
      • View Profile
      • Duke64Nukem.com
    Re: Can't add weapon to turok (Programming help)
    « Reply #2 on: November 13, 2017, 06:22:51 PM »
    Yeah from the looks of this here you have what you need to do that. Possibly packing the .kpf wrong? Doesn't seem like you are doing that wrong either based on the description at least. Yeah I would retrace my steps and do one by one first. Starting with getting the weapon on the weapon wheel and on screen with positioning and then worry about the goodies :)
    « Last Edit: November 13, 2017, 06:25:05 PM by Duke64 »
    Dinosaur Hunter
    "Its time to make tracks"
    "You are tiny grasshopper"
    "Suck it down"
    "Boo, No soup for you"
    "Arrrgghhhh"
    "I live again"

    Offline Snake Plissken

    • Endtrail
    • ****
    • Posts: 195
    • T:REP 792
      • View Profile
    Re: Can't add weapon to turok (Programming help)
    « Reply #3 on: November 13, 2017, 07:11:50 PM »
    :turok:

    I am trying to add a custom weapon called "blaster" to turok 2, however, the weapon is not showing up in the weapon selection carousel or anywhere else ingame. I set up developer mode and the filesystem then made these changes:

    • Added the converted models to char/ and materials to material/
    • Added an icon in gfx/hud/weapons/
    • Added this code to defs/common.txt:
    Code: [Select]
    #define kActor_Wpn_Blaster              1525
    #define kActor_Item_WpnBlaster          2113
    #define kWpn_Blaster            33
    #define kWpnChar_Blaster        18
    • Added this code to defs/weaponInfo.txt
    Code: [Select]
    Weapon kWpn_Blaster
    {
        offset                  "6 7 10"
        actor                   kActor_Wpn_Blaster
        defaultWeapon           FALSE
        owned                   TRUE
        allowUnderwater         FALSE
        allowLand               TRUE
        allowMultiplayer        TRUE
        icon                    "gfx/hud/weapons/h_w_blaster.png"
        ammo                    "Ammo_Bullet"
    initialAmmoAmount       100
        ammoConsumption         1
        projectileParticle      kParticle_PlasmaShot
        charMeshIndex           kWpnChar_Blaster
        priority                9000
        slot                    3
        pickupTypeID            kActor_Item_WpnBlaster
        quickslot               2
    }
    • Added this code to defs/actors/weapons.txt
    Code: [Select]
    Blaster kActor_Wpn_Blaster
    {
        className                   "kexPlayerWeapon"
        initialScale                "1 1 1"
       
        Begin_Component "kexRenderMeshComponent"
            mesh                    "char/blaster.skinnedmesh"
            anim                    "anims/Weapon_Magnum_Pistol.anim"
            bRenderAsWeapon         TRUE
        End_Component
       
        Begin_Component "kexAnimTrackComponent"
        End_Component
       
        Begin_Component "kexScriptComponent"
            scriptClass             "TurokWeapon"
        End_Component
    }

      Any help would be greatly appreciated I would love to start making mods for this great game!

      Your a modder like myself. In that we do not know what your install is looking like, you could have developer mode enabled and something loosely conflicting with your work.

      Try turning off developer mode, have everything in a .kpf and get back to us.

      Offline Rok

      • Global Moderator
      • *****
      • Posts: 772
      • T:REP 2338
        • View Profile
      Re: Can't add weapon to turok (Programming help)
      « Reply #4 on: November 13, 2017, 11:58:27 PM »
      Welcome.
      Raptor Rok is metal.

      Offline marchhill

      • Iguana
      • *
      • Posts: 3
      • T:REP 16
        • View Profile
      Re: Can't add weapon to turok (Programming help)
      « Reply #5 on: November 14, 2017, 06:10:37 AM »
      Thanks for the help guys i currently have the folders in my root directly with developer mode on. I will make a kpf and post it when I get home.

      Offline Jay Doomed

      • Global Moderator
      • *****
      • Posts: 992
      • T:REP 3072
        • View Profile
      Re: Can't add weapon to turok (Programming help)
      « Reply #6 on: November 14, 2017, 09:54:37 AM »
      You want to create a mods folder inside your gameroot and zip your contents up in a .kpf file and put the kpf inside that mods folder.



      Read Sixty Fours guide here though you may already know.

      https://turoksanctum.com/turok-2-modding-get-started-basic-guide/
      « Last Edit: November 14, 2017, 09:59:21 AM by Jay Doomed »
      "Whatever it is, it doesn't belong in this world."

      Offline marchhill

      • Iguana
      • *
      • Posts: 3
      • T:REP 16
        • View Profile
      Re: Can't add weapon to turok (Programming help)
      « Reply #7 on: November 14, 2017, 05:26:14 PM »
      Good news, the weapon now appears on the carousel! Thanks for your help I went through my steps and it turns out I accidently modified one of the files in the "export" folder instead of my unpackaged dev folders. There is now another problem however, that my weapon model is not loading and there is an error. At the moment the weapon has been converted from an ".obj" to a ".staticmesh" file (I don't know a way to convert to a ".skinnedmesh" or do rigging) and I am trying to use the "kexStaticMeshComponent" to render it, however I get this error:


      I have now attached my .kpf file and also an extra zip file containing the models.

      Offline Duke64

      • Administrator
      • *****
      • Posts: 2080
      • T:REP 7130
      • Sixty Four
        • View Profile
        • Duke64Nukem.com
      Re: Can't add weapon to turok (Programming help)
      « Reply #8 on: November 14, 2017, 06:15:03 PM »
      Do you have Behemoths Fireseed tool?

      This: https://turoksanctum.com/fireseed-model-animation-editor/

      You can import an obj as a skinnedmesh or staticmesh using it.
      « Last Edit: November 14, 2017, 06:17:17 PM by Duke64 »
      Dinosaur Hunter
      "Its time to make tracks"
      "You are tiny grasshopper"
      "Suck it down"
      "Boo, No soup for you"
      "Arrrgghhhh"
      "I live again"

      Offline Snake Plissken

      • Endtrail
      • ****
      • Posts: 195
      • T:REP 792
        • View Profile
      Re: Can't add weapon to turok (Programming help)
      « Reply #9 on: November 15, 2017, 11:30:13 AM »
      Good news, the weapon now appears on the carousel! Thanks for your help I went through my steps and it turns out I accidently modified one of the files in the "export" folder instead of my unpackaged dev folders. There is now another problem however, that my weapon model is not loading and there is an error. At the moment the weapon has been converted from an ".obj" to a ".staticmesh" file (I don't know a way to convert to a ".skinnedmesh" or do rigging) and I am trying to use the "kexStaticMeshComponent" to render it, however I get this error:


      I have now attached my .kpf file and also an extra zip file containing the models.

      A weapon model NEEDS to be a .skinnedmesh