Jump to content

script that moves an object to crosshair


Imrinfected

Recommended Posts

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

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

  • Recently Browsing   0 members

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