Difference between revisions of "Scripted Weapons"

From Obsidian Conflict Wiki
Jump to: navigation, search
(New page: {{stub}} Category:MapTuts)
 
Line 1: Line 1:
{{stub}}
+
==Overview==
 +
In Obsidian Conflict, there is a system which allows a mapper to create brand new weapons based on simple plain text script files. No coding knowledge is required to create one of these scripts. Scripted weapons can be setup in many different ways and have the ability to be carried over level transitions, have their own custom ammos, and can also be held by NPCs.
 +
 
 +
==Creating a Scripted Weapon Script==
 +
 
 +
Note:
 +
It is best to take a look through the current scripted weapons included with the mod. Do not change scripted weapons that don't belong to you as this can cause mismatches between server and client. You can not cause any harm to a server by altering the scripted weapons, but they will not look correct on your client so if you need a new weapon, make your own.
 +
 
 +
First Lets start off with a basic script which we will add on to.
 +
 
 +
<pre>"WeaponData"
 +
{
 +
// Weapon data is loaded by both the Game and Client DLLs.
 +
"printname" "AK47"
 +
"viewmodel" "models/weapons/v_rif_ak47.mdl"
 +
"playermodel" "models/weapons/w_rif_ak47.mdl"
 +
"anim_prefix" "ar2"
 +
"bucket" "2"
 +
"bucket_position" "9"
 +
 
 +
"clip_size" "30"
 +
"clip2_size" "0"
 +
 
 +
"default_clip" "30"
 +
"default_clip2" "0"
 +
 
 +
"primary_ammo" "ak47"
 +
"secondary_ammo" "None"
 +
 
 +
"weight" "0"
 +
"item_flags" "0"
 +
 
 +
"BuiltRightHanded" "0"
 +
"AllowFlipping" "1"
 +
 
 +
"csviewmodel" "1"
 +
 
 +
  "ironsightoffset"
 +
{
 +
"x"  "-7.00"
 +
"y"  "6.10"
 +
"z"  "2.90"
 +
  }
 +
 
 +
 
 +
// Sounds for the weapon. There is a max of 16 sounds per category (i.e. max 16 "single_shot" sounds)
 +
"SoundData"
 +
{
 +
// "reload" "Weapon_Pistol.Reload"
 +
"reload_npc" "Weapon_Pistol.NPC_Reload"
 +
"empty" "Weapon_Pistol.Empty"
 +
"single_shot" "Weapon_AK47.Single"
 +
"single_shot_npc" "Weapon_AK47.Single"
 +
"special1" "Weapon_AK47.Single"
 +
}</pre>
 +
 
 +
There are a number of values here you should be familiar with.
 +
 
 +
'''printname''' This is the name that will show up in-game on the players weapon selection hud.
 +
 
 +
'''viewmodel''' First Person Model.
 +
 
 +
'''playermodel''' Third Person Model.
 +
 
 +
'''bucket''' This is the horizontal slot on the players weapon selection hud element.
 +
 
 +
'''bucket_position''' This is the vertical slot on the players weapon selection hud element.
 +
 
 +
'''clip_size''' Size of the Primary Clip
 +
 
 +
'''clip2_size''' Size of the Secondary Clip
 +
 
 +
'''default_clip''' Default bullets in the Primary Clip, should be less than or equal to '''clip_size'''
 +
 
 +
'''default_clip2''' Default bullets in the Secondary Clip, should be less than or equal to '''clip2_size'''
 +
 
 +
'''BuiltRightHanded''' Was this model built right handed?
 +
 
 +
'''AllowFlipping''' Allow the player to flip this model from right handed to left handed?
 +
 
 +
'''csviewmodel''' Was this weapon view model designed for Counter-Strike Source?
 +
 
 +
Alright, and now the SoundData options. You can put soundscript entries in these fields. If you model has built in sounds you should comment them out like I have done above for the reload. The AK47 model has reload sound ques built right into the model.
 +
 
 +
 
 
[[Category:MapTuts]]
 
[[Category:MapTuts]]

Revision as of 00:31, 8 March 2008

Overview

In Obsidian Conflict, there is a system which allows a mapper to create brand new weapons based on simple plain text script files. No coding knowledge is required to create one of these scripts. Scripted weapons can be setup in many different ways and have the ability to be carried over level transitions, have their own custom ammos, and can also be held by NPCs.

Creating a Scripted Weapon Script

Note: It is best to take a look through the current scripted weapons included with the mod. Do not change scripted weapons that don't belong to you as this can cause mismatches between server and client. You can not cause any harm to a server by altering the scripted weapons, but they will not look correct on your client so if you need a new weapon, make your own.

First Lets start off with a basic script which we will add on to.

"WeaponData"
{
	// Weapon data is loaded by both the Game and Client DLLs.
	"printname"			"AK47"
	"viewmodel"			"models/weapons/v_rif_ak47.mdl"
	"playermodel"			"models/weapons/w_rif_ak47.mdl"
	"anim_prefix"			"ar2"
	"bucket"			"2"
	"bucket_position"		"9"

	"clip_size"			"30"
	"clip2_size"			"0"

	"default_clip"			"30"
	"default_clip2"			"0"

	"primary_ammo"			"ak47"
	"secondary_ammo"		"None"

	"weight"			"0"
	"item_flags"			"0"

	"BuiltRightHanded" 		"0"
	"AllowFlipping" 		"1"

	"csviewmodel"			"1"

   	"ironsightoffset"
	{
		"x"   "-7.00"
		"y"   "6.10"
		"z"   "2.90"
   	}


	// Sounds for the weapon. There is a max of 16 sounds per category (i.e. max 16 "single_shot" sounds)
	"SoundData"
	{
//		"reload"		"Weapon_Pistol.Reload"
		"reload_npc"		"Weapon_Pistol.NPC_Reload"
		"empty"			"Weapon_Pistol.Empty"
		"single_shot"		"Weapon_AK47.Single"
		"single_shot_npc"	"Weapon_AK47.Single"
		"special1"		"Weapon_AK47.Single"
	}

There are a number of values here you should be familiar with.

printname This is the name that will show up in-game on the players weapon selection hud.

viewmodel First Person Model.

playermodel Third Person Model.

bucket This is the horizontal slot on the players weapon selection hud element.

bucket_position This is the vertical slot on the players weapon selection hud element.

clip_size Size of the Primary Clip

clip2_size Size of the Secondary Clip

default_clip Default bullets in the Primary Clip, should be less than or equal to clip_size

default_clip2 Default bullets in the Secondary Clip, should be less than or equal to clip2_size

BuiltRightHanded Was this model built right handed?

AllowFlipping Allow the player to flip this model from right handed to left handed?

csviewmodel Was this weapon view model designed for Counter-Strike Source?

Alright, and now the SoundData options. You can put soundscript entries in these fields. If you model has built in sounds you should comment them out like I have done above for the reload. The AK47 model has reload sound ques built right into the model.