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.

IObjectWeaponItem does not disappear after a while

All reported bugs that's actually by design.
Forum rules
By using the forum you agree to the following rules. For this forum you also need to follow these additional rules.
Post Reply
NearHuscarl
Superfighter
Superfighter
Posts: 97
Joined: Thu Feb 07, 2019 4:36 am

IObjectWeaponItem does not disappear after a while

Post by NearHuscarl » Thu Mar 12, 2020 12:32 pm

Weapons laying around the map (IObjectWeaponItem in script) does not disappear after a while like normal weapons spawn from crates when:
- Created by IGame.CreateObject(). Example:

Code: Select all

Game.CreateObject("WpnMP50", Vector2.Zero);
- Created by drag'n'drop tile Wpn__ in the Map Editor
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 » Sun Mar 15, 2020 1:21 pm

Items created from scripts or placed in the editor will never despawn automatically.
Items dropped from players will despawn after a while.

This is by design.
0 x
Gurt

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

Post by NearHuscarl » Sun Mar 15, 2020 2:31 pm

It would be cool to have an option to despawn weapons in certain circumstances. Something like IPlayer.GiveWeaponItem(WeaponItem weapon, bool canDespawn = false)
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 Mar 21, 2020 4:06 pm

Added the following after v.1.3.4 to IObjectWeaponItem:
float DespawnTime, void SetDespawnTime(int despawnTimeMs), bool Despawning, bool BreakOnDrop, void SetBreakOnDrop(bool value) to be able to control in a bit more detail how and when items in the world should despawn. See ScriptAPI documentation for more details after v.1.3.4.
1 x
Gurt

Post Reply