Tyrant99 Posted September 9, 2018 Posted September 9, 2018 So I was just starting off with a script. What I would like to do is have a repeatable quest start on a timer, the Quest will create an alias XMarker at the Player Alias. Then, after a few seconds, it will move the XMarker behind the Player, and a different Quest will start where a Creature Alias will get placed at the XMarker and the XMarker will refill a dif alias based on location conditions in the 2nd Quest. All of this I have no problem with. But, I would like to do a 'test' after the XMarker is moved because where it lands is based on distance from Player at random time intervals, making its positions somewhat random/arbitrary. I would like to check if the cell that the XMarker is placed on is clear / has valid Navmesh, or is viable for spawing a creature at that point. Is there a way to do this?
Guest Posted September 9, 2018 Posted September 9, 2018 No, you cannot check if an ObejctReference is on a valid NavMesh, sorry. Technically you don't need the marker at all. You can just spawn the creature where you want at the given time.
Tyrant99 Posted September 9, 2018 Author Posted September 9, 2018 What would be your preferred way to spawn in? PlaceAtMe with an offset? In this case, I was thinking XMarker Alias to create the creature because I wanted the creature in an alias so I could send it to a scene with an AI pack. Seemed like it might work ok. I wonder what kind of issues will crop up if the creature spawns in a strange location...
Guest Posted September 9, 2018 Posted September 9, 2018 Actor Property PlayerRef Auto ObjectReference spawned ActorBase Property theMonster Auto function spawn() float x = PlayerRef.X float y = PlayerRef.Y float z = PlayerRef.getAngleZ() if spawned spawned.Kill() spawned.Delete() endIf spawend = PlayerRef.PlaceAtMe(theMonster, X + 100 * Math.sin(Z + 180.0), Y + 100 * Math.cos(Z + 180.0), PlayerRef.Z, true) endFunction This will spawn an instance of ActorBase just behind the player. Increase 100 to something more if you prefer it to stay far away (100 is close enough but not in contact.)
yatol Posted September 9, 2018 Posted September 9, 2018 12 minutes ago, CPU said: Technically you don't need the marker at all. You can just spawn the creature where you want at the given time. he want to avoid the npc getting stuck in a rock or falling to its death if there's nothing in skyrim to search the closest navmesh, then check if there's a way to reach it SamplePosition Finds the closest point on NavMesh within specified range. why not check if you were able to walk or run there? bool notthere = false test wait(1) test wait(1) test if notthere == false your stuff endif function test if !player walking running sneaking notthere = true end if endfunction there's some topics about the forge that close after opening that's because you don't pass the check, because for the game you are still sitting or whatever so there's stuff to check that
Tyrant99 Posted September 9, 2018 Author Posted September 9, 2018 36 minutes ago, CPU said: This will spawn an instance of ActorBase just behind the player. Increase 100 to something more if you prefer it to stay far away (100 is close enough but not in contact.) Ok, thx. I had a similar script: At least I was starting to slap it together. SexLabFramework Property SexLab Auto ReferenceAlias Property XMarkerCreatureAlias Auto Actor Property PlayerRef Auto Quest Property SPPheromonesQuest Auto Function QuestTimer() RegisterForSingleUpdateGameTime(0.5) EndFunction Event OnUpdateGameTime() If !PlayerRef.IsInCombat() && !Sexlab.IsActorActive(PlayerRef) SPPheromonesQuest.SetStage(10) Utility.Wait(5.0) MoveXMarker() EndIf RegisterForSingleUpdateGameTime(0.5) EndEvent Function MoveXMarker() XMarkerCreatureAlias.GetReference().MoveTo(PlayerRef, -500.0 * Math.Sin(PlayerRef.GetAngleZ()), -500.0 * Math.Cos(PlayerRef.GetAngleZ())) EndFunction One thing is I thought that it was negative float that would be behind the player... Hmmm, will have to check it. 18 minutes ago, yatol said: he want to avoid the npc getting stuck in a rock or falling to its death if there's nothing in skyrim to search the closest navmesh, then check if there's a way to reach it SamplePosition Finds the closest point on NavMesh within specified range. why not check if you were able to walk or run there? This is a Unity function though. Unity seems to have some script options for dealing with Navmesh. Unfortunately Skyrim doesn't seem to be as robust in that department...
Guest Posted September 9, 2018 Posted September 9, 2018 26 minutes ago, Tyrant99 said: One thing is I thought that it was negative float that would be behind the player... Hmmm, will have to check it. Just trigonometry. If you use the same Z angle as the player, then you have to multiply to a negative number to put it back. Or you add 180 to the angle and use positive values. It is the same.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.