Jump to content

Possible to get the XYZ coords of the cursors location?


Rizalgar

Recommended Posts

For yet another spell I'm making, I will need the coordinates of the cursor. If this is not possible, then I need to know how to spawn an object in front of the caster, a certain distance away, directly in front (not following a specific plane)

 

Any help would be appreciated.

Link to comment
Share on other sites

placeatme. :) Script command. Just have the spell run the script, and place whatever object in front of the PC. Don't recall if it lets you specify a distance, and I suspect, if something else is occupy the space it wants to fill, it will be displaced 'elsewhere'......

Link to comment
Share on other sites

The common way to do that is usually with MoveTo:

Actor player = Game.GetPlayer()
ObjectReference createdRef = player.PlaceAtMe(refToSpawn)
createdRef.MoveTo(player, 120.0 * Math.Sin(player.GetAngleZ()), 120.0 * Math.Cos(player.GetAngleZ()), player.GetHeight() - 35.0)

It's just an example showing the math involved. You'll need to tweak it to suit your needs.

Edited by Rasikko
Link to comment
Share on other sites

Thanks again, Rasikko.

 

 

Since Google failed me, I will now explain and give example scripts on how to make a Blink type teleport spell. Here goes.

 

 

Create a new script, i.e. BlinkMain

It will need to look similar to this.

 

 

Actor Property PlayerRef Auto

Event OnEffectStart(actor target, actor caster)

    ;insert whatever you want here if you want it to do something extra

EndEvent

 

 

 

Create a second script, i.e. BlinkActivator.

The script should look similar to this.

 

 

Actor Property PlayerRef Auto

Event OnLoad()

  PlayerRef.TranslateToRef(Self, 20000.0)
  Utility.Wait(2.0) ;to make sure the player has actually arrived
  Self.Disable()
  Self.Delete()

EndEvent

 

 

 

Third step is to make an Explosion. There's only two things to worry about here, Radius and Placed Object. Myself, I just created an empty Nif activator to use as the placed object, but you can use whatever the drop down box allows or make your own.

 

Fourth step is to make a projectile. I just duplicated the Mage Light projectile. Make sure the Explosion is set to your newly created Explosion. Set the Speed to however fast you want the spell to move to its location, and the Range to however far you want to be able to teleport. I find a distance of 2000.0 is fair, with a Speed of 20000.0.

 

Fifth step is creating the Magic Effect. Again, I just duplicated Mage Light and changed some stuff around, specifically, the Explosion to the one you just created. Now, attach the BlinkMain script to the Magic Effect, and set the properties.

 

Sixth step is to create the spell. Just create a new one, set it to however you want it to be equipped and attach the new Magic Effect you just created to it.

 

Seventh step is to attach the script to your object. If you just created an empty Nif activator, that'll work perfectly, attach the script and set the properties.

 

Eighth and final step - Get in game and have fun. I know I did. Blinking all around Skyrim is good fun. If people are interested I can explain how to set a "cool down" to it so you can't just spam it constantly.

 

~Regards,

Rizalgar

Link to comment
Share on other sites

  • Recently Browsing   0 members

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