Author Topic: Weapon and projectile names for commands?  (Read 1290 times)

Hi, I was toying with commands and I was going to try different weapons with this one command:
Code: [Select]
Gunimage.projectile = Rocketlauncherprojectile;But I can't figure out the other names for weapons.
any help?

this belongs in modification discussion..

anyway, I can't really help you.

this belongs in modification discussion..

anyway, I can't really help you.
It's not a modification.

do you mean the weapon name or the projectile name?

most of the time the weapon name is just [weaponnamehere]Image
you can always just load up the .cs file in the weapon and look at the datablock for it

To be specific, I want the Guns Akimbo name, If someone could PM or post a list of all of the Item names and projectile names for the default weapons that'd be great.

To be specific, I want the Guns Akimbo name, If someone could PM or post a list of all of the Item names and projectile names for the default weapons that'd be great.
AkimboGunImage for akimbo guns
RocketLauncherImage for RL
GunImage for gun
SpearImage for spear

its not that hard to find out either

AkimboGunImage for akimbo guns
AkimboGunImage AND LeftHandedGunImage

If you have the image in your hand and want to change it's projectile as well:

findClientByName("your name").player.getMountedImage(0).projectile = projectile;

Another neat thing you can do is make the gun fire like another gun. Not the same speed but the same onFire function.

For example:

function GunImage::onFire(%t,%o,%s){ShotgunImage::onFire(%t,%o,%s);}
This will cause the gun to shoot like the shotgun, combine that with
GunImage.projectile = spearprojectile;
The gun will now shotgun out spears.

This doesn't work in all cases. Some people hardcode the projectile into their onfire code. And do be careful, as something like:
function GunImage::onFire(%t,%o,%s){ShotgunImage::onFire(%t,%o,%s);}
then:
function ShotgunImage::onFire(%t,%o,%s){GunImage::onFire(%t,%o,%s);}
will cause an infinite loop, crashing the game, when either of these are fired.
Another warning:
function GunImage::onFire(%t,%o,%s){GunImage::onFire(%t,%o,%s);}
Will not fix the gun. This will just cause another infinite loop.
exec("add-ons/weapon_gun/server.cs");
This will fix it. Just be sure not to exec things you didn't already enable. Could cause other players to crash.

Thanks guys, You were a big help!

Just be sure not to exec things you didn't already enable. Could cause other players to crash.
speaking of that, why wasn't a better way of handling that used? like in gmod, there's just a big "ERROR" model, or a purple and black checkered texture, if you don't have a file that's used

Because the game wasn't made to load new datablocks mid-game. You're supposed to load those before you launch.