Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Adjusting weapon accuracy for NPCs.  (Read 1665 times)

0 Members and 1 Guest are viewing this topic.

Offline Fidchell

  • *
  • *
  • +4% chance to make useful post
  • Fidchell has no influence.
Adjusting weapon accuracy for NPCs.
« on: February 15, 2011, 08:58:34 PM »
I'm trying to make it where I can adjust certain weapons for NPCs so that they shoot more accurately. Accuracy is a real issue with some weapons such as the Thompson, the OICW, and the Laser Rifle. I know that there's a certain code to adjust this, but I don't know what it is. Could someone fill me in? Thanks a bunch.

Offline Onemanshow

  • JuanMan
  • *
  • *
  • +67% chance to make useful post
  • Onemanshow is awe-inspiring!Onemanshow is awe-inspiring!Onemanshow is awe-inspiring!Onemanshow is awe-inspiring!Onemanshow is awe-inspiring!Onemanshow is awe-inspiring!Onemanshow is awe-inspiring!Onemanshow is awe-inspiring!Onemanshow is awe-inspiring!Onemanshow is awe-inspiring!Onemanshow is awe-inspiring!Onemanshow is awe-inspiring!
Re: Adjusting weapon accuracy for NPCs.
« Reply #1 on: February 16, 2011, 10:53:39 AM »
There's the console command "npc_weapon_adjustspread 0.#", but that affects all weapons used by NPC's.

If the Official SMOD Wiki is correct, you can set a specific value for custom weapons though in its script:

Code: [Select]
"Npc" {
"AdjustSpread"""
}

But that's only for a custom weapon. Aside from the above command there's no way to set separate values for different weapons.

Offline Fidchell

  • *
  • *
  • +4% chance to make useful post
  • Fidchell has no influence.
Re: Adjusting weapon accuracy for NPCs.
« Reply #2 on: February 16, 2011, 03:10:31 PM »
Damnit. I really thought your suggestion would work, but it hasn't. :(

Here's the code I'm trying to modify in its entirety. It is the Pulse Machine gun.

Code: [Select]
//Handheld Pulse Turret
WeaponData
{
// Weapon data is loaded by both the Game and Client DLLs.
"printname" "PULSE-MACHINE GUN"
"viewmodel" "models/weapons/v_pulsemg.mdl"
"playermodel" "models/weapons/w_pulsemg.mdl"
"anim_prefix" "ar2"
"bucket" "3"
"bucket_position" "13"

"clip_size" "60"
"clip2_size" "-1"

"default_clip" "60"
"default_clip2" "-1"

"primary_ammo" "AR2"
"secondary_ammo" "None"

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

// SMOD Ironsight setting.
IronSight
{
"right" "-5.5"
"up" "1.7"
"forward" "-5"
"fov" "-20"
//"AdjustAccuracy" "0.5"
}

// Sounds for the weapon. There is a max of 16 sounds per category (i.e. max 16 "single_shot" sounds)
SoundData
{
"reload" "Weapon_AR2.Reload"
"reload_npc" "Weapon_SMG1.NPC_Reload"
"empty" "Weapon_SMG1.Empty"
"single_shot" "Weapon_functank.Single"
"single_shot_npc" "Weapon_functank.Single"
"special1" "Weapon_SMG1.Special1"
"special2" "Weapon_SMG1.Special2"
"special3" "Weapon_Alyxgun.Single"
"double_shot" "Weapon_SMG1.Double"
"burst" "Weapon_SMG1.Burst"
}

// Weapon Sprite data is loaded by the Client DLL.
TextureData
{
"weapon"
{
"file" "sprites/hud_weapons_pulsemg"
"x" "0"
"y" "0"
"width" "64"
"height" "32"
}
"weapon_s"
{
"file" "sprites/hud_weapons_pulsemg"
"x" "64"
"y" "0"
"width" "64"
"height" "32"
}
"ammo"
{
"font" "WeaponIcons"
"character" "u"
}
"ammo2"
{
"font" "WeaponIcons"
"character" "t"
}
"crosshair"
{
"file" "sprites/hud_weapons"
"x" "0"
"y" "0"
"width" "32"
"height" "32"
}
"autoaim"
{
"file" "sprites/hud_weapons"
"x" "0"
"y" "0"
"width" "32"
"height" "32"
}
}

"WeaponSpec"
{
// 0 : single
// 1 : automatic
// 2 : shotgun
// 3 : autoshotgun
"WeaponType" "1"
"FireRate" "0.075"
"UnderWater" "0"

"Options" {
//"ReloadSound" "1"
"LastFireSound" "0"
"TurnoffScope" "0"
"TurnoffIron" "0"
"CrossHairMove" "0.2"
"CrossHairMinSize" "50.0"
}

"Recoil" {
"PunchPitch" "-0.3 -0.45"
"PunchYaw" "-0.2 0.7"
"EnableSnap" "0"
"SnapPitch" "-0.0 -0.0"
"SnapYaw" "-0.0 0.0"
"Crouch" "0.75"
"Amp" "1.1"
"PunchLimit" "3"
}

"Spread" {
"Default" "5"
"MaxSpread" "5.0"
"Run" "5.0"
"RunSpeed" "100"
"Crouch" "1.0"
"Fire" "1.0"
}

"Bullet" {
"AmmoType" "AR2"
"Damage" "8"
"ShotCount" "1"
"Tracer" "0"
"Force" "1"
}

"Npc" {
"AdjustSpread" "0.5"
"AnimType" "AR2"
"BurstMax" "12"
"BurstMin" "4"
"FireRate" "0.075"
"Range" "4096"
"MuzzleFire" "1"
}
}

}



I'm not really sure what I'm doing wrong here.

Offline Onemanshow

  • JuanMan
  • *
  • *
  • +67% chance to make useful post
  • Onemanshow is awe-inspiring!Onemanshow is awe-inspiring!Onemanshow is awe-inspiring!Onemanshow is awe-inspiring!Onemanshow is awe-inspiring!Onemanshow is awe-inspiring!Onemanshow is awe-inspiring!Onemanshow is awe-inspiring!Onemanshow is awe-inspiring!Onemanshow is awe-inspiring!Onemanshow is awe-inspiring!Onemanshow is awe-inspiring!
Re: Adjusting weapon accuracy for NPCs.
« Reply #3 on: February 18, 2011, 05:27:38 PM »
Damnit. I really thought your suggestion would work, but it hasn't. :(

Here's the code I'm trying to modify in its entirety. It is the Pulse Machine gun.

I'm not really sure what I'm doing wrong here.

It's possible that the "AdjustSpread" code to put into custom weapons is bugged or just was never fully implemented.

Aside from the console command i mentioned before (npc_weapon_adjustspread) i don't really know how else to make NPC's more accurate with specific weapons.  :-\