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.

Lamp00 at 0 health doesn't get removed when calling IObject.Remove()

Did you encounter a problem, exploit, glitch or bug while playing the game or running the dedicated server software? Tell us about it here.
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

Lamp00 at 0 health doesn't get removed when calling IObject.Remove()

Post by NearHuscarl » Sun Feb 20, 2022 3:14 pm

When you damage the lamp (object name Lamp00), it can never be removed using ScriptAPI:

Code: Select all

foreach (var o in Game.GetObjects<IObject>().Where(o => o.Name == "Lamp00"))
{
    // If you comment this line, the code that runs in the next 5 seconds will work
    o.DealDamage(o.GetHealth());
}

// Run after 5 seconds
ScriptHelper.Timeout(() =>
{
    foreach (var o in Game.GetObjects<IObject>().Where(o => o.Name == "Lamp00"))
    {
        o.Remove();
    }
}, 5000);
Expected result: The lamp get removed regardless of its health
Last edited by NearHuscarl on Tue Feb 22, 2022 7:22 pm, edited 2 times in total.
1 x
Image

User avatar
Astolfo
Fighter
Fighter
Posts: 13
Joined: Tue Jan 21, 2020 9:00 pm
Started SFD: I forgot

Post by Astolfo » Tue Feb 22, 2022 6:18 pm

Broken lamps have the _D suffix, so if you want to remove a broken lamp, use Lamp00_D
0 x
Hello world

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

Post by NearHuscarl » Tue Feb 22, 2022 7:21 pm

Astolfo wrote:
Tue Feb 22, 2022 6:18 pm
Broken lamps have the _D suffix, so if you want to remove a broken lamp, use Lamp00_D
I want to remove the "Lamp00", The "Lamp00" has the same sprite as "Lamp00_D" after being shot. It's just impossible to remove it, I've tried IObject.Destroy() and IObject.Remove(). Nothing has worked so far. @Astolfo
0 x
Image

Post Reply