Raising/lowering Weapon from outside Player

From The DarkMod Wiki
Jump to navigationJump to search

Originally written by Ishtvan on http://forums.thedarkmod.com/topic/2870

Apparently it's not enough to call idPlayer::RaiseWeapon or LowerWeapon all the time (although Lloyd's grabber code just calls RaiseWeapon and it works, so I'm not sure what the circumstances are.) Anyway, to get it to work, I had to add the following line after LowerWeapon. It's changing a public bool in idPlayer. Otherwise the weapon was not lowered in my case.

idPlayer *self;
// (assign self to the player)

// lower weapon
self->LowerWeapon();
// ADDITIONAL LINE REQUIRED:
self->hiddenWeapon = true;