View unanswered posts | View active topics It is currently Sun Jan 05, 2025 2:01 am



Reply to topic  [ 14 posts ] 
 A noob's first mod: need help with scripting 
Author Message

Joined: Sat Jul 31, 2010 12:52 am
Posts: 7
Reply with quote
Post A noob's first mod: need help with scripting
Hi, I'm new to this game, and i just downloaded it about a month ago. I think it's really cool and i've been lurking and downloaded cool mods. I decided I would have a go at mod making, at least just for fun, since it's summer vacation and I've got tons of time :) .

I've had a bit of experience with programming and pixelart, but I'm completely new at ini and lua coding, so I will need some help coding this mod. I'm just trying to make a few weapons first, and maybe I will move onto actors and scenes later.

So I was looking around at the scripting tutorials and i looked at some examples and it was all quite confusing. Do you need to have a lua script for every weapon? And what exactly are MOpixels and AEmitters and all that? It would be great if anyone could help cause I'm pretty lost.

Image

These are my first weapons. Pixelart is my favorite part of modding and hopefully I will be making many more weapons, although I still dont know how to script them.


Sat Jul 31, 2010 1:03 am
Profile
User avatar

Joined: Fri Oct 17, 2008 9:46 pm
Posts: 5212
Location: The Grills Locker.
Reply with quote
Post Re: A noob's first mod: need help with scripting
Whoa whoa whoa. Cool down there. Lua is high-level stuff. You're not looking for scripting, you wanna search coding first. Anything in the game (guns, actors) is made through .ini files. Lua is only for a few advanced extra functions.

MOPs and AEs are examples of object classes. Everything in CC is part of one of those classes. Each serves a specific purpose and has it's own set of variables.


Sat Jul 31, 2010 1:24 am
Profile WWW
User avatar

Joined: Mon Jun 15, 2009 4:02 pm
Posts: 905
Reply with quote
Post Re: A noob's first mod: need help with scripting
That was a refreshingly competent first post, aside from the usual confusion on the purpose of Lua.
You may wish to check out Modding 101 and Modding 107 on the wiki, they offer a very competent look at the basic structure of how CC mods work.

From there, you probably want to look inside vanilla and mod content to see how effects and such are actually created. The wiki is very useful, but somewhat neglected, and in places outdated.
Make sure to check out this thread, as it also contains a lot of resources, especially for newer modders.

Also, for the record Lua (capitalised as it is a noun; Portugese for moon) is as Areku said, for functions which are not available through ini.
If you are at all familiar with programming in any other languages, you should find it relatively simple to pick up. But remember, it is absolutely unessential, and you should wait until you have a fair bit of ini experience under your belt.

Edit:
By the way, thanks for uploading your sprites as a png instead of a jpg.


Sat Jul 31, 2010 1:42 am
Profile WWW

Joined: Sat Jul 31, 2010 12:52 am
Posts: 7
Reply with quote
Post Re: A noob's first mod: need help with scripting
Thanks for the tips! Well I'm definately going to wait until I try to tackle LUA, but I think I'm starting to understand the ini coding. I just had a few questions about things I didn't understand.

1. So from what I've read I have deduced that gibs are what things blow up into when destroyed right? So I would expect there to be lots of links to different images, buy instead for most of the gibs there is something like
Code:
AddGib = Gib
      GibParticle = MOPixel
         CopyOf = Spark Yellow 1
      Count = 5
      Spread = 2.25
      MaxVelocity = 20
      MinVelocity = 8

I dont understand what the CopyOf thig is. Is it some kind of link or prebuilt value? And is there somewhere you can see all the different kinds of gibs?

2. The other part I dont understand is the AtomGroup and Deepgroup parts of the code. What does it mean and what does it do?

Thanks again for all the help you've already given me! Hope someone can help me out with this basic stuff. :oops:


Sun Aug 01, 2010 5:31 am
Profile
happy carebear mom
User avatar

