Spawn script for placeables in order to progress story

So I thought I’d like to add some progression to a story. So here’s the idea, a companion/henchman decides to quit adventuring and lay down roots. When the party reaches a transition point, he states he wants to quit and live in the village. Now, respawning him is no issue . . . set a few global ints for conversations (so that he won’t be joining anymore), spawn him to a new waypoint and boom . . . he’s now part of the scenery. BUT, what if he started working in the village and was building his own house over time, and we wanted to see that happening. How do you spawn in placeables in this case?

You can spawn placeables with CreateObject, the progression of the building could be done like in Crossroad Keep that happens when you transition from area.

If you want to do it live, like the player watching the NPC, maybe it could be done with DelayCommands.

1 Like

I haven’t played the OC in a very long time. Are there changes happening in CK in areas you have already visited? For example the inn. Is it possible to enter when it’s not in use? Because this raises a question for me, how to deal with the walkmesh.

Of course it is possible to spawn placeables but I doubt it would work well for full scale area. I have used it occasionally to spawn small things that didn’t matter to the walkmesh.

I went into the scripts of CK and pulled this section

void CreatePlaceableAtTag(string sResRef, string sTag)
		object oObj = GetObjectByTag(sTag);
   		location lLocation = GetLocation(oObj);
		CreateObject(OBJECT_TYPE_PLACEABLE, sResRef, lLocation);

void CreatePlaceablesAtAllTags(string sResRef, string sTag)
	int i = 0;
	object oObject = GetObjectByTag(sTag, i);

	while (GetIsObjectValid(oObject))
		CreateObject(OBJECT_TYPE_PLACEABLE, sResRef, GetLocation(oObject));
		//CreatePlaceableAtTag(sResRef, sTag);
		oObject = GetObjectByTag(sTag, i);
	PrettyDebug("CreatePlaceablesAtAllTags: Things created" + IntToString(i));

// create sResRef at all sTag's and destroy all sDebris 
void DoBuild(string sResRef, string sTag, string sDebris = "")
	CreatePlaceablesAtAllTags(sResRef, sTag); 

	if (sDebris != "")

You won’t need all of it but it is basically how they do it. I am still curious about the walkmesh though :slight_smile:

1 Like

possibly by baking full-ish walkmesh and using dynamic collision on the placeables ?

1 Like

Thanks. I’ll try the CreateObject script. The baking should not be a problem since I plan on placing the new house on the ruins of an old house (after destroying the ruins first of course). :grinning:

1 Like