Jump to content

Use an item to toggle a setpeice?

Recommended Posts

Hey, I've been learning a lot about modding, but there's something that I want to do, that I'm not sure is possible.  I've looked around, and I haven't been able to find someone who has asked about this.


Is it possible to spawn a setpiece next to the character, when the character uses a certain item?


For example, the character uses a "Insta-forest" item, and a 6x6 setpiece full of trees appears.


Any smart folks who might have an idea how to do this?



Link to comment
Share on other sites

Is there a way to remove a certain nearby prefab, so I can toggle the spawn on and off, to make portible items, like a science machine that you can spawn and despawn at the use of a item?

Thanks for the help!


Yes, you can assign a variable to a prefab when you're spawning it, and it's simple to remove a prefab.


inst.mything = SpawnPrefab("researchlab")



The only difficulty I can think of is the player quitting when the prefab is still existing. It'd probably suffice to force-undo it when quitting. (I had in mind setting "persists" to false, so it doesn't get saved, and the item would simply set itself to full when loading)

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

  • Create New...