I am trying to make a mod with the creation kit that can allow you to set up fire camps by "equipping" firewood. (Actually I am french but I guess this object is called Firewood in the english game as I noticed it in the creation kit. But that's not really important though.)
The thing is that I can't figure out how to spawn a new object dynamically in the game ! I mean, I need to have the firecamp already set in the game somewhere, and then place it at the player when he equips the Firewood, but that doesn't allow me to set several firecamps as I need to have all of them already preset in the game. If the player wants to set 10 fires, it will move the same fire over and over so that there is only one firecamp at a time... I could preset 10 of them but you see there is a problem because the player could want to set 11 of them... That's why dynamical allocation is made in programming, when we don't already know wat the user's going to do. But it doesn't seem to be a Papyrus feature, for all I know.
But maybe I'm wrong, and that's why I am asking you.
Is there a way to spawn an object with a function like :
"FireCampRef = createObject(Campfire01Burning)
FireCampRef.placeAt(Player.GetRef())" ?
I wonder how it could be impossible as you can spawn whatever you want with the console command "placeatme". I know it's not really spawning, it's a duplication of an already existing object. But that would be fine as well ! I would need only one firecamp that I could duplicate as the player wants a new one. Maybe we could access console commands from Papyrus ? I don't know.
And maybe I try do to it the wrong way, so maybe you could tell me how you would do the following feature :
As a simple example, how would you make a stone that spawns bread on the floor everytime you activate it ? If I active the stone x times, there would be x pieces of bread on the floor.
Please help me, that's the only thing I need to know to do every mods I planned to make.
