Page 1 of 1

Add IPlayer.CurrentThrownItem.IsActivated

Posted: Sun Mar 08, 2020 4:11 am
by NearHuscarl
Some throwable weapons can be activated before being thrown. IPlayer.CurrentThrownItem.IsActivated returns true when the throwable weapon the player is holding is activated (grenades, c4, molotov, mine). Returns false when not activated or when player is holding weapons that cannot be activated (shuriken).

Re: Add IPlayer.CurrentThrownItem.IsActivated

Posted: Mon Mar 23, 2020 4:10 am
by Danger Ross
You can keep track of that information through virtualkey inputs. that's what I do that in my current project.
Once IPlayer.IsThrowingMode is added you'll be able to filter throwing the item from activating it as well.
This addition isn't necessary.

Re: Add IPlayer.CurrentThrownItem.IsActivated

Posted: Mon Mar 23, 2020 6:56 am
by NearHuscarl
Currently the way I do is to check if the player presses the attack key while holding the throwable weapon, turn the flag on if they do, and then compare with the current throwable weapon items left to turn the flag off. It's not working with /ia 1 because the current ammo never changes

Also the reason why I have to compare the the current throwable wpn ammo instead of checking whether the player's released the attack key is because the player can hold the grenade until it explodes without releasing the attack key.

So there are 2 ways to solve the problem. You can either add IPlayer.CurrentThrownItem.IsActivated or/and expose the grenade cook time so I can turn off the flag when the grenade goes off

Re: Add IPlayer.CurrentThrownItem.IsActivated

Posted: Sat Apr 18, 2020 1:31 pm
by Gurt
Added after v.1.3.5:
ScriptAPI: Added IPlayer.IsHoldingActiveThrowable, IPlayer.GetActiveThrowableWeaponItem(), IPlayer.SetActiveThrowableTimer(..), IPlayer.DisarmActiveThrowable(..) to be able to read and disarm current active throwables on a player.
ScriptAPI: Updated IPlayer.Disarm(..), it will now disarm any active throwables first if you disarm Thrown weapon items. Included an optional 'out IObject disarmedActiveThrowable' parameter to be able to read the disarmed active throwable (if any) - this returns the same object as calling IPlayer.DisarmActiveThrowable() first. This is done to keep backwards compatibility with existing Disarm calls.
ScriptAPI: Added IObjectGrenadeThrown.GetExplosionTimer(), IObjectGrenadeThrown.SetExplosionTimer() to be able to change the explosion timer on thrown grenades (and reactivate them by calling SetExplosionTimer after the first timer runs out).