Imrinfected Posted April 7, 2010 Share Posted April 7, 2010 I thought it would be simple. The concept is. I'm trying to write a script that moves an object to where the crosshair is pointed. I tried doing a hundred different things with getangle and float variables, but evidently I'm bad at math. if anyone has access to a script that has done this, could you post the section handling what I just described? It would save me a lot of time and frustration. Link to comment Share on other sites More sharing options...
angelwraith Posted April 7, 2010 Share Posted April 7, 2010 I thought it would be simple. The concept is. I'm trying to write a script that moves an object to where the crosshair is pointed. I tried doing a hundred different things with getangle and float variables, but evidently I'm bad at math. if anyone has access to a script that has done this, could you post the section handling what I just described? It would save me a lot of time and frustration. Ground area mark that follows the crosshair You can see the effect of this script in this video Script Type: Quest or Effect For a Quest script, use a GameMode block. For an Effect script, use a ScriptEffectUpdate block.Instead of activator put the name of the activator or actor you want to use, in order to use the EditorRefID of your reference in a script like this, it must be a persistent reference. float xang float zang float x float y float z float playerheight float lont begin gamemode set xang to player.getangle x set zang to player.getangle z * -1 + 90 if xang <= 5 set lont to 1300; you can change this value if you need to else if player.issneaking == 0 set playerheight to 322 else set playerheight to 252 endif set lont to (playerheight*cos xang/sin xang * 0.34118010537042257764) endif set xang to player.getangle x * -1 set x to lont * cos xang * cos zang set y to lont * cos xang * sin zang Activator.moveto player x y 0 end from http://geck.bethsoft.com/index.php/Useful_Scripts i think it should help get you close Link to comment Share on other sites More sharing options...
documn Posted April 7, 2010 Share Posted April 7, 2010 I have that kind of script in this mod: Doc full autoI can't take credit for all the math though. I used this "summon object" script as a base. Link to comment Share on other sites More sharing options...
Imrinfected Posted April 8, 2010 Author Share Posted April 8, 2010 I have that kind of script in this mod: Doc full autoI can't take credit for all the math though. I used this "summon object" script as a base.Thanks again, that did the trick. You're a very helpful person. Link to comment Share on other sites More sharing options...
Recommended Posts