Jump to content

Is there a way to detect "ground height" when spawning actors?


Recommended Posts

Hey all! So, here's the basic outline.

 

Spell / magic effect is on the player. When the conditions are right (time of day, whatever) small waves of enemies (2 or 3 at a time) will spawn at a distance around the player every x seconds (or as they are killed) while the player moves around the worldspace, so this 'spawn cloud' follows them.

 

The rudimentary portions of this are fairly straight-forward and functional, but there are some hitches that I can't figure out how to resolve, namely that static spawn points are not placed anywhere in the world for this purpose, so figuring out the xyz of where to place the spawned enemy in relation to player could result in spawning them half inside a tree, or under a hill. Is this a 'showstopper' that is unavoidable? Or are there any sophisticated methods to determine the height of the landscape to place an enemy (or other methods?)

 

One thought was that I could make a singular spawner in each worldspace cell (lord help me), make them all appear there with a travel package to the player, so they appear a little more spread out / random.

 

Thoughts? Thank you in advance!

Link to comment
Share on other sites

Not sure that may help but what you're trying to do reminds me of the way Mitchalek spawns horses around the player or followers - I've never seen any spawn in a mountain slab or a tree even when spawning at some distance from the player when called by the whistle. Perhaps, you could take a look at his scripts? (I think he does include sources in his bsa).

Link to comment
Share on other sites

Lol, I just realized I had not even mentioned Convenient Horses in my answer!... Really late... :facepalm:

 

I knew what you meant :)

 

I went through the code and it doesn't quite have what I need, though still helpful. There are two scenarios where calling horses happens:

  1. The whistle, which applies a travel package to the horse ref wherever you left it standing, so it actually travels to you along the road/path, thus, no need for placement or calculations.
  2. The horn blowing "summon" effect, which makes the horse appear/fade-in very close to the player, and thus also does not require much calculation except a 90 deg angle and a few feet from the player.

So, I still need something between the two. There are A LOT of cells in the outer world, so placing spawn points in each cell would be nightmarish. I wish there was a height coordinates function when you feed in an x/y position. It would be so useful for so many things!

Link to comment
Share on other sites

Maybe this helps:

 

1. Search for some random spawnpoints

ObjectReference ref = Game.FindRandomReferenceOfTypeFromRef(Form arBaseObject, ObjectReference arCenter, float afRadius)

2. Spawn your enemies

Actor actorref = ref.PlaceActorAtMe(ActorBase akActorToPlace, int aiLevelMod = 4,EncounterZone akZone = None) 

3. Move the spawned enemies to nearest navmeshed area

actorref.MoveToNearestNavmeshLocation()
Edited by DarthWayne
Link to comment
Share on other sites

 

Maybe this helps:

 

1. Search for some random spawnpoints

ObjectReference ref = Game.FindRandomReferenceOfTypeFromRef(Form arBaseObject, ObjectReference arCenter, float afRadius)

2. Spawn your enemies

Actor actorref = ref.PlaceActorAtMe(ActorBase akActorToPlace, int aiLevelMod = 4,EncounterZone akZone = None) 

3. Move the spawned enemies to nearest navmeshed area

actorref.MoveToNearestNavmeshLocation()

MoveToNearestNavmeshLocation() ???

 

Never heard of it, not listed in any of my source scripts or on CK wiki or SKSE that I can find.

A google search got one hit and it was for word function definitions in UltraEdit.

Maybe you could post a link to where you got that function from or it's use?

Link to comment
Share on other sites

  • Recently Browsing   0 members

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