Joined: Tue Mar 04, 2008 1:40 am
Posts: 7096
Location: b8bbd5
Reply with quote
Post Re: A noob's first mod: need help with scripting
Just some quick, not very extensive answers.
Gibs are defined just like everything else, you can make your own or use the existing ones as you wish. For example, the one you have there is an MOPixel that was defined somewhere else in the game code, then turned into a gib for whatever gibs into it by using AddGib and a CopyOf statement.

CopyOf statements do exactly what they sound like, they make whatever you're defining a copy of what you put into the CopyOf statement, and any further properties you define will applied over it.

Atomgroups are matrices of atoms, which are collision points. Deepgroups are the same, but for terrain erasure purposes. Usually both of these are automatically generated by the game.


Sun Aug 01, 2010 6:16 am
Profile

Joined: Sat Jul 31, 2010 12:52 am
Posts: 7
Reply with quote
Post Re: A noob's first mod: need help with scripting
Alright, so I think I figured out how the CopyOf thing works, and I was just wondering if you wanted to use predefined gib or ammo, do you have to manually include the inis with those definitions in your index, or will the game automatically include the definitions from other folders?

Sorry for the noobiness, I guess I'm kinda slow at this. :P


Mon Aug 02, 2010 1:41 am
Profile
User avatar

Joined: Fri Oct 17, 2008 9:46 pm
Posts: 5212
Location: The Grills Locker.
Reply with quote
Post Re: A noob's first mod: need help with scripting
The game will automatically include those objects IF, and only if they're part of the vanilla sets (base.rte, coalition, ronin, dummies, etc). Otherwise you'll have to link them manually.


Mon Aug 02, 2010 1:58 am
Profile WWW

Joined: Sat Jul 31, 2010 12:52 am
Posts: 7
Reply with quote
Post Re: A noob's first mod: need help with scripting
Hi again. All the help has been really useful, and I've finally finished the script for my first weapon. It's not exactly complete, I was just trying to make a working mod so I just used a lot of files from the game. There were a few errors that I was able to fix, but I am stuck on what I did wrong to make this error:

Image

And this is my code:
Code:
AddAmmo = Magazine
   PresetName = Assualt Rifle Mag
   Mass = 2
   HitsMOs = 0
   GetsHitByMOs = 0
   SpriteFile = ContentFile
      FilePath = FirstMod.rts/Devices/Assualt Rifle/fourthgunmag.bmp
   FrameCount = 1
   SpriteOffset = Vector
      X = -2
      Y = -1
   EntryWound = AEmitter
      CopyOf = Dent Metal
   ExitWound = AEmitter
      CopyOf = Dent Metal
   AtomGroup = AtomGroup
      AutoGenerate = 1
      Material = Material
         CopyOf = Military Stuff
      Resolution = 4
      Depth = 0
   DeepGroup = AtomGroup
      AutoGenerate = 1
      Material = Material
         CopyOf = Military Stuff
      Resolution = 4
      Depth = 10
   DeepCheck = 0
   JointStrength = 100
   JointStiffness = 0.5
   JointOffset = Vector
      X = 0
      Y = -1
   ParentOffset = Vector
      X = 5
      Y = 1
   DrawAfterParent = 0
   RoundCount = 50
   RTTRatio = 4
   RegularRound = Round
      CopyOf = Round 7.62x39
   TracerRound = Round
      CopyOf = Round 7.62x39 Tracer
   AddGib = Gib
      GibParticle = MOpixel
         CopyOf = Spark Yellow 1
      Count = 5
      Spread = 2.25
      MaxVelocity = 20
      MinVelocity = 8
   AddGib = Gib
      GibParticle = MOSparticle
         CopyOf = Gib Metal Rust Micro A
      Count = 4
      Spread = 2.25
      MaxVelocity = 15
      MinVelocity = 5
   GibWoundLimit = 2

