Jump to content

Recommended Posts

Posted (edited)

I'm playing with a dynamic spawning system (ie. obviously no actors / xmarkers added in the ck) but curious what people do for checking 'reasonableness' of a given random spawn location and positioning for a creature prior to their being spawned. This question obviously applies to most spawn actors, but especially to ash spawns whose ambush (from the ground) variant should really only be spawning from suitable material. My guess is that this just requires hand-placement in the ck, but I was curious if there was a check one could perform on the fly. Thanks !

Also--is it even possible to set up the ambush via script ? I've never dealt with scripting linked ref stuff.

Edited by csbx
Posted (edited)

Here's what I have, but it's not working--no actor appears in-game. Is the problem that I really need to handle this via an actor-furniture (underground start) linkage in a cell and then make a copy of that to spawn ? I do have the masterambush script on my base actor.

Function SpawnAmbushAshSpawn(ActorBase akBase)

    float fDistance = Utility.RandomFloat(300.0, 500.0)
    float angle = Utility.RandomFloat(0.0, 360.0)

    float xOffset = fDistance * Math.Cos(angle)
    float yOffset = fDistance * Math.Sin(angle)

    ObjectReference ambushFurniture = PlayerRef.PlaceAtMe(DLC1GroundAmbush01, 1, true, true)
    
    if ambushFurniture
        ambushFurniture.MoveTo(PlayerRef, xOffset, yOffset, 0.0)
        ambushFurniture.SetAngle(0.0, 0.0, Utility.RandomFloat(0.0, 360.0))


        ObjectReference ashSpawn = ambushFurniture.PlaceAtMe(akBase, 1, true, true)
        if ashSpawn

            PO3_SKSEFunctions.SetLinkedRef(ashSpawn, ambushFurniture, None)

            Utility.Wait(0.1)

            ashSpawn.Activate(PlayerRef)
        endif
    endif


EndFunction

 

Edited by csbx
Posted

Furniture object can't be moved with MoveTo.  This applies to various other object types as well.

You should place a xmarkerheading object first, move it around, then test you have line-of-sight (to avoid spawning your ambush inside a rock), then place your ambush directly in its final position.

I also recommend you add more debugging info in these situations so you can confirm which parts of the script work and which don't.

Posted

If furniture objects can't be moved, perhaps getting a dynamic ambush (in this case crawling from under ground) spawn isn't possible ?? Perhaps it just has to be placed in the world which wouldn't work for my mod.

Thanks for recommendations re: xmarkerheading and line of sight. That is the process I use for normal spawns in my mod, but I've done zero checking for placement appropriateness.

Do you know of a good example script that does some of this ?

Posted (edited)

This is my starting point for the water check. I'm sure there's a better way to do this. Mine is pretty rudimentary--I'm not re-checking, just rotating the spawnpoint if in water by 90 degrees.
 

    ObjectReference tempMarker = CurrentTent.PlaceAtMe(XMarkercsb, abInitiallyDisabled = true)
    tempMarker.MoveTo(CurrentTent, offsetX, offsetY, -100)
    tempMarker.Enable()

    bool isInWater = PO3_SKSEFunctions.isrefInWater(tempmarker)

    if isInWater
        worldAngleDeg += 90.0
        if worldAngleDeg >= 360.0
            worldAngleDeg -= 360.0
        endif
        offsetX = fDistance * Math.cos(worldAngleDeg)
        offsetY = fDistance * Math.sin(worldAngleDeg)
        tempMarker.MoveTo(CurrentTent, offsetX, offsetY, 0.0)
        SayIt("we moved it 90 degress cuz spawn was in water")

    endif

 

Edited by csbx
  • Recently Browsing   0 members

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