Destroying object spawns different object in same spot

I’m creating a module and I want, when the player destroys a tree, for a campfire that the player can interact with via conversation to spawn in the same spot, I am awful at scripting and the internet doesn’t seem to have anything on this subject, if anyone could help, that would be fantastic

EDIT: This is as far as I’ve managed to get using what I could find on the internet

void main()
    location spawn1 = GetLocation (GetWaypointByTag ("campfirewaypoint"));
    CreateObject (OBJECT_TYPE_PLACEABLE, "Campfirethatcooksfish", spawn1);

This is on the tree’s death script slot, the waypoint is placed a stone’s throw from it and the campfirethatcooksfish template is in the custom palette, still no results, what am I doing wrong?

EDIT EDIT: Also, I have double and triple checked all the tags are identical to what they’re supposed to be linking to

CreateObject takes the resref, not the tag, as the second parameter.

“Campfirethatcooksfish” is too long for a resref, which will also be lower case.

1 Like

Thank you very much, it was beginning to drive me a bit mad this one