Jump to content

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?

 

Thanks!

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)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...