Jump to content

Need help, button that moves object.


Recommended Posts

Well, the short and skinny was that if workshopnewloc.GetDistance(XNarker) is less than x units (one unit being 0.55 inches, for reasons only the gods at Bethesda know), then it's already there and there's no need to move it. You try a bit to see what kind of distances you get, e.g., by printing each GetDistance with Debug.Notification, tune your minimum distance accordingly, and voila, no keywords needed. Just is it far enough to be worth moving, or is it already there so quit pressing the button already.

 

If you want to keep using keywords, though, I'd use a different keyword for each button -- which it sounds like you already do -- AND a list of all keywords that are used by buttons in that location. Every time you set the keyword for button X, you first delete all the other keywords. So if you move it to X, then to Y, only the last keyword remains set. So when you press button X again, it no longer finds its own keyword on it, because the move to Y deleted it and replaced it with the keyword for Y.

 

But all things considered I'd forget about keywords at this point and just use GetDistance to the marker..

Link to comment
Share on other sites

Well, the short and skinny was that if workshopnewloc.GetDistance(XNarker) is less than x units (one unit being 0.55 inches, for reasons only the gods at Bethesda know), then it's already there and there's no need to move it. You try a bit to see what kind of distances you get, e.g., by printing each GetDistance with Debug.Notification, tune your minimum distance accordingly, and voila, no keywords needed. Just is it far enough to be worth moving, or is it already there so quit pressing the button already.

 

If you want to keep using keywords, though, I'd use a different keyword for each button -- which it sounds like you already do -- AND a list of all keywords that are used by buttons in that location. Every time you set the keyword for button X, you first delete all the other keywords. So if you move it to X, then to Y, only the last keyword remains set. So when you press button X again, it no longer finds its own keyword on it, because the move to Y deleted it and replaced it with the keyword for Y.

 

But all things considered I'd forget about keywords at this point and just use GetDistance to the marker..

I don't know exactly how (getdistance) but if it's simple if you can make the script for me i would try it one more time and than ill give up :confused:

Edited by H3S
Link to comment
Share on other sites

Just replace your "if" line with

 

if workshopnewloc.GetDistance(XNarker) < 16

 

... and forget about the keywaords, really. It's really that simple. In human terms, it's literally as trivial as "If the distance to move the workshop is too small, then don't".

 

According to Bethesda a unit is 0.5625" or 0.046875 ft or 1.428 cm. (Exactly why they use that instead of just cm or inches, is one of those theological questions;)) So 16 units is 9 inches or slightly under 23 cm.

 

Cf https://www.creationkit.com/index.php?title=Unit

 

You may need to tweak that based on practical testing, but as a starting point, 16 units seemed like as good a margin of error as any.

Link to comment
Share on other sites

Just replace your "if" line with

 

if workshopnewloc.GetDistance(XNarker) < 16

 

... and forget about the keywaords, really. It's really that simple. In human terms, it's literally as trivial as "If the distance to move the workshop is too small, then don't".

 

According to Bethesda a unit is 0.5625" or 0.046875 ft or 1.428 cm. (Exactly why they use that instead of just cm or inches, is one of those theological questions;)) So 16 units is 9 inches or slightly under 23 cm.

 

Cf https://www.creationkit.com/index.php?title=Unit

 

You may need to tweak that based on practical testing, but as a starting point, 16 units seemed like as good a margin of error as any.

WoW :ohmy: it's working 100% exactly how i wanted to be. You where right as simple as that :smile: .

No more unnecessary Keywords only one line shorter, cleaner and it works thanks to you .

I almost wanted to give up so i really appreciated that you didn't give up and helped me reach my goal :thumbsup: .

:dance: -------{{{ HAVE A NICE DAY }}}------- :dance:

Edited by H3S
Link to comment
Share on other sites

  • Recently Browsing   0 members

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