Help - Search - Members - Calendar
Full Version: First mod
ALTAR games official forum > UFO: Aftershock > UFO:AS Modding
eroseland
I basically cut and pasted a weapon mod all ready only I don't know if what I did was right. So far I haven't been able to actually GET the weapon into my soldiers hands to test it out. I've included the code below (hopefully not to spammy). Yes, I know the weapon is a mockery of anything that seems balanced, but this is my first attempt. I'm not trying for anything balanced yet -- I just want to have my first success. That means, to me, making a weapon, having it show up in the game so it's equipable and possibly killing something with it.

Any help would be appreciated.

Only file edited: /strategic/configs/stratgame/equipment/equipment.txt
CODE
   ;#345
    SubEquipment RECORD
      id INT 345
      name STR "Cheat Gun"
      equipslot STR "Hand"
      sortcode STR "Energy"
      hit_points INT 5000
      building STR "Basic human factory"
      time FLT 0.25
      weight FLT 4.54
      origin STR "developed"
      shape INT 11;"5x2"
      twoHanded BOOL TRUE
      mfg_tech STR "Basic human weapons"
      use_tech STR "Initial knowledge"
      ready BOOL FALSE
      empssensitive BOOL FALSE
      cost_hum INT 1
      cost_cyb INT 0
      cost_psi INT 0
      start_quant INT 99
      anim_type STR "double-handed"
      righthandhelper STR "parent_double-handed"
      lefthandhelper STR "parent_leftgun"
      model STR "tactical/models/weapons/humans/laser_rifle.txt"
      iface_model STR "tactical/models/weapons/humans/laser_rifle.txt"
      camera STR "tactical/configs/cameras/camera_laserrifle.txt"
      lights STR "tactical/configs/lights/na-itemlights.txt.txt"
      skeleton STR "tactical/anims/no_skel.txt"
      gloss_model STR "share/models/interface/opt/ufopedia/equip/controllaser_rifle.txt"
      _use_ability_name STR "No training"
     ;prerequisities
      PTR 0
     ;armour
      PTR 0
     ;firearm
      PTR 0
     ;selfammo
      PTR 0
     ;receptacle
      PTR 1
      Receptacle
        Recepts RECORD
          inventorypanel STR "Weapon"
          ListOfReceptPoint ARRAY 3
            INT 0;"Classic scope"
            INT 1;"Classic muzzle"
            INT 2;"Classic underbarrel"
          END_OF_ListOfReceptPoint
        END_OF_Recepts
     ;addon
      PTR 0
     ;autonom
      PTR 0
     ;ammo
      PTR 0
     ;upgrade
      PTR 0
     ;thrown
      PTR 0
     ;ranged
      PTR 1
      Ranged Ranged RECORD
        range FLT 500
        accuracy FLT 95
        time FLT 0.1
        recoil FLT 0
        type STR "Gun"
        detection STR "Visibility"
        propelled BOOL F
        power FLT 0
        longshot FLT 1.0
        snapshot FLT 0.25
        flight_particle STR "tactical/particles/energy groups/alien_laser_04_e.pgrp"
        trail_particle STR "tactical/particles/energy groups/plasma-trail-wg-b.pgrp"
      END_OF_Ranged
     ;rangeimprover
      PTR 0
     ;mode
      PTR 1
      Mode
        Modes RECORD
          ListOfMode ARRAY 2
            SubMode RECORD
              index INT 0;"single"
              isammo STR "No"
             ;melee
              PTR 0
             ;vehicle
              PTR 0
             ;guided
              PTR 0
             ;influencer
              PTR 1
              Influencer Influencer RECORD
                auto BOOL F
                area STR "Target"
                damage STR "Psi"
                effect INT 1
                time FLT 0
                strength FLT 5000
                radius FLT 0
                pellets INT 1
                skill STR "<blank>"
                detection STR "<blank>"
                rounds INT 0
                noise FLT 0
                light FLT 0
                infra FLT 0
                stance STR "All"
                animation STR "Fire"
                class STR "Rifles"
                isdamage STR "Yes"
                use_particle STR "tactical/particles/na-use.pgrp"
                aim_particle STR "tactical/particles/na-use.pgrp"
                impact_particle STR "tactical/particles/na-use.pgrp"
                use_sound STR "share/sound/wavs/equip/use/silencer.wav"
                sound_volume INT 50
                volume_dev INT 25
              END_OF_Influencer
            END_OF_SubMode
            SubMode RECORD
              index INT 2;"burst"
              isammo STR "No"
             ;melee
              PTR 0
             ;vehicle
              PTR 0
             ;guided
              PTR 0
             ;influencer
              PTR 1
              Influencer Influencer RECORD
                auto BOOL F
                area STR "Target"
                damage STR "Warp"
                effect INT 1
                time FLT 0
                strength FLT 5000
                radius FLT 0
                pellets INT 1
                skill STR "<blank>"
                detection STR "<blank>"
                rounds INT 0
                noise FLT 0
                light FLT 0
                infra FLT 0
                stance STR "All"
                animation STR "Fire"
                class STR "Rifles"
                isdamage STR "Yes"
                use_particle STR "tactical/particles/na-use.pgrp"
                aim_particle STR "tactical/particles/na-use.pgrp"
                impact_particle STR "tactical/particles/na-use.pgrp"
                use_sound STR "share/sound/wavs/equip/use/silencer.wav"
                sound_volume INT 50
                volume_dev INT 25
              END_OF_Influencer
            END_OF_SubMode
          END_OF_ListOfMode
        END_OF_Modes
    END_OF_SubEquipment
