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.

IPlayer.Disarm() doesn't spawn WpnGrenadesThrown when activated

Here you can find all solved gameplay problems and bugs (beginning from Pre-Alpha 1.8.8).
Forum rules
By using the forum you agree to the following rules. For this forum you also need to follow these additional rules.
Locked
NearHuscarl
Superfighter
Superfighter
Posts: 97
Joined: Thu Feb 07, 2019 4:36 am

IPlayer.Disarm() doesn't spawn WpnGrenadesThrown when activated

Post by NearHuscarl » Tue Mar 24, 2020 12:45 pm

When you disarm a player in melee while cooking grenade, the game will spawn a WpnGrenadesThrown instead of WpnGrenade. IPlayer.Disarm() always spawns WpnGrenade regardless if the grenade is activated or not.
1 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 » Tue Mar 24, 2020 9:11 pm

The Disarm() function was intended to drop your equipped item. I didn't think about when you have a throwable ready to be thrown you know, like a cooked grenade :)

I think I will adress this issue in some way in the next SFD update together with viewtopic.php?f=31&t=3963 and viewtopic.php?f=31&t=3985

Most likely the Disarm will then make you drop your current activated throwable only. If you call it again the entire throwable stack of things will drop from your inventory like now :)

Edit - added the following 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 reactive them by calling SetExplosionTimer after the first timer runs out).
1 x
Gurt

Locked