andhegames Posted April 9, 2015 Share Posted April 9, 2015 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? Thanks! Link to comment Share on other sites More sharing options...
Mobbstar Posted April 9, 2015 Share Posted April 9, 2015 You can spawn trees that way, but not a setpiece. EDIT: More precisely, you can repeatedly use the method SpawnPrefab("evergreen") and set every trees position slightly elsewhere. Link to comment Share on other sites More sharing options...
andhegames Posted April 9, 2015 Author Share Posted April 9, 2015 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! Link to comment Share on other sites More sharing options...
Mobbstar Posted April 9, 2015 Share Posted April 9, 2015 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")inst.mything:Remove() 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 More sharing options...
Recommended Posts
Archived
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.