rman
At the top of equipment.txt there is a counter showing number of entries. Perhaps you've forgotten to increase it?
eroseland
... I was supposed to increase it? Doh. Any other tips?

Edit: That did make it work. At least the weapons are showing up now as initial equipment. Unfortunately, they're named 'caseless ammo', take up a 2x2 slot, and in the game, can't be fired at all (nor do they have two fire modes, just one: burst)

... maybe modding isn't for me. :/
rman
QUOTE (eroseland @ Dec 21 2006, 10:29 AM) *
... I was supposed to increase it? Doh. Any other tips?

Edit: That did make it work. At least the weapons are showing up now as initial equipment. Unfortunately, they're named 'caseless ammo', take up a 2x2 slot, and in the game, can't be fired at all (nor do they have two fire modes, just one: burst)

... maybe modding isn't for me. :/


CODE
;#345

is a remark. You can live without it, but appropriate number can make modding much easier.

CODE
id INT 345

should be an unique identifier. I suspect that it is not so unqiue in your case. Bad things can happen if you do not preserve uniqueness.
That id is also referenced by pack.txt (see LocalisationPack.vfs), where all names visible to end user are stored. Such as item name, item description, etc.
So, you should probably edit your pack.txt also.

PS. Since the original game doesn't have caseless ammo, you probably modified someone else's mod. Are you sure it falls under 'fair use' concept?
eroseland
QUOTE
PS. Since the original game doesn't have caseless ammo, you probably modified someone else's mod. Are you sure it falls under 'fair use' concept?

Oh. Yes, I picked a mod that sounded the best. so I'd have something to follow along with. It's not my intention to include someone else's' work in a product that I would claim is mine. That wouldn't be neighborly. The Weapons Rebalance mod just seemed like the obvious choice to be packed full of examples, that's all. (Hopefully, no harm, no foul.)

Edit: Changed the unique ID to 423 (which is the last number for equipment under pack.txt), gave it short name or description and all that. However, (after figuring out what was wrong with the LocalizationPack.vfs CRC) it seems that the weapon has no range, or is incapable of actually firing. It also still only has burst mode. Solders continue to say they 'can't do that' when asked to fire on an enemy. The weapon itself doesn't take up 5x2 or both hands -- but rather has the (around the item box) look of an Under barrel component. So stumped.

