csbx Posted May 10 Posted May 10 (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 May 10 by csbx
csbx Posted May 10 Author Posted May 10 (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 May 10 by csbx
Qvorvm Posted May 10 Posted May 10 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.
csbx Posted May 12 Author Posted May 12 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 ?
csbx Posted May 14 Author Posted May 14 (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 May 14 by csbx
Recommended Posts