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

Author Topic: A few problems regarding weapon_custom script and mapadd  (Read 2690 times)

0 Members and 1 Guest are viewing this topic.

Offline Zadaki_L

  • *
  • +1% chance to make useful post
  • Zadaki_L has no influence.
A few problems regarding weapon_custom script and mapadd
« on: August 22, 2013, 03:21:08 AM »
I've got a few problems, and I'd appreciate any help that you'd be willing to offer. I am working with SMOD: Tactical 5.56

First, I'm trying to get some npcs to use semiauto pistols "weaponspec" { "weapontype" "0"

The problem I'm having is that no matter what is in the "weaponspec" { "npc" { block of the weapon_custom script, the npc fires the pistol as fast as full auto. And changing the "weaponspec" { "firerate" doesn't have any effect on the npcs but limits the fire rate for the player.

Of the four weapon_custom scripts, npcs fire at a reasonable rate for weapon_custom1 but rrrrrrrrrrp for the other three, and I can find no discernable difference between them.

Here's weapon_custom1 which works perfectly:
Quote
WeaponData
{
   // Weapon data is loaded by both the Game and Client DLLs.
   "printname"         "Kimber .45 ACP"
   "viewmodel"         "models/weapons/v_pist_deagle.mdl"
   "playermodel"         "models/weapons/w_pist_deagle.mdl"
   "anim_prefix"         "pistol"
   "bucket"         "1"
   "bucket_position"      "0"

   "clip_size"         "8"
   "clip2_size"         "-1"

   "default_clip"         "8"
   "default_clip2"         "-1"

   "primary_ammo"         "CustomAmmo1"
   "secondary_ammo"      "None"

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

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

   "CSViewModel"         "1"
   "MuzzleType"         "MZSMG"
   "MuzzleSize"         "0"
//   "MuzzleAttach"         "0"
   "LagScale"         ".25"
   "CSWorldModel"         "0"

   // SMOD Ironsight setting.
   IronSight
   {
      "right"      "-0.0050"
      "up"      "0.4700"
      "pitch"      "-0.10"
      "forward"   "2.80"
   }

   // SMOD Adjust View model postion
   Adjust
   {
      "right"      "3.46"
      "up"      "1.020"
      "forward"   "1.60"
   }

   VMDOF
   {
      "IronSight" {
         "start"      "9"
         "end"      "10"
      }
   }

   // 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_DEagle.Single"
      "single_shot_npc"   "Weapon_DEagle.Single"
   }

   // Weapon Sprite data is loaded by the Client DLL.
   TextureData
   {
      "weapon"
      {
            "font"      "WeaponIcons"
            "character"   "d"
      }
      "weapon_s"
      {   
            "font"      "WeaponIconsSelected"
            "character"   "d"
      }
      "ammo"
      {
            "font"      "WeaponIcons"
            "character"   "p"
      }
      "ammo2"
      {
            "font"      "WeaponIcons"
            "character"   "t"
      }
      "crosshair"
      {
            "font"      "Crosshairs"
            "character"   "Q"
      }
      "autoaim"
      {
            "file"      "sprites/crosshairs"
            "x"         "0"
            "y"         "48"
            "width"      "24"
            "height"   "24"
      }
   }
   
   "WeaponSpec"
   {
      //   0 : single
      //   1 : automatic
      //   2 : shotgun
      //   3 : autoshotgun
      "WeaponType"   "0"
      "FireRate"   "0.1"
      "UnderWater"   "1"
      
      "Options" {
         "ReloadSound"   "0"
         "LastFireSound"   "0"
         "TurnoffScope"   "0"
         "TurnoffIron"   "0"
         "TimeScale"   "1"
         "LastDryFireActivity"   "1"   // not work
      }

      "ShootPos" {
           "UpperPitch" "0 0 -0.50"
           "UpperPitch" "0 0 -0.50"
           "IronSight"  "0 0 -0.3"
      }

      "Recoil" {
         "PunchPitch"   "-1.5 0"
         "PunchYaw"   "-0.5 0.5"
         "EnableSnap"   "1"
         "SnapPitch"   "-0.1 0.0"
         "SnapYaw"   "-0.05 0.05"
         "Crouch"   "0.9"
         "Amp"      "3"
         "PunchLimit"   "3"
      }
      
      "Spread" {
         "Default"   "1.0"
         "MaxSpread"   "3"
         "Run"      "3"
         "RunSpeed"   "100"
         "Crouch"   "1"
         "Fire"      "3.0"
      }
      
      "Bullet" {
         "AmmoType"   "Pistol"
         "Damage"   "17" //20
         "ShotCount"   "1"
         "Tracer"   "0"
         "Force"      "0.5"
         "Penetrate"   "5"
      }


      "Npc" {
         "AnimType"   "pistol"
         "BurstMax"   "3"
         "BurstMin"   "2"
         "FireRate"   "1.0"
         "Range"      "80000"
         "MuzzleFire"   "1"
      }
   }
}



