RagnaHighArc Posted October 6, 2009 Share Posted October 6, 2009 There's the code. The spell moves the player close to whatever gets hit by the spell. What i don't understand is what is the purpose of the activator(PJActivatorSource)? I made some slight modifications to the script and i was able to "teleport" slightly above the enemy, instead of directly next to it, by changing the line " set zp to act.getpos z " to " set zp to act.getpos z + 200 ". Does that mean that the activator moves to whoever gets hit by the spell and then drags me into them? scn Charge ref self ref act float xp float xc float yp float yc float zp float zc float angle float angleoriginal float anglecorrect float sine float cosine float fact2 float fact3 float fact4 float fact5 float fact6 float fact7 float fact8 float fact9 float x2 float x3 float x4 float x5 float x6 float x7 float x8 float x9 float newx float newy float newz float dummy int done int stagger float d float prevd Begin ScriptEffectStart set self to GetSelf set act to self.placeatme PJActivatorSource 1,0,0 if (self != player && self.IsActor == 1 && self.getdistance player > 200 && self.getdistance player < 1300) set angleoriginal to player.GetAngle z if (angleoriginal >= 360) set angleoriginal to angleoriginal - 360.0 endif set anglecorrect to angleoriginal set angleoriginal to angleoriginal % 90 set angle to (angleoriginal / 57.29) set fact2 to 2.0 set fact3 to 6.0 set fact4 to 24.0 set fact5 to 120.0 set fact6 to 720.0 set fact7 to 5040.0 set fact8 to 40320.0 set fact9 to 362880.0 set x2 to (angle * angle) set x3 to (angle * angle * angle) set x4 to (x2 * x2) set x5 to (x2 * x3) set x6 to (x3 * x3) set x7 to (x3 * x4) set x8 to (x4 * x4) set x9 to (x5 * x4) set sine to (angle - (x3 / fact3) + (x5 / fact5) - (x7 / fact7) + (x9 / fact9)) set cosine to (1.0 - (x2 / fact2) + (x4 / fact4) - (x6 / fact6) + (x8 / fact8)) set newx to sine * 1625 * GetSecondsPassed set newy to cosine * 1625 * GetSecondsPassed if (anglecorrect >= 270) set dummy to newx set newx to 0 - newy set newy to dummy elseif (anglecorrect >= 180) set newx to 0 - newx set newy to 0 - newy elseif (anglecorrect >= 90) set dummy to newy set newy to 0 - newx set newx to dummy endif set xc to player.getpos x set xp to act.getpos x set yc to player.getpos y set yp to act.getpos y set zc to player.getpos z set zp to act.getpos z set newz to (zc - zp) / 20 set done to 0 set stagger to 0 else set done to 1 endif set d to player.GetDistance act set prevd to d self.startcombat player End Begin ScriptEffectUpdate set d to player.GetDistance act if ((d > prevd + 20 || player.GetDistance act < 100) && done == 0) set done to 1 self.removespell PJOverEncumber endif if (player.GetDistance act < 300 && done == 0 && stagger == 0) self.PlayGroup Stagger 1 set stagger to 1 endif if (self != player && self.IsActor == 1 && done != 1) self.addspell PJOverEncumber set xc to xc + newx set yc to yc + newy if ((newz < 0 && zc < zp) || (newz > 0 && zc > zp)) set zc to zc - newz endif player.setpos x xc player.setpos y yc player.setpos z zc self.TriggerHitShader 1 endif set prevd to d End Begin ScriptEffectFinish self.removespell PJOverEncumber act.disable End Link to comment Share on other sites More sharing options...
paladicprince Posted October 6, 2009 Share Posted October 6, 2009 The hilarious thing is that I'm trying to understand his spells as well. THough I'm focusing on his whirlwind spell which I plant to alter and remake I just couldn't figure out how he started. Anyways. Have you tried removing it to see what happens? It's entirely possible that it's merely clutter (i.e. an idea he had tried that didn't work out quite right and he forgot to remove it), I've noticed that quite a bit of his stuff in the telekenesis download is very cluttered and hard to work through. I'll look at this script a bit more myself if I come up with anything I'll update. Link to comment Share on other sites More sharing options...
paladicprince Posted October 6, 2009 Share Posted October 6, 2009 And out of curiousity what are you trying to accomplish? The mess in this is driving me nuts haha. And if you have OBSE you can use the sine function regularly without dealing with all those variables labelled fact :) Link to comment Share on other sites More sharing options...
paladicprince Posted October 6, 2009 Share Posted October 6, 2009 And to finally answer you question, yes. Kind of. For the life of me I can't figure out why it's done this way... I'm currently reworking the script to clean it up quite a bit. He simply placed an invisible object at the feet of whoever was targeted when you cast the spell, then used the location of that object to calculate where you should appear. Instead he could've simply calculated it from self... I think. If I'm right I'll post the way I rewrote the code. Another 15 minutes or so ;) Link to comment Share on other sites More sharing options...
RagnaHighArc Posted October 6, 2009 Author Share Posted October 6, 2009 I plan on using the code to create teleport attacks to enhance my parry and cancel mod. BTW Do you know how to add custom weapon enchantments without altering the normal ones. It's just that i have the shader ready, but i just can't get it to play on just the weapon. Link to comment Share on other sites More sharing options...
paladicprince Posted October 6, 2009 Share Posted October 6, 2009 Interesting. And I'm currently experimenting with it, but I totally made oblivion crash every time you cast the spell. Not thrilling lol. :) And I also don't totally understand the latest question... :( Link to comment Share on other sites More sharing options...
paladicprince Posted October 6, 2009 Share Posted October 6, 2009 Ok. Well I have it working, albiet not perfectly. I'm going to keep trying, but this is what I have so far. If you're any good at math and/or scripting feel free to point out any obvious errors. Right now it will teleport you close to your target, but I have't gotten it to face them yet. I also feel that you appear to close right now, but I'll keep tweaking. EDIT: I've got it working almost completely. The only thing it doesn't do is position you directly behind the the target. In fact right now it feels kind of random, but that has to do with my math. I know what I need to do, but I was trying to take the lazy approach heehee FINAL EDIT: It works perfectly now. Go figure I would put a plus sign when I needed a minus... I really gotta stop scripting at 4 AM >< At any rate you're welcome to copy and paste this code into your mod and modify whatever you need to. I've added some comments to help clear everything up (hopefully). Also, I've used several OBSE commands (as doing sine without it isn't worth the trouble), but it shouldn't be a big deal as 90% of people DLing mods will have it by now. Currently it does not initiate an attack at all, but that shouldn't be hard to impliment. If it wasn't 4 AM I'd do it myself. And it'd be nice to make sure you mantain your sneak bonus so this attack would give the damage bonus... I think that would involve setting yourself to invisible for the duration of the spell, which really should only ever be one, as any higher is pointless and will not do anything. Let me know if there's anything else I can do for ya, though it won't be until tomorrow :) scn PJChargeOBSE Ref Self Short DoOnce Float TargetX ;Used to store your target's location. Float TargetY Float TargetZ Float MoveToX ;Used to store the location you will appear. Float MoveToY Float MoveToZ Float PlayerAngle ;Used to store you're current heading Float TargetAngle ;Used to determine which direction your target is facing and thus appear behind them Float MoveToAngle ;Used to cause you to face the enemy after teleporting Begin ScriptEffectStart Set Self to GetSelf ;Will store whatever the spell hit in the Ref Var Self ;A couple checks so that you can only teleport to an actor that is not yourself and that isn't too far away If (Self.GetIsReference Player != 1 && Self.IsActor == 1 && Self.GetDistance Player < 1300) ;Storing the targets position Set TargetX to Self.GetPos X Set TargetY to Self.GetPos Y Set TargetZ to Self.GetPos Z ;Storing the Targets Angle Set TargetAngle to Self.GetAngle Z ;Calculates where you should appear to be behind the target ;100 is the distance away from the target you will be and can be increased or decreased Set MoveToX to TargetX - 100 * Sin TargetAngle Set MoveToY to TargetY - 100 * Cos TargetAngle Set MoveToZ to TargetZ EndIf End Begin ScriptEffectUpdate ;A simple check so you don't teleport every frame for the duration of the effect If (DoOnce == 0) ;Moves your character to the determined coordinates Player.SetPos X MoveToX Player.SetPos Y MoveToY Player.SetPos Z MoveToZ ;Sets your current angle to a variable and calculates the angle you would need to face the target Set PlayerAngle to Player.GetAngle Z Set MoveToAngle to PlayerAngle + Player.GetHeadingAngle Self ;Sets your angle to be facing the target Player.SetAngle Z MoveToAngle ;Ensures that this block of code is not repeated Set DoOnce to 1 EndIf End Link to comment Share on other sites More sharing options...
RagnaHighArc Posted October 6, 2009 Author Share Posted October 6, 2009 I managed to appear near but not close to the enemy by changing the values of set act to self.placeatme PJActivatorSource 1, 100, 0 the "1" is for one activator, the "100" is for placing the object 100 units(?) in front, "0" , of the enemy. But I'll try your code in minute... /// BTW is it just me, or is the webpage stretching to the right? Link to comment Share on other sites More sharing options...
paladicprince Posted October 6, 2009 Share Posted October 6, 2009 Haha yes it is, and that's most likely my fault. And while that original script will work, it uses placeatme which bloats saves, that and it's just plain messy. >.> And yes units, I have no idea exactly what oblivion used, but I just call them units. Check out my script, and I'll go try to unstretch the page haha Edit: Yay it's unstretched now, sorry I made the stuff in my codebox too long >.> Now for my next quest - Understand, Upgrading, and Fixing his Telekenesis Whirlwind Spell.... Tomorrow. Link to comment Share on other sites More sharing options...
grmblf Posted October 6, 2009 Share Posted October 6, 2009 BTW is it just me, or is the webpage stretching to the right?yep, I'm missing the end of each line too and I'm curious about it as I had to use similar math functions for a script I'm doing. Could you break into 2 the line that exceeds the page size, the one in your the code box in your first post? I'm not sure if that'd solve it but perhaps better trying before reporting it. EDIT: Good that is solved. I'll take a look at this script Link to comment Share on other sites More sharing options...
Recommended Posts