Dear forum users! In compliance with the new European GDPR regulations, we'd just like to inform you that if you have an account, your email address is stored in our database. We do not share your information with third parties, and your email address and password are encrypted for security reasons.

New to the forum? Say hello in this topic! Also make sure to read the rules.

Add IPlayer.CurrentThrownItem.IsActivated

Here you can find ScriptAPI suggestions implemented in the game.
Forum rules
By using the forum you agree to the following rules.
Locked
NearHuscarl
Superfighter
Superfighter
Posts: 97
Joined: Thu Feb 07, 2019 4:36 am

Add IPlayer.CurrentThrownItem.IsActivated

Post by NearHuscarl » Sun Mar 08, 2020 4:11 am

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).
0 x
Image

User avatar
Danger Ross
Superfighter
Superfighter
Posts: 154
Joined: Thu Mar 31, 2016 12:56 am
Title: Dangerous
SFD Alias: Danger Ross
Started SFD: 14 june 2012 (launch day)
Location: California
Gender:
Age: 23

Post by Danger Ross » Mon Mar 23, 2020 4:10 am

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.
0 x
sorry bucko, you can't punch with swords 8-)

NearHuscarl
Superfighter
Superfighter
Posts: 97
Joined: Thu Feb 07, 2019 4:36 am

Post by NearHuscarl » Mon Mar 23, 2020 6:56 am

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
0 x
Image

User avatar
Gurt
Lead Programmer
Lead Programmer
Posts: 1884
Joined: Sun Feb 28, 2016 3:22 pm
Title: Lead programmer
Started SFD: Made it!
Location: Sweden
Gender:
Age: 34

Post by Gurt » Sat Apr 18, 2020 1:31 pm

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).
2 x
Gurt

Locked