Aller au contenu

Photo

Removing placeable objects


  • Veuillez vous connecter pour répondre
3 réponses à ce sujet

#1
Quildra

Quildra
  • Members
  • 45 messages
Hi all,
I'm trying to make a mod where a player is able to summon a storage chest.

I have the thing spawning in a variable location but i cant seem to get it to de-spawn.

calling Safe_Destroy_Object on the object just seems to make it not interactable as opposed to removing it.
I have seen this done in-game with characters but im not sure if this would extend to placeables 
does anyone know how to do this? 

#2
Adinos

Adinos
  • Members
  • 341 messages
does it have to be removed, or would it be enough to make it invisible?

#3
Quildra

Quildra
  • Members
  • 45 messages
 It should probably be removed as if i just made it invisible summoning it again would spawn yet another object so I'd end up with potentially hundreds of invisible chests about the place.

And the docs say to avoid using createobject
"
Note that dynamic creation of objects in the engine is subject to a host of limitations, reason being attempts to cut down 'unaccounted' memory usage.
Avoid using CreateObject whenever possible.
"

although I suppose I could make it invisible and when it is summoned again move it to its new position and make it visible again. so that may be an option if there is no way to remove the object. 

#4
Quildra

Quildra
  • Members
  • 45 messages
Looking at this in a bit more detail I think I can treat it like a character.

So I would have to create a pool of 2 chest objects (Docs say to have the pool size double the max number to appear ) when an area loads.

When the chest is spawned via the createObject method the object will should come from the pool.

then when its dismissed I can call SetObjectActive() on the chest which should "despawn" it and return it to the pool.

I'll post later when I have results from this method.