Data Realms Fan Forums
http://45.55.195.193/

Gun Coding
http://45.55.195.193/viewtopic.php?f=1&t=14251
Page 1 of 2

Author:  Hariku [ Sun Apr 12, 2009 8:21 am ]
Post subject:  Gun Coding

I've been trying to follow the "Modders Bible", and every time I load up CC I get an error. It doesn't tell me what the error is, all it tells me is that CC has encountered an error and needs to close.

I'm pretty sure I followed every step correctly, but I can never get my gun to load correctly. Can I get some help? The file attached is the gun sprite.

Attachments:
Gauss Rifle 000.bmp [6.62 KiB]
Downloaded 45 times

Author:  411570N3 [ Sun Apr 12, 2009 8:22 am ]
Post subject:  Re: Gun Coding

Set FrameCount = 0
Take the 000 from the name.

Author:  Hariku [ Sun Apr 12, 2009 8:30 am ]
Post subject:  Re: Gun Coding

I get the same error...you didn't really tell me anything from that other than take away the 000.

Author:  411570N3 [ Sun Apr 12, 2009 8:37 am ]
Post subject:  Re: Gun Coding

Okay, so it doesn't return any error apart from the needs to close?
Have you set MuzzleFlash = None if it is appropriate?

Author:  Hariku [ Sun Apr 12, 2009 8:39 am ]
Post subject:  Re: Gun Coding

I'm using what the Modders Bible New Persons Guide is giving me, which isn't much.

This is all what it told me put.

Code:
AddDevice = HDFirearm
   InstanceName = Guass Rifle
   GetsHitByMOs = 1
   SpriteFile = ContentFile
            FilePath = StarCraft.rte/Gauss Rifle.bmp
   AtomGroup = AtomGroup
            AutoGenerate = 1
            Material = Material
              CopyOf = Military Stuff
            Resolution = 2
            Depth = 0
   Magazine = Magazine
            CopyOf = Magazine Pistol
   RateOfFire = 500
   Set FrameCount = 0

Author:  411570N3 [ Sun Apr 12, 2009 8:49 am ]
Post subject:  Re: Gun Coding

That's missing ALOT.
Try looking at the Base.rte .ini s to see what you're missing. You're missing tonnes...
The error you're getting is because you're not giving about 2/3rds of the neccessary values...
Code:
AddDevice = HDFirearm   //Defines as a weapon
   PresetName = <Name of weapon>   //Defines the name of the weapon. This shows up in the buy menu and is used to reference the weapon later on, but you don't really have to worry about it now. Try to get a somewhat unique name to save difficulty
   AddToGroup = Weapons   //Good idea to have
   Mass = <Mass of weapon>   //How much the thing weighs, in kilograms.
   HitsMOs = <1/0>   //Whether or not you can push things with the gun
   GetsHitByMOs = <1/0>   //Whether or not the gun can get hit by bullets
   SpriteFile = ContentFile   //Tells the game the next tabbed bit is your sprite
      FilePath = <Filepath>   //Sprite filepath
   FrameCount = 1   //How many frames, don't worry about this yet
   SpriteOffset = Vector   //Where the centre of gravity of the gun is
      X = <X>   //Defined. This shouldn't be too hard if you did basic maths. The origin is the top left pixel, the X axis is inverted
      Y = <Y>   //Defined.
   EntryWound = AEmitter
      CopyOf = <Name of wound>   //Wounds for your weapon, just use Dent Metal for now
   ExitWound = AEmitter
      CopyOf = <Name of wound>
   GoldValue = <Cost>   //How much it costs, in gold
   AtomGroup = AtomGroup
      AutoGenerate = 1
      Material = Material
         CopyOf = Military Stuff   //What it's made of, just use Military Stuff for now
      Resolution = 4
      Depth = 0
   DeepGroup = AtomGroup
      AutoGenerate = 1
      Material = Material
         CopyOf = Military Stuff   //Deep group, see last comment
      Resolution = 4
      Depth = 10
   DeepCheck = 1   //Ignore
   JointStrength = 75   //How hard you hold it, bigger number=harder to drop
   JointStiffness = 0.5   //If someone lands on your gun, how much of the force goes to your arm.
   JointOffset = Vector
      X = <X>   //Where the gun is held, relative to the SpriteOffset, X is not inverted, Y is.
      Y = <Y>
   DrawAfterParent = <1/0>   //Whether the gun is in front of the guy or not.
   OneHanded = <1/0>   //One handed, if yes then you can use it with a shield
   StanceOffset = Vector
      X = <X>   //Where the shoulder is when the gun is held, relative to the JointOffset. X is inverted, Y is
      Y = <Y>
   SharpStanceOffset = Vector
      X = <X>   //Where the shoulder is when Sharp Aiming, the thing with the three yellow dots.
      Y = <Y>
   SupportOffset = Vector
      X = <X>   //Where the second hand is, relative to SpriteOffset
      Y = <Y>
   SharpLength = <Number>   //How far you can see with the Sharp Aim
   Magazine = Magazine
      CopyOf = <Magazine>   //What magazine to use, this will define what it fires. You'll need your own magazine if you want a decent weapon
   Flash = Attachable
      CopyOf = <Muzzle Flash>   //What Muzzle Flash to use, if there isn't one then usse "Flash = None"
   RateOfFire = <Number>   //How many rounds you can get off in, say, a minute, I'm not sure
   ReloadTime = <Number>   //How long a reload takes, in Milliseconds
   FullAuto = <1/0>   //Full Auto or Semi Auto
   FireIgnoresThis = <1/0>   //Whether bullets will hit the gun if they intersect, I reccomend 1
   ShakeRange = 13   //How shaky your hands are when you hold it
   SharpShakeRange = 3   //Above, but when Sharp Aiming
   NoSupportFactor = 1.5   //No idea
   ParticleSpreadRange = 3   //How innaccurate th bullets are
   ShellSpreadRange = 8   //How the shells come out, ignore this for now
   ShellAngVelRange = 2   //See above
   MuzzleOffset = Vector
      X = <X>   //Where the bullets fly out, X is not inverted, Y is. Relative to SpriteOffset
      Y = <Y>
   EjectionOffset = Vector
      X = <X>   //Where the casings fly out, see above
      Y = <Y>
