Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

Teleportation to the target


ZuTheSkunk
 Share

Recommended Posts

It should be possible, but I haven't attempted anything like it before.

I'd have a look at this script that moves an object to wherever the crosshair is pointed:

http://cs.elderscrolls.com/constwiki/index.php/How_to_make_a_ground_area_mark_that_follows_the_crosshair

Instead of moving a visible object, you'd move an invisible activator of course. From there, the whenever you cast the spell, your script can use getdistance to find the predefined X-marker closet to the invisible activator, and then use moveto to teleport the player there. :)

Link to comment
Share on other sites

Interesting concept. The crosshair trick above might work.

Its been a while since I was in the CS (all GECK now-a-days) so I am not sure if a targeted spell, when it hits an object, would run a script. If it does, then you could simply have a script run which does a 'placeatme' on the player to the spell destination. But, I think it might only run the script if it hits an 'actor', not just where it exploded. So it would be limited.

Link to comment
Share on other sites

I tried to use the script from Lanceor, but I can't save it - it tells me that there's no "cos" command. :(

But, I think it might only run the script if it hits an 'actor', not just where it exploded. So it would be limited.

I'm thinking that it unfortunately does work that way - therefore, I thought about using "on self" spell that teleports to the crosshair activator described above. Assuming that it does work...

EDIT: Okay, I found the article related to the cos/sin, but due to the fact that I'm always poor in maths, I don't understand a thing. Could someone explain how I can implement this so the Crosshair Activator script will work as intended, please?

Edited by ZuTheSkunk
Link to comment
Share on other sites

'COS' is an OBSE command. I suspected that the crosshair script might require OBSE.

Aww! I should have known that. :( Requirement of OBSE practically nukes the whole idea, as I prefer to use OBSE only for optional features, not for the basic ones. (Strange thing is that the Search option didn't find it... odd...)

And there's no chance of replacing it with these mathematical scripts from my link?

Link to comment
Share on other sites

  • 6 months later...

I don't see what the issue is. I don't know how the Oblivion scripting works, but Taylor expansions should be extremely accurate, as long as the angle is between 0 and 360 degrees (and if you know that you're going to go over, just keep subtracting 360 from your angle until it does fit).

For the cos x, you should use the same script, except you'd change the line, "set SinResult to X - X2*X/6 + X5/120 - X7/5040 + X9/362880 - X9*X2/39916800 + X9*X4/6227020800 - X8*X7/1.307674368e12" with

set cosResult to -x2 / 2 + x4 / (4*3*2) - (x2*x4) / (6*5*4*3*2) + (x4*x4) / (8*7*6*5*4*3*2) - (x2*x4*x4) / (10*9*8*7*6*5*4*3*2) + (x4*x4*x4) / (12*11*10*9*8*7*6*5*4*3*2)

if that's not accurate enough, keep repeating the pattern. If you can create subroutines, you can easily adapt it as needed. Again, I don't know how Oblivion works, but in Java:

float power (int degree, int base)  //Degree is a parameter based on what power you're looking for.  Eg. x^2 is degree 2.  Base is what you're multiplying, eg. in the phrase 2^x, 2 is the base

{

     int xn = base * base;

     for ( int i = 2; i > degree; i++) //This is a loop which starts at 2 and will increment by one until it hits degree

     {

          xn = base*xn;

     }

     return xn;  //after the loop finishes, the service "power" will return xn ("x^n")

}

// you would need to specify which objects can use this.  For example, if you have a class named Math, you would call "power" using Math.power(aDegree, aBase);  Of course, Java already supports this...


float factorial (int numberToFactor)  //numberToFactor is the number to be factored

{

     int nFactorial = 1;

     if ( nFactorial == 0 || nFactorial == 1)  //0! is defined as equal to 1.  1! is 1 and is added here for convenience

     {

          return nFactorial;

     }

     else if nFactorial < 0;  //Factorials are only defined for integers greater than or equal to 0.  0 and 1 included above

          System.out.println ( "I can't let you do that, Dave" );

          return nFactorial;  //This will give you your number back so you don't break anything.  You could set it as an error or return 0 or something else.

          //Yes, the way I've set it up so far, you could combine the first and second conditions.  I've left it like this so you can adjust it as needed.  Plus, I like the quote 

     else

     {

          for ( int i = 2; i <= numberToFactor; i++) //This loop will increment from 2 to numberToFactor

          {

               nFactorial *= i;  // *= is equivalent to nFactorial = nFactorial * i;

          }

          return nFactorial;

     }

     end if

}[/code]


Then, you could just define your functions to give you cos and sin:

[code]float cos(int aPower, int yourBase, int yourAngle) //These should be predefined or defined when called { int cumulativeCosX = 0; for (i = 0; i < aPower; i++) //Loop increments from 0 to aPower - 1 { int termCosX = this.power(2*i, -1)*this.power(i, yourBase) / this.factor(i); cumulativeCosX += termCosX; } return cumulativeCosX; } float sin(int aPower, int yourBase, int yourAngle) //These should be predefined or defined when called { int cumulativeSinX = 0; for (i = 0; i < aPower; i++) //Loop increments from 0 to aPower - 1 { int termSinX = this.power(2*i+1, -1)*this.power(i, yourBase) / this.factor(i); cumulativeSinX += termSinX; } return cumulativeSinX; }

This gives you four widely used math functions. Unfortunately, from the little I've learned about Oblivion scripts, I don't know if it's possible to use these code snippets :(

Edited by UmTheMuse
Link to comment
Share on other sites

I should probably add that I didn't actually test the above, since you'd want to translate them anyway. Also, I'm a beginner in Java, too, so take it with a grain of salt. Stuff proceeded by a double slash "//" are comments. Semi-colons ";" mark the end of a line of code.

Edited by UmTheMuse
Link to comment
Share on other sites

  • 2 weeks later...

I can confirm you can emulate "Cos" maths functions in oblivion without obse, I have used them in a modified script borrowed from the CS wiki :D I dont have long atm but if you serch around for a script that gets the player's direction, there is the correct way to emulate Cos in that script :D Sounds really interesting, I was going to make this for my own mod but couldn't figure out how... good luck!

Link to comment
Share on other sites

There is already a "Blink" spell, that teleports you to your crosshair target. It does indeed require OBSE though.

I would think it should be possible to do a targeted, scripted spell, that its "affect" is to place a marker rat, then simply move the player to the rat?

Link to comment
Share on other sites

So, did you ever figure out how to get the spell to recognize pesky things like walls yet? I'd be interested in seeing the results if you have. You'd think that it would be easy enough, given that spells have that check-box "ignore LOS" or whatever it's called.

Is the problem that the spell abruptly ends before it runs the ScriptEffectFinish block whenever it hits a non-actor? In that case, I bet HeyYou is on the right track; to my mind, you'd want to have a marker reference follow the spell as it heads away from the caster with a script attached that moves the caster to its location as soon as the marker stops moving.

I dunno; maybe somebody more knowledgeable could tell us a better solution, but I bet that this would at least work. In fact, if you don't mind, I'm going to go ahead and write it for myself :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...