Criminal@Posted: Tue Feb 27, 2007 12:54 am :
Okay i have searched this forum ALOT and i still couldnt really answer my question. My question is do you HAVE to recompile and change the class.cpp to import a custom weapon into the game? Essentially we've coded some custom walkers already but just simply putting in a new pistol is getting to be very annoying.

"weaponclass" "rvWeaponBlaster"

this is the weapon class i am currently using and i thought you could still use a stock weapon class without changing the whole class.cpp . Am i wrong? For now ill post my code for this particular weapon which is called "HSP" and maybe you guys can find something that im just not seeing.

The main problem is when i go to pickup the weapon (which i see fine in game) in the console it just keeps repeating "unknown weapon"

// hsp.def
// Copyright 2002-2004 Raven Software
// Weapon Defintion

model isdle {
   mesh   models/weapons/hsp/hsp.md5mesh
   anim idle   models/weapons/hsp/idle.md5anim

entityDef weapon_hsp

   "editor_menu"            "pickup"
   "editor_color"            ".3 .3 1"
   "editor_mins"            "-16 -16 0"
   "editor_maxs"            "16 16 32"

   "editor_usage"            "hsp"

   "spawnclass"            "idItem"
   "weaponclass"            "rvWeaponBlaster"
   "weaponname"            "hsp"
   "size"                  "32 32 32"

     "model_view"            "viewmodel_hsp"
     "model_world"            "worldmodel_hsp"
   "model"                "models/weapons/hsp/hsp.ase"

   "joint_attach"            "PST_ATTACHER"
   "joint_view_flashlight"      "barrel"
   "joint_view_flash"         "barrel"
   "joint_world_flash"         "muzzle_flash"

   // Firing properties
   "chargeTime"            ".8"
   "chargeDelay"            ".1"
   "chargeGlow"            "0 .4"
   "fireRate"               ".15"
   "spread"               ".2"

//   "def_projectile"         "projectile_blaster"
   "def_hitscan"            "hitscan_blaster"
   "def_altprojectile"         "projectile_blaster_charged"
   "ammoType"               "ammo_blaster"
   "clipSize"               "0"
   "ammoRequired"            "0"
//   "launchFromBarrel"         "1"

   "inv_weapon"            "weapon_hsp"
   "inv_item"               "5"
   "inv_icon"               "gfx/guis/hud/icons/item_blaster.tga"
   "inv_name"               "hsp"

//   "gui"                  "guis/weapons/blaster_ammo.gui"
   "mtr_icon"               "gfx/guis/hud/icons/gun_blaster"

   "mtr_crosshair"            "gfx/guis/crosshairs/crosshair_blaster"
//   "crosshairOffsetX"         "2"
//   "crosshairOffsetY"         "2"

   // -------------------- Recoil and Muzzle Kick ---------------------------------------

   "muzzle_kick_time"         "0.1"
   "muzzle_kick_maxtime"      "0.2"
   "muzzle_kick_angles"      "-5 0 0"
   "muzzle_kick_offset"      "2 0 0"

   "recoilTime"            "100"
   "recoilAngles"            "-2 0 0"
   // ---------------------------- Flashlight ---------------------------------------
   "mtr_flashlightShader"      "gfx/lights/flashlight"
   "flashlightColor"         "1 1 .9"
   "flashlightRadius"         "400"
   "flashlightAngle"         "15.0"
   "flashlightTarget"         "1000 0 0"
   "flashlightUp"            "0 375 0"
   "flashlightRight"         "0 0 -375"
   "flashlightPointLight"      "0"

   // ---------------------------- Muzzle Flash ---------------------------------------

   "mtr_flashShader"         "lights/muzzleflash"
   "flashColor"            "0.7 0.8 1"
   "flashRadius"            "200"
   "flashPointLight"         "1"
   "flashTime"               ".1"
   "flashViewOffset"         "15 5 -10"

   // ------------------------- Sounds and Effects ---------------------------------------
   "snd_charge"            "weapon_blaster_charge"
   "snd_charge_loop"         "weapon_blaster_charged"
   "snd_charge_click"         "weapon_blaster_charge_click"
   "snd_quaddamage"         "weapon_quaddamage_fire"

   "fx_normalflash"         "effects/weapons/blaster/muzzleflash.fx"
   "fx_chargedflash"         "effects/weapons/blaster/charged/muzzleflash.fx"      
   "fx_respawn"            "effects/mp/itemrespawn.fx"
   "fx_muzzleflash_world"      "effects/weapons/blaster/muzzleflash_world.fx"

   "snd_acquire"            "pickup_weapon"

   "def_viewStyle"            "viewStyle_q3_blaster"
   "def_viewStyle1"         "viewStyle_shouldered_blaster"

   "foreshorten"            ".65"
   "weaponAngleOffsetAverages" "10"
   "weaponAngleOffsetScale"    ".25"
   "weaponAngleOffsetMax"      "10"
   "weaponOffsetTime"         "600"
   "weaponOffsetScale"         "0.003"
   "net_syncPhysics"         "1"

// Models

model viewmodel_hsp
   mesh                  models/weapons/hsp/view.md5mesh

   anim idle                models/weapons/hsp/idle.md5anim   
   anim raise               models/weapons/hsp/raise.md5anim
      rate               1.4
      frame 6               sound_weapon   weapon_hsp_ready
   anim putaway            models/weapons/hsp/lower.md5anim
      frame 1               sound_weapon   weapon_switch

   anim fire1                models/weapons/hsp/fire.md5anim
      frame 1               sound_weapon   weapon_blaster_fire
      frame 1               sound_item      weapon_blaster_fire_stereo
   anim fire2                models/weapons/hsp/fire2.md5anim
      frame 1               sound_weapon   weapon_blaster_fire
      frame 1               sound_item      weapon_blaster_fire_stereo

   anim flashlight            models/weapons/hsp/flashlight.md5anim
      frame 8               sound_weapon   weapon_hsp_flashlight
   anim charging            models/weapons/hsp/charge_up.md5anim
   anim chargedfire         models/weapons/hsp/big_recoil.md5anim
      frame 1               sound_weapon   weapon_blaster_fire_charged
      frame 1               sound_item      weapon_blaster_fire_stereo

model weapon_hsp_view_strogg
   inherit                  weapon_blaster_view
   mesh                  models/weapons/hsp/view_strogg.md5mesh

model worldmodel_hsp
   anim idle            models/weapons/hsp/world/idle.md5anim

// Mods

// Projectile

entityDef hitscan_blaster
   "range"                  "10000"

   "fx_impact"               "effects/weapons/blaster/impact_default.fx"
   "fx_impact_water"         "effects/ambient/splash_smll.fx"
   "fx_impact_concrete"      "effects/weapons/hyperblaster/impact_concrete.fx"
   "fx_impact_flesh"         "effects/weapons/hyperblaster/impact_flesh.fx"
   "fx_impact_monstermetal"   "effects/weapons/hyperblaster/impact_flesh.fx"
   "fx_impact_glass"         "effects/weapons/blaster/impact_glass.fx"               
   "fx_impact_bpglass"         "effects/weapons/blaster/impact_bpglass.fx"
   "fx_impact_electronics"      "effects/weapons/hyperblaster/impact_electronics.fx"   

   "fx_path"               "effects/weapons/blaster/trail.fx"
   "def_damage"            "damage_blaster"
   "push"                  "7500"

   "impact_gib"            "1"

entityDef projectile_blaster
   "spawnclass"            "idProjectile"
   "mins"                  "-2 -2 -2"
   "maxs"                  "2 2 2"
   "cone"                  "2"
   "noshadows"               "1"
   "def_damage"            "damage_blaster"
   "velocity"               "1500 0 0"
   "fuse"                  "4"
   "push"                  "7500"
   "detonate_on_fuse"         "1"
   "detonate_on_death"         "0"
   "detonate_on_world"         "1"
   "detonate_on_actor"         "1"
   "impact_gib"            "1"
   "decal_bounce"            ""
   "decal_size"            "8"
   "fx_fly"               "effects/weapons/blaster/fly.fx"
   "fx_impact"               "effects/weapons/blaster/impact_default.fx"
   "fx_impact_water"         "effects/ambient/splash_smll.fx"
   "fx_impact_flesh"         "effects/weapons/blaster/impact_flesh.fx"
   "fx_impact_monstermetal"   "effects/weapons/blaster/impact_monstermetal.fx"
   "fx_impact_electronics"      "effects/weapons/machinegun/impact_electronics.fx"
   "fx_impact_armor"         "effects/weapons/machinegun/impact_armor.fx"
   "fx_teleport_enter"      "effects/mp/item_teleport.fx"
   "fx_teleport"         "effects/mp/item_teleport.fx"

entityDef projectile_blaster_charged
   "inherit"               "projectile_blaster"

   "mins"                  "-8 -8 -8"
   "maxs"                  "8 8 8"

   "velocity"               "2000 0 0"

   "fx_fly"               "effects/weapons/blaster/charged/fly.fx"
   "fx_impact"               "effects/weapons/blaster/charged/impact_default.fx"
   "fx_impact_flesh"         "effects/weapons/blaster/impact_flesh_charged.fx"
   "fx_impact_monstermetal"   "effects/weapons/blaster/impact_monstermetal_charged.fx"
   "fx_impact_electronics"      "effects/weapons/machinegun/impact_electronics.fx"
   "fx_impact_armor"         "effects/weapons/machinegun/impact_armor.fx"

   "def_damage"            "damage_blaster_charged"
   "def_splash_damage"         "damage_blastersplash_charged"

// Damage

entityDef damage_blaster
   "inherit"               "damage_bullet"
   "damage"               "8"

   "fx_wound"               "effects/wounds/energy.fx"

   "deathPush"               "100"
   "deathPushMin"            "2000 250"
   "deathPushMax"            "5000 500"

entityDef damage_blaster_charged
   "inherit"               "damage_blaster"
   "damage"               "50"

entityDef damage_blastersplash_charged
   "inherit"               "damage_blaster"
   "damage"               "40"
   "radius"               "50"
   "knockback"               "30"
   "push"                  "2500"

AnthonyJa@Posted: Tue Feb 27, 2007 2:36 am :
If something spams a warning over and over again, the easiest way to figure out why is to search for that warning, and then look at why it displays that message.

Assuming you're talking about this, from mpgame\Player.cpp(931):
   gameLocal.Warning( "Unknown weapon '%s'", weaponName.c_str() );

then the reason is that you've not added the weapon into the player.def in a def_weaponX slot. Also look for other bits in there, as you need to add a few things I think.

Criminal@Posted: Tue Feb 27, 2007 5:55 am :
Yeah i already added it into the Player def in an existing slot. So let me be sure i'm understanding....if you dont add it into the class.css you CAN still import the weapon in you just have to essentially replace another one in the weapons slots correct??

Infernal=WFR@Posted: Tue Feb 27, 2007 7:52 am :
lets make it very clear:

lets do this:

entityDef Weapon_string_name {

"weaponclass" "rvWeaponBlaster"

Weapon_string_name has to be in a weapon slot on the player.

the string in "weaponclass" is the one that has to be in idClass.cpp. Note that you will ONLY have to add the "rvWeaponBlaster" data string to idClass.cpp if it's not defined in code yet. If you are creating a completely new weapon, you would typically copy code from the closest weapon type, declare a new code object type, add that to idclass.cpp registration and then use it in the "weaponclass" line in your new entitydef.

also.. if you weren't careful and added it only to entitydef player in the first weapon spot.. then if you load the game in multiplayer, entitydef player_mp will have overriten your new weapon in the weapon slots.

kensvehla@Posted: Thu Sep 20, 2007 7:30 am :
Ok, after many hours of trying things again and again this (artist, not scripter) is becoming frustrated. :D

I am running a dev team at school and things have been going quite smoothly up until trying to get our weapons into the players hands. (Don't worry its not an MD5 export issue). We have the weapons modeled, our characters done levels finished and a ton of art assests as well as custom mp game types done, but the weapons are having issues. Basically I'm having issues more with the definition file side of things. I can everything in the def if requested but for now I'll just post the upper part. The error I'm getting is:

------------ Processing events --------------
Error ERP_DROP: entityDef not found: player_viewweapon
------------ Game Map Shutdown --------------
ERROR: entityDef not found: player_viewweapon
clientState != CS_CONNECTING, not waiting for game auth, authKey ignored
]condump weaponerror
Dumped console text to weaponerror.txt.


now I know what you're thinking, but I do have a both a player.def and a "weapon.def", at this point i'd be willing to send a small test pk4 with just the weapon in it, if they could help me/us/the team. figure out why this isn't working. We're hoping to present and get this up and running by november, and this is the only hiccup in the mod we've really had. Right now I"m just trying to replace an existing weapon, not add a whole new slot. I've been looking through every .def file I can, and I can't find anything on "player_viewweapon" anywhere. Again guys I'm very familiar with the Doom3 engine, (we're using Q4) but, this just has me stumped.

sample def script:

// svinfinity.def
// Copyright 2002-2004 Raven Software

export svinfinity
options -sourcedir models/weapons/svinfinity/animations -destdir models/weapons/svinfinity

mesh -dest svinfinity
anim -dest idle


entityDef weapon_svinfinity
"editor_menu" "pickup"
"editor_color" ".3 .3 1"
"editor_mins" "-16 -16 0"
"editor_maxs" "16 16 32"

"editor_usage" "svinfinity"

"spawnclass" "idItem"
"weaponclass" "rvWeaponBlaster"
"weaponname" "Blaster"
"size" "32 32 32"

"model_view" "weapon_svinfinity_view"

"model_world" "weapon_svinfinity_world"
"model" "models/weapons/svinfinity_world/svinfinity.ase"

"joint_attach" "PST_ATTACHER"
"joint_view_flashlight" "barrel"
"joint_view_flash" "barrel"
"joint_world_flash" "muzzle_flash"

// Firing properties
"chargeTime" ".8"
"chargeDelay" ".1"
"chargeGlow" "0 .4"
"fireRate" ".15"
"spread" ".2"

// "def_projectile" "projectile_svinfinity"
"def_hitscan" "hitscan_blaster"

Infernal=WFR@Posted: Fri Sep 21, 2007 4:57 am :
snippet from hyperblaster.def

model weapon_hyperblaster_view
   mesh                  models/weapons/hyperblaster/mesh.md5mesh
   skin                  skins/weapons/hyperblaster/nobounce
   anim idle                models/weapons/hyperblaster/idle.md5anim   
   anim fire                models/weapons/hyperblaster/fire.md5anim   
      frame 1               sound_weapon   weapon_hyperblaster_fire
      frame 1               sound_item      weapon_hyperblaster_fire_stereo
   anim reload             models/weapons/hyperblaster/reload.md5anim   
      frame 1               sound_weapon   weapon_hyperblaster_cell_out
      frame 21            sound_item      weapon_hyperblaster_cell_in
      frame 34            sound_weapon   weapon_hyperblaster_close
   anim raise               models/weapons/hyperblaster/raise.md5anim
   anim putaway            models/weapons/hyperblaster/lower.md5anim
      frame 1               sound_weapon   weapon_switch

have you defined a view model for your weapon_svinfinity_view and also the model for weapon_svinfinity_world?

just asking.

kensvehla@Posted: Fri Sep 21, 2007 7:44 am :
thx for your reply, yes I have actually both for the view and the world model defined as you have shown above. Again I am familiar with the engine, but am not much for scripting and programming. LOL More of an artist :) I do know that the Md5's are correct b/c I am able to open and view them in different md5 viewers. At least as far as the geometry and animations are concerned. I spent literally the entire night, last night trying to figure out what this was, but have had no luck, :(, Hopefully you have some more words of wisdom for me :D

taken from the def file: (again this is just a test before I go in and get everything else working. I wanted to get the idle working first) Less to break :) forgive the formatting as it is being skewed somehow by the forums.

// Models

model weapon_svinfinity_view
mesh models/weapons/svinfinity/view.md5mesh

anim idle models/weapons/svinfinity/idle.md5anim

model weapon_svinfinity_world
mesh models/weapons/svinfinity/world/view.md5mesh
anim idle models/weapons/svinfinity/world/idle.md5anim

Infernal=WFR@Posted: Sat Sep 22, 2007 1:48 am :
Um snippet from player.def in baseq4 pk4s


entityDef player_viewweapon {
   "spawnclass"            "rvViewWeapon"

Player.def holds ALOT more than just the player's entitydef, if you have a custom player.def, it is loaded instead, not over top of the q4 .def. This means that if your player.def doesn't contain all the different required entity definitions that the q4 one has, your player.def will cause your game to crash in such fashion.

kensvehla@Posted: Sat Sep 22, 2007 10:03 pm :
Alright I shall give this a try, thx for your help I"ll letyouknow how it works out :)

kensvehla@Posted: Thu Sep 27, 2007 2:14 am :
ok, got that fixed but now I have another error that is popping up.

"EntityDef not found ; player_animatedentity"

Now I'm assuming that you're probably go