AddDevice = HDFirearm
   PresetName = Assualt Rifle
   AddToGroup = Weapons
   Mass = 13
   HitsMos = 0
   GetsHitByMOs = 1
   SpriteFile = ContentFile
         FilePath = FirstMod.rte/Devices/Assault Rifle/fourthgun.bmp
   FrameCount = 1
   SpriteOffset = Vector
      X = -16
      Y = -4
   EntryWound = AEmitter
      CopyOf = Dent Metal
   ExitWound = AEmitter
      CopyOf = Dent Metal
   GoldValue = 60
   AtomGroup = AtomGroup
      AutoGenerate = 1
      Material = Material
         CopyOf = Military Stuff
      Resolution = 4
      Depth = 0
   DeepGroup = AtomGroup
      AutoGenerate = 1
      Material = Material
         CopyOf = Military Stuff
      Resolution = 4
      Depth = 10
   DeepCheck = 0
   JointStrenth = 90
   JointStiffness = 0.5
   JointOffset = Vector
      X = -3
      Y = 2
   DrawAfterParent = 0
   StanceOffset = Vector
      X = 3
      Y = 8
   SharpStanceOffset = Vector
      X = 7
      Y = -1
   SupportOffset = Vector
      X = 5
      Y = -1
   SharpLength = 300
   Magazine = Magazine
      CopyOf = Assualt Rifle Mag
   Flash = Attachable
      CopyOf = Muzzle Flash SMG
   FireSound = Sound
      AddSample = ContentFile
         FilePath = Base.rte/Devices/Rifles/AK-47000.wav
      AddSample = ContentFile
         FilePath = Base.rte/Devices/Rifles/AK-47001.wav
      AddSample = ContentFile
         FilePath = Base.rte/Devices/Rifles/AK-47002.wav

      AddSample = ContentFile
         FilePath = Base.rte/Devices/Rifles/AK-47003.wav
      AddSample = ContentFile
         FilePath = Base.rte/Devices/Rifles/AK-47004.wav
      AddSample = ContentFile
         FilePath = Base.rte/Devices/Rifles/AK-47005.wav
   EmptySound = Sound
      AddSample = ContentFile
         FilePath = Base.rte/Devices/EmptyClick3.wav
   ReloadStartSound = Sound
      AddSample = ContentFile
         FilePath = Base.rte/Devices/ReloadStart.wav
   ReloadEndSound = Sound
      AddSample = ContentFile
         FilePath = Base.rte/Devices/ReloadEnd.wav
   RateOfFire = 720
   ReloadTime = 1500
   FullAuto = 1
   FireIgnoresThis = 1
   ShakeRange = 13
   SharpShakeRange = 4
   NoSupportFactor = 2.5
   ParticleSpreadRange = 1
   ShellSpreadRange = 8
   ShellAngVelRange = 2
   MuzzleOffset = Vector
      X = 16
      Y = 0
   EjectionOffset = Vector
      X = -4
      Y = -1
   AddGib = Gib
      GibParticle = MOPixel
         CopyOf = Spark Yellow 1
      Count = 6
      Spread = 2.25
      MaxVelocity = 20
      MinVelocity = 8
   AddGib = Gib
      GibParticle = MOPixel
         CopyOf = Spark Yellow 2
      Count = 5
      Spread = 2.25
      MaxVelocity = 20
      MinVelocity = 8
   AddGib = Gib
      GibParticle = MOPixel
         CopyOf = Drop Oil
      Count = 4
      Spread = 2.25
      MaxVelocity = 10
      MinVelocity = 1
   AddGib = Gib
      GibParticle = MOSParticle
         CopyOf = Gib Metal Rust Micro A
      Count = 10
      Spread = 2.25
      MaxVelocity = 15
      MinVelocity = 5
   AddGib = Gib
      GibParticle = MOSParticle
         CopyOf = Gib Metal Grey Micro A
      Count = 14
      Spread = 2.25
      MaxVelocity = 15
      MinVelocity = 5
   AddGib = Gib
      GibParticle = MOSRotating
         CopyOf = Gib Device Small J
      Count = 1
      Spread = 2.25
      MaxVelocity = 10
      MinVelocity = 1
   AddGib = Gib
      GibParticle = MOSRotating
         CopyOf = Gib Device Small H
      Count = 1
      Spread = 2.25
      MaxVelocity = 10
      MinVelocity = 1
   GibWoundLimit = 3

   
   


