Difference between revisions of "User:Ducks/A Simple First Mod"

From Mod Wiki
(Definition files (.def))
(Copying the .def file)
Line 35: Line 35:
 
First, we need to know which file to modify - in this case, it's {{filename|\SDK 1.2 Beta\base\def\weapons\rocketlauncher.def}}. However, we shouldn't modify this file, as it's the one from the SDK. Instead, it should be copied to the 'simplemod' folder.
 
First, we need to know which file to modify - in this case, it's {{filename|\SDK 1.2 Beta\base\def\weapons\rocketlauncher.def}}. However, we shouldn't modify this file, as it's the one from the SDK. Instead, it should be copied to the 'simplemod' folder.
  
Since {{filename|rocketlauncher.def}} is in the {{filename|\base\def\weapons\}} folder of the SDK, for our mod, it needs to be in the {{filename|\simplemod\def\weapons\}} folder. So go into your simplemod folder, create folder {{filename|def}}, and then inside that, create folder {{filename|weapons}}. Then ''copy'' the {{filename|rocketlauncher.def}} file into it.
+
So copy {{filename|\SDK 1.2 Beta\base\def\weapons\rocketlauncher.def}} to {{filename|\simplemod\def\weapons\rocketlauncher.def}}. You'll need to create the 'def' and 'weapons' folders yourself.
  
 
This means that when simplemod is launched, the game will use the simplemod {{filename|rocketlauncher.def}} file, instead of ETQW's. So we can change this file as much as we want.
 
This means that when simplemod is launched, the game will use the simplemod {{filename|rocketlauncher.def}} file, instead of ETQW's. So we can change this file as much as we want.

Revision as of 11:41, 29 November 2007

This is the barebones guide for creating a simple mod. It won't be a terrifically amazing mod, since it will just be ETQW with a few small changes, but it will demonstrate the basic principles.

Introduction

For this tutorial you must:

  • Have your SDK Launcher set up correctly
  • Have a good text-editor, such as Notepad

This tutorial covers:

  • How to create your own mod
  • How to modify ETQW's .def files to change a rocket
  • How to modify ETQW's .script files to change the player

This tutorial does not:

  • Teach you how to program or compile the game code

Basic setup

First, we need to create the mod folder for all the files our mod will use. When you want to send your mod to someone else, all you'll need to send them is the folder, which they can then place in their ETQW directory.

The SDK Launcher includes a button to set this up for you - the 'Create...' button. Press this, and it will ask for a mod name (preferably no spaces, like 'simplemod') and a description. Our mod is going to be called 'simplemod', described as 'a simple mod'.

This will have created a directory in your ETQW directory called 'simplemod'.

Definition files (.def)

ETQW uses .def files to store information and settings for various items, weapons and objects. For example, if you open up \SDK 1.2 Beta\base\def\weapons\rocketlauncher.def in Notepad, you'll see a section about models, a section about animations, and then a section containing lots of different numbers.

This first section with numbers (which starts 'invItemDef inventory/weapons/law') contains all the information about the GDF rocket launcher, such as what model to use, its name, and lots of values about when it can be used and the spread it produces.

Further down, under 'entityDef projectile_law' are all the values for the actual (seeking) rocket (the one that flies through the air and explodes), such as the velocity it flies at ('4000 0 0', which means 'forward at 4000 units a second'), how long it's fuse is ('3', which means 'explode after 3 seconds of not hitting anything'), and gravity ('0', which means 'fly through the air in a straight line').

There's also 'entityDef projectile_law_arcing', which are the values for the non-seeking rocket, which arcs through the air because it has a 'gravity' setting of '120'.

What we're going to do is change the arcing rocket so it travels really slowly, lasts really long, and doesn't arc (i.e. make it fire in a straight line).

Copying the .def file

First, we need to know which file to modify - in this case, it's \SDK 1.2 Beta\base\def\weapons\rocketlauncher.def. However, we shouldn't modify this file, as it's the one from the SDK. Instead, it should be copied to the 'simplemod' folder.

So copy \SDK 1.2 Beta\base\def\weapons\rocketlauncher.def to \simplemod\def\weapons\rocketlauncher.def. You'll need to create the 'def' and 'weapons' folders yourself.

This means that when simplemod is launched, the game will use the simplemod rocketlauncher.def file, instead of ETQW's. So we can change this file as much as we want.

Editing the .def file

Now open \simplemod\def\weapons\rocketlauncher.def in Notepad, and find the section for the entity 'projectile_law_arcing'. It'll look like this:

entityDef projectile_law_arcing {
	"inherit"							"projectile_rocket_base"

	"dmg_damage"						"damage_law"
	"dmg_splash_damage"					"damage_law_splash"

	"launchFromBarrel"					"1"
	"health"							"0"
	"velocity"							"2000 0 0"
	"face_velocity"						"1"
	"gravity"							"120"
	"fuse"								"4"

	"snd_fly"							"sounds/weapons/law/fly"
  	"fx_trail"							"effects/base/missile_trail"

	"fx_explode"						"effects/impacts/rocket/explosion_default"
	"fx_explode_sand"					"effects/impacts/rocket/explosion_sand"
	"fx_explode_metal"					"effects/impacts/rocket/explosion_metal"
	"fx_explode_snow"					"effects/impacts/rocket/explosion_snow"
	
	"use_air_burst"						"1"
	"fx_airburst"						"effects/impacts/rocket/explosion_air"
}

We're going to change the rocket so it travels really slowly in a straight line.

First to make it slower, change the 'velocity' setting from '2000 0 0' to '100 0 0', so it only travels 100 units a second.

Next, change 'gravity' from '120' to '0', so isn't pulled down by gravity while in the air.

Lastly, change 'fuse' from '4' to '30', so it'll last 30 seconds before it explodes (unless it hits something first)

This is the result:

entityDef projectile_law_arcing {
	"inherit"							"projectile_rocket_base"

	"dmg_damage"						"damage_law"
	"dmg_splash_damage"					"damage_law_splash"

	"launchFromBarrel"					"1"
	"health"							"0"
	"velocity"							"100 0 0"
	"face_velocity"						"1"
	"gravity"							"0"
	"fuse"								"30"

	"snd_fly"							"sounds/weapons/law/fly"
  	"fx_trail"							"effects/base/missile_trail"

	"fx_explode"						"effects/impacts/rocket/explosion_default"
	"fx_explode_sand"					"effects/impacts/rocket/explosion_sand"
	"fx_explode_metal"					"effects/impacts/rocket/explosion_metal"
	"fx_explode_snow"					"effects/impacts/rocket/explosion_snow"
	
	"use_air_burst"						"1"
	"fx_airburst"						"effects/impacts/rocket/explosion_air"
}