Jump to content

[LE] Quick Questions, Quick Answers


Recommended Posts

The most compatible way of handling leveled lists is to edit them directly not add things via script. We learned that the hard way back in the Morrowind days when Bethesda first created the functions to manipulate leveled lists.

 

Editing leveled lists via script is a huge problem if any mod (or the game itself) ever calls Revert on a list. Any items added by AddForm will be removed and there are no functions that let you check if a particular item is already in a leveled list so you have no way to know if some other mod has removed your item. You can actually add the same item more than once, so if you're not careful the list could end up with multiple copies of your item in the list too. It's also almost impossible for people to detect potential problems with their leveled lists if entries are being added during the running game.

 

Just edit the leveled list directly and skip the fancy scripting.

 

You can actually pull items out of a leveled list with SKSE these days, with GetNthForm, GetNthCount, and GetNthLevel. I've abused these to get around levelled lists only allowing 255 distinct forms.

Link to comment
Share on other sites

Yes, but that then requires SKSE which some people don't want to use. And even then, you have to decide when to check to make sure the leveled list looks like you want it to since a Revert could be called at any time. Basically, modifying your own leveled lists is fine, but trying to add things to the game's original lists has all sorts of potential compatibility pitfalls even with the SKSE functions.

Link to comment
Share on other sites

  • 2 weeks later...

How do you make life detect work through walls? I want to use only one magic effect that detects life indiscriminately. I removed the IsInterior condition and didn't use IsHostileTo condtion. I don't think I altered much else outside of how it looks.

 

Edit:I could have sworn I checked the Ignore Area Effect LOS under spells.

 

New question. What's the condition to check if an actor is currently a follower? I found IsInFriendStateWithPlayer, not sure what else that'll cover.

Edited by Elias555
Link to comment
Share on other sites

Is anyone good at math scripts?

 

I'm having an actor approach the player via a TranslateTo script, but I'm not sure what to put in the Z rotation to make sure they're facing the player as they're coming towards them. I read online that I can calculate it based on their (x,y) positions and finding the tangents, but I haven't done any trigonometry since middle school. This is my best attempt based on random math forums, but there's at least one quadrant off.

 

 

 

Float Function MathStuff(Actor akActor)

Float Answer
Float X = (PlayerRef.GetPositionX() - akActor.GetPositionX())
Float Y = (PlayerRef.GetPositionY() - akActor.GetPositionY())

If (X > 0)
Answer = math.atan(Y/X)
ElseIf (X < 0) && (Y >= 0)
Answer = math.atan(Y/X) + 3.141592654
ElseIf (X < 0) && (Y < 0)
Answer = math.atan(Y/X) - 3.141592654
ElseIf (X == 0) && (Y > 0)
Answer = 3.141592654/2
ElseIf (X == 0) && (Y < 0)
Answer = 3.141592654/2 * -1
Else
Answer = 0
EndIf

Return Answer

EndFunction

 

 

Link to comment
Share on other sites

 

New question. What's the condition to check if an actor is currently a follower? I found IsInFriendStateWithPlayer, not sure what else that'll cover.

Use GetFactionRank(CurrentFollowerFaction) == 1 (or it might be 0, I'm not sure).

 

Thanks!

 

 

Is anyone good at math scripts?

 

I'm having an actor approach the player via a TranslateTo script, but I'm not sure what to put in the Z rotation to make sure they're facing the player as they're coming towards them. I read online that I can calculate it based on their (x,y) positions and finding the tangents, but I haven't done any trigonometry since middle school. This is my best attempt based on random math forums, but there's at least one quadrant off.

 

 

 

Float Function MathStuff(Actor akActor)

 

Float Answer

Float X = (PlayerRef.GetPositionX() - akActor.GetPositionX())

Float Y = (PlayerRef.GetPositionY() - akActor.GetPositionY())

 

If (X > 0)

Answer = math.atan(Y/X)

ElseIf (X < 0) && (Y >= 0)

Answer = math.atan(Y/X) + 3.141592654

ElseIf (X < 0) && (Y < 0)

Answer = math.atan(Y/X) - 3.141592654

ElseIf (X == 0) && (Y > 0)

Answer = 3.141592654/2

ElseIf (X == 0) && (Y < 0)

Answer = 3.141592654/2 * -1

Else

Answer = 0

EndIf

 

Return Answer

 

EndFunction

 

 

Check this topic: https://forums.nexusmods.com/index.php?/topic/5422690-move-actor-to-location/

Link to comment
Share on other sites

 

Thanks, but that's a little different. It's not necessarily going to take place directly in front of the player, at least when the script first fires. So, if they were facing the opposite direction and then turned around, the actor would be flying backwards.

 

I need a method to make Actor A face Actor B, regardless of any other factors besides where they are in relation to each other.

 

 

Also, It's == 1, and I would also suggest IsPlayerTeammate() == True.

Link to comment
Share on other sites

 

I need a method to make Actor A face Actor B, regardless of any other factors besides where they are in relation to each other.

 

https://www.creationkit.com/index.php?title=GetHeadingAngle_-_ObjectReference

 

If you rotate each actor by their heading angle to the other actor then I think they will be facing each other.

Edited by FrankFamily
Link to comment
Share on other sites

 

The most compatible way of handling leveled lists is to edit them directly not add things via script. We learned that the hard way back in the Morrowind days when Bethesda first created the functions to manipulate leveled lists.

 

Editing leveled lists via script is a huge problem if any mod (or the game itself) ever calls Revert on a list. Any items added by AddForm will be removed and there are no functions that let you check if a particular item is already in a leveled list so you have no way to know if some other mod has removed your item. You can actually add the same item more than once, so if you're not careful the list could end up with multiple copies of your item in the list too. It's also almost impossible for people to detect potential problems with their leveled lists if entries are being added during the running game.

 

Just edit the leveled list directly and skip the fancy scripting.

 

You can actually pull items out of a leveled list with SKSE these days, with GetNthForm, GetNthCount, and GetNthLevel. I've abused these to get around levelled lists only allowing 255 distinct forms.

I've fiddle a little with the levelled lists so take it for what it is, but why make it harder than it is and I don't understand the reason why would anyone do that.

 

TBH, I am glad I don't have to use a script every time I want to edit the levelled list(s) and if I had to do then I would probably never touch the levelled lists.

Link to comment
Share on other sites

I'm having a bit of a problem with adding some new items to an existing merchant (Elgrim's Elixirs). Here's what I've done:

 

Made a new merchant container, next to the merchant's existing container.

Created a faction that is linked to the new container.

Added the merchants to that faction (Elgrim & his wife).

Added a few test items to the container.

 

The problem:

It sort of works. When I tested it in-game, Elgrim had the new items for sale! Unfortunately, he did not have any of his "vanilla" items for sale. And his wife only had the "vanilla" items for sale, but none of my test items. I tried waiting for multiple days, but nothing changed. So it seems like each merchant can only be linked to a single chest? That doesn't seem right to me, since all the tutorials for adding new items for merchants say to make a new chest and say nothing about conflicts of multiple containers. Am I missing something simple here?

Link to comment
Share on other sites

  • Recently Browsing   0 members

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