And an example of one of the pistols that the npcs fire ridiculously fast:
Quote
WeaponData
{
   // Weapon data is loaded by both the Game and Client DLLs.
   "printname"         "Glock 19"
   "viewmodel"         "models/weapons/v_pist_glock18.mdl"
   "playermodel"         "models/weapons/w_pist_glock18.mdl"
   "anim_prefix"         "pistol"
   "bucket"         "1"
   "bucket_position"      "1"

   "clip_size"         "15"
   "clip2_size"         "-1"

   "default_clip"         "30"
   "default_clip2"         "-1"

   "primary_ammo"         "CustomAmmo2"
   "secondary_ammo"      "None"

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

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

   "CSViewModel"         "1"
   "MuzzleType"         "MZSMG"
   "MuzzleSize"         "0"
//   "MuzzleAttach"         "0"
   "LagScale"         "1"
   "CSWorldModel"         "1"

   // SMOD Ironsight setting.
   IronSight
   {
      "right"      "-0.02"
      "up"      "1.25"
      "forward"   "0.600"
      "pitch"      "-0.20"

   }

   // SMOD Adjust View model postion
   Adjust
   {
      "right"      "2.620"
      "up"      "0"
      "forward"   "5.20"

   }

   VMDOF
   {
      "IronSight" {
         "start"      "-20."
         "end"      "24.0"
      }
   }

   // 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_Glock.Single"
      "single_shot_npc"   "Weapon_Glock.Single"
      "special1"      "Weapon_Pistol.Special1"
      "special2"      "Weapon_Pistol.Special2"
      "burst"         "Weapon_Pistol.Burst"
   }

   // Weapon Sprite data is loaded by the Client DLL.
   TextureData
   {
      "weapon"
      {
            "font"      "WeaponIcons"
            "character"   "d"
      }
      "weapon_s"
      {   
            "font"      "WeaponIconsSelected"
            "character"   "d"
      }
      "ammo"
      {
            "font"      "WeaponIcons"
            "character"   "p"
      }
      "ammo2"
      {
            "font"      "WeaponIcons"
            "character"   "t"
      }
      "crosshair"
      {
            "font"      "Crosshairs"
            "character"   "Q"
      }
      "autoaim"
      {
            "file"      "sprites/crosshairs"
            "x"         "0"
            "y"         "48"
            "width"      "24"
            "height"   "24"
      }
   }
   
   "WeaponSpec"
   {
      //   0 : single
      //   1 : automatic
      //   2 : shotgun
      //   3 : autoshotgun
      "WeaponType"   "0"
      "FireRate"   "0.1"
      "UnderWater"   "1"
      
   
      "Options" {
         "ReloadSound"   "0"
         "LastFireSound"   "0"
         "TurnoffScope"   "0"
         "TurnoffIron"   "0"
         "TimeScale"   "1"
         "LastDryFireActivity"   "1"   // not work
      }
      
      "Recoil" {
         "PunchPitch"   "-1 0"
         "PunchYaw"   "-0.2 0.2"
         "EnableSnap"   "1"
         "SnapPitch"   "-0.1 0"
         "SnapYaw"   "-0.05 0.05"
         "Crouch"   "0.9"
         "Amp"      "1.5"
         "PunchLimit"   "2"
      }
      
      "Spread" {
         "Default"   "1.25"
         "MaxSpread"   "3"
         "Run"      "3"
         "RunSpeed"   "100"
         "Crouch"   "1"
         "Fire"      "3.0"
      }
      
      "Bullet" {
         "AmmoType"   "Pistol"
         "Damage"   "15" //15
         "ShotCount"   "1"
         "Tracer"   "0"
         "Force"      "0.5"
         "Penetrate"   "5"
      }

      "Npc" {
         "AnimType"   "pistol"
         "BurstMax"   "3"
         "BurstMin"   "2"
         "FireRate"   "0.75"
         "Range"      "80000"
         "MuzzleFire"   "1"
      }
   }
}



I know there are other scripts which control certain things about the weapons, like weapon_category. I know there's something that affects leaning left or right and whether the view "slides" and stays vertical or "tilts" with the lean, but I can't figure that out either.