I copied most of it directly from the AK-47 ini, so I'm not sure what is wrong. Please help! Thanks in advance.


Mon Aug 02, 2010 3:12 am
Profile
User avatar

Joined: Mon Jun 15, 2009 4:02 pm
Posts: 905
Reply with quote
Post Re: A noob's first mod: need help with scripting
Incorrect capitalisation, I think.
Should be MOPixel and MOSParticle.


Mon Aug 02, 2010 3:16 am
Profile WWW
happy carebear mom
User avatar

Joined: Tue Mar 04, 2008 1:40 am
Posts: 7096
Location: b8bbd5
Reply with quote
Post Re: A noob's first mod: need help with scripting
Quote:
AddGib = Gib
GibParticle = MOpixel
AddGib = Gib
GibParticle = MOSparticle

Notice the bolded words are not capitalized correctly. CC is very picky and will refuse your words if they're not capped exactly like they should be.
Worry not, after fixing a hundred or so of these errors your brain will be hardwired to never incorrectly capitalize a MOSParticle or MOPixel or anything else.

EDIT: Ninja'd. That is a problem though, not sure if it's THE problem.


Mon Aug 02, 2010 3:17 am
Profile

Joined: Sat Jul 31, 2010 12:52 am
Posts: 7
Reply with quote
Post Re: A noob's first mod: need help with scripting
I fixed the all the spelling errors I could find, but evidently there is still something wrong with my mod. I'm thinking maybe I didn't do the mod layout right or something, since the game crashes whenever it loads my mod, and it doesn't give me an error screen. I have the mod here and if someone could check it out and tell me what's wrong it would be great. It's pretty much just a test mod and I just copied the AK-47 code and modified it.


Attachments:
File comment: Mod that doesn't work
FirstMod.rte.rar [2.12 KiB]
Downloaded 109 times
Mon Aug 02, 2010 10:24 pm
Profile

Joined: Sat Jul 31, 2010 12:52 am
Posts: 7
Reply with quote
Post Re: A noob's first mod: need help with scripting
Bump. Can someone please help me with the problem above? I'm stuck and I cant figure out what went wrong.


Tue Aug 03, 2010 5:58 pm
Profile
User avatar

Joined: Mon Jun 15, 2009 4:02 pm
Posts: 905
Reply with quote
Post Re: A noob's first mod: need help with scripting
Well, the problem is not in the magazine definition, and in the gun definition, JointStrenth should be JointStrength, but it still crashes.

Edit:
Wait, I got it.
When you define the SpritePath of the gun, there is an extra tab, causing it to crash.
It doesn't work now, because it can't find the muzzle flash you told it to use. Just use a different muzzle flash and it should work fine.


Tue Aug 03, 2010 10:30 pm
Profile WWW

Joined: Sat Jul 31, 2010 12:52 am
Posts: 7
Reply with quote
Post Re: A noob's first mod: need help with scripting
Thank you so much! I was totally stuck on what was wrong. So, I still can't get the mod to work since the game says it can't find the flash. I'm not sure if there's something I have to include or what, but isn't Muzzle Flash SMG a flash that is defined in the original game? I looked at the codes of a lot of other working weapons, and they are use the same flash. I also tried changing it to Muzzle Flash Pistol but that did not work either. Can somebody tell me what is wrong? Thanks.


Wed Aug 04, 2010 12:13 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 14 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.045s | 14 Queries | GZIP : Off ]