Re-edit: Made a little more changes. Now the weapon doesn't show up at the start again -- dunno why. Anyways, here's the code. I think, in the mean time, I'll just go back to playing, rather than breaking. The selfammo is new. I figured if a gun that uses no ammo doesn't work, maybe a gun that's self powered would.
CODE
   ;#423
    SubEquipment RECORD
      id INT 423
      name STR "SCGun"
      equipslot STR "Hand"
      sortcode STR "Energy"
      hit_points INT 500
      building STR "Basic human factory"
      time FLT 0.25
      weight FLT 100
      origin STR "developed"
      shape INT 7;"5x2"
      twoHanded BOOL TRUE
      mfg_tech STR "Basic human weapons"
      use_tech STR "Initial knowledge"
      ready BOOL FALSE
      empssensitive BOOL FALSE
      cost_hum INT 1
      cost_cyb INT 0
      cost_psi INT 0
      start_quant INT 99
      anim_type STR "double-handed"
      righthandhelper STR "parent_double-handed"
      lefthandhelper STR "parent_leftgun"
      model STR "tactical/models/weapons/humans/laser_rifle.txt"
      iface_model STR "tactical/models/weapons/humans/laser_rifle.txt"
      camera STR "tactical/configs/cameras/camera_laserrifle.txt"
      lights STR "tactical/configs/lights/na-itemlights.txt.txt"
      skeleton STR "tactical/anims/no_skel.txt"
      gloss_model STR "share/models/interface/opt/ufopedia/equip/controllaser_rifle.txt"
      _use_ability_name STR "No training"
     ;prerequisities
      PTR 0
     ;armour
      PTR 0
     ;firearm
      PTR 0
     ;selfammo
      PTR 1
      Selfammo Selfammo RECORD
        capacity INT 999
        recharging BOOL T
        explosion_sound STR "share/sound/wavs/equip/explosions/empty.wav"
     ;receptacle
      PTR 1
      Receptacle
        Recepts RECORD
          inventorypanel STR "Weapon"
          ListOfReceptPoint ARRAY 3
            INT 0;"Classic scope"
            INT 1;"Classic muzzle"
            INT 2;"Classic underbarrel"
          END_OF_ListOfReceptPoint
        END_OF_Recepts
     ;addon
      PTR 0
     ;autonom
      PTR 0
     ;ammo
      PTR 0
     ;upgrade
      PTR 0
     ;thrown
      PTR 0
     ;ranged
      PTR 1
      Ranged Ranged RECORD
        range FLT 500
        accuracy FLT 95
        time FLT 0.1
        recoil FLT 0
        type STR "Gun"
        detection STR "Visibility"
        propelled BOOL F
        power FLT 0
        longshot FLT 1.0
        snapshot FLT 0.25
        flight_particle STR "tactical/particles/energy groups/alien_laser_04_e.pgrp"
        trail_particle STR "tactical/particles/energy groups/plasma-trail-wg-b.pgrp"
      END_OF_Ranged
     ;rangeimprover
      PTR 0
     ;mode
      PTR 1
      Mode
        Modes RECORD
          ListOfMode ARRAY 2
            SubMode RECORD
              index INT 1;"single"
              isammo STR "Self"
             ;melee
              PTR 0
             ;vehicle
              PTR 0
             ;guided
              PTR 0
             ;influencer
              PTR 1
              Influencer Influencer RECORD
                auto BOOL F
                area STR "Target"
                damage STR "Psi"
                effect INT 1
                time FLT 0
                strength FLT 5000
                radius FLT 0
                pellets INT 1
                skill STR "<blank>"
                detection STR "<blank>"
                rounds INT 1
                noise FLT 0
                light FLT 0
                infra FLT 0
                stance STR "All"
                animation STR "Fire"
                class STR "Rifles"
                isdamage STR "Yes"
                use_particle STR "tactical/particles/na-use.pgrp"
                aim_particle STR "tactical/particles/na-use.pgrp"
                impact_particle STR "tactical/particles/na-use.pgrp"
                use_sound STR "share/sound/wavs/equip/use/silencer.wav"
                sound_volume INT 50
                volume_dev INT 25
              END_OF_Influencer
            END_OF_SubMode
            SubMode RECORD
              index INT 2;"burst"
              isammo STR "Self"
             ;melee
              PTR 0
             ;vehicle
              PTR 0
             ;guided
              PTR 0
             ;influencer
              PTR 1
              Influencer Influencer RECORD
                auto BOOL F
                area STR "Target"
                damage STR "Warp"
                effect INT 1
                time FLT 0
                strength FLT 5000
                radius FLT 0
                pellets INT 1
                skill STR "<blank>"
                detection STR "<blank>"
                rounds INT 1
                noise FLT 0
                light FLT 0
                infra FLT 0
                stance STR "All"
                animation STR "Fire"
                class STR "Rifles"
                isdamage STR "Yes"
                use_particle STR "tactical/particles/na-use.pgrp"
                aim_particle STR "tactical/particles/na-use.pgrp"
                impact_particle STR "tactical/particles/na-use.pgrp"
                use_sound STR "share/sound/wavs/equip/use/silencer.wav"
                sound_volume INT 50
                volume_dev INT 25
              END_OF_Influencer
            END_OF_SubMode
          END_OF_ListOfMode
        END_OF_Modes
    END_OF_SubEquipment
ShadoWarrior
At the very top of equipment.txt is a line that reads ListOfEquipment ARRAY nnn , where 'nnn' is the total number of item entries. If you add new items you must increase this value by the number of items you've added.
eroseland
QUOTE (ShadoWarrior @ Dec 21 2006, 02:06 PM) *
At the very top of equipment.txt is a line that reads ListOfEquipment ARRAY nnn , where 'nnn' is the total number of item entries. If you add new items you must increase this value by the number of items you've added.


Did that. smile.gif It reads ListOfEquipment ARRAY 346 (because I added one from your mod (which is fantastic, by the way)).
Laureati
Modded equipment showing up as an ammo box when it's not supposed to is indicative of an error in your code. In the vanilla game this would be the .50 AP ammo (item #0). I guess in ShadoWarrior's mod it's the caseless ammo.

That's why your weapon isn't showing up. It's there. It's just considered ammo. I'll bet it's in your glossary at the start though (as that particular ammo). Am I right? biggrin.gif

Here's where your error is

lights STR "tactical/configs/lights/na-itemlights.txt.txt"

This should be...

lights STR "tactical/configs/lights/na-itemlights.txt"

This is what's causing your mod to muck up. I haven't spotted any other errors (that's your job anyway dry.gif ) but it should run fine once you fix that. If it doesn't then go back and de-bug again.

Note: ANY equipment that uses selfammo does not show it's range properties. The weapon is still ranged, but it just doesn't show up. This is probably hardcoded in how the game displays info (I don't know for sure).

If you want your range information to show up then you have to have "ammo". i.e. your item needs an entry in the "firearm" section of the code, not the "selfammo" section.

[Basically the game glossary assumes all items with ammo are ranged and all items with selfammo are not. That's probably why the ammo type section is called "firearm" - makes sense No? huh.gif ]


Cutting and pasting is fine (I guess) but you don't really learn much about what is done and how to do it. More so you tried to add on to an already extensive mod (ShadoWarrior's), making it more error prone as you're not clued in to all the changes he's made. Try making your own mod of the vanilla game - testing out stuff by examining what ShadoWarrior and others have changed and how/why they've done it.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.