This should give you a working weapon. The next step is to define your own bullets and magazine to load into the weapon. Then to add effects, gibs and sounds.

Author:  Hariku [ Sun Apr 12, 2009 9:16 am ]
Post subject:  Re: Gun Coding

Regardless of what I add or remove, I still get the same error in the same place of the load screen. I have no idea what I'm doing wrong.

Author:  411570N3 [ Sun Apr 12, 2009 9:19 am ]
Post subject:  Re: Gun Coding

See above post. You need to replace everything in triangle brackets with some values and you should get a somewhat working weapon. Then you just need to make your own Magazine and Rounds.

Author:  Hariku [ Sun Apr 12, 2009 9:26 am ]
Post subject:  Re: Gun Coding

And I did just that, yet I still get an error.

Author:  411570N3 [ Sun Apr 12, 2009 9:35 am ]
Post subject:  Re: Gun Coding

Show us your code please...

Author:  Geti [ Sun Apr 12, 2009 11:12 am ]
Post subject:  Re: Gun Coding

CC crashes like that sometimes if you doubledefine a presetname. upload your mod so someone can debug it please.

Author:  411570N3 [ Sun Apr 12, 2009 11:17 am ]
Post subject:  Re: Gun Coding

I've found that double defining a presetname just overwrites it.

Author:  Morbo!!! [ Sun Apr 12, 2009 11:51 am ]
Post subject:  Re: Gun Coding

One thing though, it's not the X that's inverted, it's the Y. That's what I find anyway.

Author:  411570N3 [ Sun Apr 12, 2009 11:58 am ]
Post subject:  Re: Gun Coding

It depends on what you're doing. Alot. Like ridiculously. This is why everyone hates offsets.

Author:  Geti [ Sun Apr 12, 2009 12:21 pm ]
Post subject:  Re: Gun Coding

y is "inverted" (negative is up) and x is not (negative is left) always. for limbs, it just seems different because the sprites are rotated. i still hate offsets though, that stupid engineer has ♥♥♥♥ 5 attachables on the body, one of them is a sub attachable and rawr. then all the gib offsets.. ><

Page 1 of 2 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/