Jump to content

How to place custom model at user-specified location? (A question in two parts)


ultoleif

Recommended Posts

First off, for context: I'm considering trying to make a mod for digging out underground settlements, in arbitrary locations. Like, place a hatch on the surface (without building a settlement first); have it drop you into an interior cell with a workshop where you can build stuff. And dig to expand (which is 'simply' a matter of placing, replacing, and removing cavern tile objects.)

 

Anyway.

 

To this end, I want to be able to spawn a permanent(?) object where the player points (with weapon-fire, I suppose? But failing that, with whatever works. Could live with a grenade or mine explosion I suppose?). Perhaps most challengingly (based on the last time I tried something like this back in Skyrim years ago) the object should be capable of being a working door.

 

Regarding the last time I tried this: I seem to vaguely remember (possibly inaccurately) that in Skyrim, the way was to have a spell effect for a ranged spell, with a script attached, that then handled the actual spawning of the thing I wanted to place. Which worked... Though I could never make the model that I summoned solid (I had assumed this is because the nifs I was splicing models into, in nifskope, didn't have the right sort of dynamic geometry flags or something, but I never did know).

 

So my question is in two parts.

 

Question, Part One:

 

How do I get a script to fire, supplied with user-provided coordinates from a nice user-friendly interaction? (In Skyrim this was via a ranged spell, though I forget the exact methodology).

 

Question, Part Two:

 

What black magic do I need to spawn a custom model on the fly with working collision? Or a working door (this part doesn't have to be a custom model, I guess, for what little that's worth)?

Edited by ultoleif
Link to comment
Share on other sites

On the theory that answering one's own question is good in case anyone comes across it later:

 

The first part I've figured out by looking at the flare gun:

  1. A gun or ammo can have a projectile-type
  2. which can have an explosion
  3. which in turn can have a placed object
  4. which can have a script (that fires an OnInit event and gets its own position data)
  5. (which I intend to pass to a quest to spawn and manage the relevant objects).
Link to comment
Share on other sites

Rather than spawning the door you would need to move it from somewhere else. Create a new cell and put the doors there, configure them to their respective interiors and add them as properties in the quest script. Then you just need to move them to the position of the projectile.

Link to comment
Share on other sites

I want to be able to spawn an indefinitely large number of doors programatically, so, moving existing doors is undesirable.

 

For the moment I've gotten around the requirement for pre-existing doors (I think ?) by just having the "door" be an activator that moveto()'s the player to the appropriate location. Which seems to work, so far, at least as tested on pre-existing worldspaces. (This obviously might have consequences, e.g. for companion pathing, but I'm not concerned with that yet.)

 

Currently now trying to figure out why, in my custom worldspace, the items I've PlaceAtMe()'d don't load in whichever cell of the space that I've MoveTo()'d—though they will load just fine in the cells adjacent to whichever I move to. Is it a problem with how the worldspace is set up, where these cells don't actually exist because they're way off in the corner of the map and I haven't defined anything for them...?

Edited by ultoleif
Link to comment
Share on other sites

Ugh... indeed, it looks it works fine for cells that I have... Edited the terrain on?

 

Which would be fine and dandy if I didn't want a commonwealth-sized worldspace... XD Maybe I can import a big fat blank .dds or something. (I don't even really want terrain for this, though! ;-; This is so wrong...)

 

EDIT: Big black .dds terrain-heightmap seems to have done it. Was even able to leave the imported terrain disabled so it didn't do anything unnecessary—like, well, render.

Edited by ultoleif
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...