So is there a reason that "npc" { "firerate" isn't working, like some other script that controls npc fire rate with semi-only weapons?

I'll add my mapadd questions in another post.

Thanks!

Offline Zadaki_L

  • *
  • +1% chance to make useful post
  • Zadaki_L has no influence.
Re: A few problems regarding weapon_custom script and mapadd
« Reply #1 on: August 22, 2013, 03:35:14 AM »
And now my mapadd question. Again, using SMOD: Tactical 5.56

I'm trying to get npc_citizen to act like an enemy, because the npc_metropolice futuristic chatter and overwatch messages kind of ruin the feel of certain maps I'm trying to do, and none of the combine are animated for pistols.

I could change the sounds for npc_metropolice, but I want to keep the normal sounds for other maps, like hl2.

Is there a way to change the npc chatter and death noise for a single map? Or a way to get "relation" to work?

I can't get it to work in the randomspawn section, or in entities.

In randomspawn, of course keyvalues don't work, but I include something like:
Quote
   "npc_citizen" {
      "count"      "20"
      "targetname"   "mafia"
      "patrolrandom"
      "values"    "relation gh1"
   }

And in entities, I tried it in keyvalues:
Quote
   "npc_citizen" {
      "origin"   "-566 -84 380"
      "angle"      "0 180 0"
      "keyvalues" {
         "relation"   "gh1"
      }
   }

Any ideas?

Thanks again.

Offline BIZ

  • 32-Bit Hobo
  • *
  • *
  • +0% chance to make useful post
  • BIZ hides in shadows.
    • BSNOOCH.COM
Re: A few problems regarding weapon_custom script and mapadd
« Reply #2 on: August 22, 2013, 04:11:25 AM »
- snip -

relation is not actually a keyvalue, it is some special SMOD token. I should not go in the keyvalues section. Some SMOD tokens will actually crash the game if they are in the keyvalues section :S

Try like this instead:

Quote
   "npc_citizen" {
      "origin"   "-566 -84 380"
      "angle"      "0 180 0"
"relation"   "gh1"
   }

I would suggest using this entity as you can flip it on and off as needed - http://developer.valvesoftware.com/wiki/Ai_relationship
OR
You can try this event style relationship - http://smod.wikidot.com/mapadd:reference-nonlua#toc10

Offline Zadaki_L

  • *
  • +1% chance to make useful post
  • Zadaki_L has no influence.
Re: A few problems regarding weapon_custom script and mapadd
« Reply #3 on: August 22, 2013, 11:59:44 AM »
snip

Interesting. I assumed it was a keyvalue because that's how it was listed in the smod wiki, including the example. I'll try both of those, thanks.


Edit: the relation entity works, but I can't get ai_relationship to function. Thanks!

Interestingly though, the first time a squad of npc_citizen encounters the player, they dawdle, as if deciding whether they want to follow or fight. Then they become hostile after 2-5 seconds. After this, they are always hostile. But if they are not in squads, each individual has to think about it for a while.


Any ideas on the npc semiauto fire rate?
« Last Edit: August 22, 2013, 12:21:28 PM by Zadaki_L »

Offline Counter-Life™

  • *
  • *
  • +17% chance to make useful post
  • Counter-Life™ is a rising star!Counter-Life™ is a rising star!Counter-Life™ is a rising star!Counter-Life™ is a rising star!Counter-Life™ is a rising star!Counter-Life™ is a rising star!
    • Youtube Channel
Re: A few problems regarding weapon_custom script and mapadd
« Reply #4 on: August 22, 2013, 12:42:28 PM »
Set CSWorldModel to 0 in the Glock 19 script. It should work then.

Also, welcome to BSNOOCH!

Offline BIZ

  • 32-Bit Hobo
  • *
  • *
  • +0% chance to make useful post
  • BIZ hides in shadows.
    • BSNOOCH.COM
Re: A few problems regarding weapon_custom script and mapadd
« Reply #5 on: August 22, 2013, 03:07:53 PM »

Edit: the relation entity works, but I can't get ai_relationship to function. Thanks!


Sorry I forgot to mention that the ai_relationship doesn't start automatically. You need to send it the input ApplyRelationship
here are a few ideas:


Code: [Select]
// Fires when this NPC hears the player
"OnHearPlayer" "ai_relationship_name,ApplyRelationship,,0,1"

Code: [Select]
// Fired from an event
"event" {
"targetname" "ai_relationship_name"
"action" "applyrelationship"
"delaytime" "0.01"
}
« Last Edit: August 22, 2013, 03:15:07 PM by BIZ »

Offline Zadaki_L

  • *
  • +1% chance to make useful post
  • Zadaki_L has no influence.
Re: A few problems regarding weapon_custom script and mapadd
« Reply #6 on: August 23, 2013, 03:13:41 AM »
Set CSWorldModel to 0 in the Glock 19 script. It should work then.

Also, welcome to BSNOOCH!

Thanks for the welcome!

And thanks for the suggestion. I set the CSWorldModel to 0 and the shooting has slowed down, but the npcs are still shooting faster than I can click the mouse. The "FireRate" within the npc block doesn't seem to affect semiautomatic weapons like it does full auto.

If they choose to shoot as fast as they can yank the trigger, fine, but they don't seem to suffer any accuracy penalty like I do.

Any other ideas?


Offline Counter-Life™

  • *
  • *
  • +17% chance to make useful post
  • Counter-Life™ is a rising star!Counter-Life™ is a rising star!Counter-Life™ is a rising star!Counter-Life™ is a rising star!Counter-Life™ is a rising star!Counter-Life™ is a rising star!
    • Youtube Channel
Re: A few problems regarding weapon_custom script and mapadd
« Reply #7 on: August 23, 2013, 12:46:52 PM »
Set CSWorldModel to 0 in the Glock 19 script. It should work then.

Also, welcome to BSNOOCH!

Thanks for the welcome!

And thanks for the suggestion. I set the CSWorldModel to 0 and the shooting has slowed down, but the npcs are still shooting faster than I can click the mouse. The "FireRate" within the npc block doesn't seem to affect semiautomatic weapons like it does full auto.

If they choose to shoot as fast as they can yank the trigger, fine, but they don't seem to suffer any accuracy penalty like I do.

Any other ideas?

Try to set BurstMax to 2 and Burstmin to 1.

Offline Zadaki_L

  • *
  • +1% chance to make useful post
  • Zadaki_L has no influence.
Re: A few problems regarding weapon_custom script and mapadd
« Reply #8 on: August 25, 2013, 02:28:22 AM »
Set CSWorldModel to 0 in the Glock 19 script. It should work then.

Also, welcome to BSNOOCH!

Thanks for the welcome!

And thanks for the suggestion. I set the CSWorldModel to 0 and the shooting has slowed down, but the npcs are still shooting faster than I can click the mouse. The "FireRate" within the npc block doesn't seem to affect semiautomatic weapons like it does full auto.

If they choose to shoot as fast as they can yank the trigger, fine, but they don't seem to suffer any accuracy penalty like I do.

Any other ideas?

Try to set BurstMax to 2 and Burstmin to 1.

Still mag dumps. I set BurstMax to 1 and they would raise the gun, fire one shot real quick, then drop into low ready and immediately raise the gun again and fire one shot and...

Mag dumps are better. I'll call this good enough.  Thanks!




On a separate note, how are the different leaning options for different weapons achieved?

Offline Pepsifan04

  • *
  • *
  • +12% chance to make useful post
  • Pepsifan04 might someday be someone...Pepsifan04 might someday be someone...Pepsifan04 might someday be someone...Pepsifan04 might someday be someone...
    • Smod: CryLife
Re: A few problems regarding weapon_custom script and mapadd
« Reply #9 on: August 26, 2013, 05:47:39 AM »
My solution to every Weapon_custom## problem:
1. Copy whole script from working weapon
2. make backup of broken one
3. Paste working script in to the broken weapon_custom## file
4. Edit values in broken(now working) weapon_custom## to match the old ones
5. ???
6. Profit!

And now seriously, Have you tried different w_model for broken weapons? (w_pistol.mdl for e.g.)
DROP DATABASE bsnooch

Offline Zadaki_L

  • *
  • +1% chance to make useful post
  • Zadaki_L has no influence.
Re: A few problems regarding weapon_custom script and mapadd
« Reply #10 on: August 29, 2013, 12:35:14 PM »
My solution to every Weapon_custom## problem:
1. Copy whole script from working weapon
2. make backup of broken one
3. Paste working script in to the broken weapon_custom## file
4. Edit values in broken(now working) weapon_custom## to match the old ones
5. ???
6. Profit!

And now seriously, Have you tried different w_model for broken weapons? (w_pistol.mdl for e.g.)


I tried that first. Unfortunately, other scripts that interact with the weapons cause problems if you do that; for example, if the bucket and bucket positions change with respect to the weapon_class file, it can cause a problem. I'm using SMOD:Tactical 5.56 and none of the buckets or bucket positions match the weapon_class script, but if I change them from what they came originally as, they're broken.

So I keep a backup, and for, say the double pistols (which I know, having used double pistols in an IDPA silhouette match on a dare, to be extremely silly), I use a single pistol model and copy/paste all the info from weapon_custom1 (kimber .45) that is working perfectly and the most similar to the pistol I'm trying to make. Then I go back and revert the bucket and bucket position, etc.

But some weird stuff still happens, like the incredible fire rate (apparently due to the csworldmodel line interacting with the world model), or leaning while keeping the gun vertical vs. tilting the gun with your body.