Dragunov - L96 rifle
Hi,
I'm trying to make plugin for Rust with a quite simple idea - use the new L96 sniper rifle as semi-automatic Dragunov style rifle with reduced damage. But I can't find out how to disable the reloading animation after each shot. I've tried to modify an instance of BaseProjectile class, but any of the methods/attributes have no effect on reload animation (at least the public attributes and methods). Any ideas?

Thx for help, best regards 
fisch111
In response to fisch111 ():
Hi,
I'm trying to make plugin for Rust with a quite simple idea - use the new L96 sniper rifle...
change active item to 0 and back. or you can try to make reload after shot (manually)

Merged post

also i can help you with changing icon of L97. PM me  if you want

Merged post

Ex:
projectile.ServerReload();​
projectile.reloadTime = 0f;

 



Merged post

var a = player.svActiveItemID;
player.svActiveItemID = 0;
// reload here
player.svActiveItemID = a;
Hi,
thx for the suggestion, unfortunately I can't get it to work, maybe I'm still missing something. I'm using the following snippet:

void OnWeaponFired(BaseProjectile projectile, BasePlayer player, ItemModProjectile mod, ProtoBuf.ProjectileShoot projectiles)
{
if (projectile.GetItem().info.shortname != "rifle.l96") return;
Puts("Player has a sniper");
var a = player.svActiveItemID;
player.svActiveItemID = 0;
// reload here
projectile.ServerReload();
projectile.reloadTime = 0f;

player.svActiveItemID = a;
}
It actually reloads the weapon, but only if I click on another item in belt and back on the rifle. Also the reload animation is still present, but that depends on how fast I switch weapons.

Thx for help, best regards 
fisch111
replace:
// reload here​

with:
projectile.ServerReload();​​
I left the line comment there, but the 
projectile.ServerReload();​​​

is present in the snippet.

Maybe you must use Servers load after setting reloadTime? That seems to be logical
Hi, 
yes that seems logical, but should't the reloadTime be a one-time assignment to the instance of the object? Anyway, tried both options, but it still does the same. Actually the code just reloads the weapon magazine (it even takes no ammo from the inventory), but does not disable the animation of reloading. 
P.S. Wouldn't it be easier to take for example an AK, assign it a L96 model, gun properties, sound etc. instead of hacking the game mechanism of reloading? But I don't know how to do it...there is no documentation, only metadata and googling similar plugin didn't bring much luck to me. 
Upload L96 skin, use it for ak. That should work. 
Well, my progress - adding an ak with sniper skin ok, but only the icon changes, the actual weapon is just an ak. I'm also trying to do it with the L96 as before, which has some progress actually - when I remove the item from containerBelt edit the properties and put it back, I'm able to shoot without the animation, but the weapon remains hidden and I can't aim (also it shoots only the default 2 shots in magazine, but I guess, that could be edited easily - I hope).