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...

ShadowStep


Rastafariel
 Share

Recommended Posts

Yes I am currently obsessed with implimenting monk abilities.

This ability is a limited power, called "Shadow Step". It moves the player 5 feet (or maybe slightly more) in front of himself (player is moving in shadows) giving the ability to walk in the shadow plane through grates and doors etc. Could be seriously abused or could lead to death if you portal into a wall (i.e. crashing) but what the heck I'm doing it anyway.

Here is my script so far.... I'm just missing the correct implimentation for the moveto command I think.... Also I'm not sure if I need to put in the MarkerID section which just tells what cell he is in now.... but if I have to do so, Ill have to get the MarkerID from his current location.

________________________________________________

scriptname ShadowStepScpt

begin ScriptEffectStart

;attempt at teleporting player 5' in front of himself

float pos

float posx ;the x position variable

float posy ;the y variable

float posz ;the z variable

float ang ;(the measure of the angle, first deg, then radians)

float ang2 ;(ang^2) Just for convenience. Could use ang*ang directly.

float ang4 ;(ang^4) Just for convenience. Could use ang*ang*ang*ang directly.

float sign ;sign correction

float sin ;(sine of the angle)

float cos ;(cosine of the angle)

;Now, want to get player heading and location and move player 150 units.

;So, need to get player heading (north == 0, increasing clockwise,

;(east == 90), going up to 360.) Then use fourth/fifth order polynomial

;approximations for sin and cos.

;--sin, cos

set sign to 1

set ang to player.getAngle z

if ang > 270

set ang to ang - 360

elseif ang > 90

set ang to ang - 180

set sign to -1

endif

set ang to 0.017453*ang

set ang2 to ang * ang

set ang4 to ang2 * ang2

set sin to sign*ang*(1 - 0.16605*ang2 + 0.00761*ang4)

set cos to sign*(1 - 0.4967*ang2 + 0.03705*ang4)

;--Move Player 150 units ahead

;have to float 3 vars for pos

set posx to player.getPos x + 150*sin

;player.setPos x pos

set posy to player.getPos y + 150*cos

;player.setPos y pos

set posz to player.getPos z + 55 ;--Tweak offset to put object on ground.

;player.setPos z pos

;--Set angle of PC relative to PC heading

set ang to player.getAngle z + 90

;--Done

;need IsSwimming command line to disable swimming when moving from water to land/other

;get MarkerID

;Player.MoveTo MarkerID posx, posy, posz, ang

end

Edited by Rastafariel
Link to comment
Share on other sites

Why not move a marker object to a position the right distance in front of the player, and then move to player to the marker? Don't need to do a bunch of math that way......

Also, if Oblivion works the same way as Morrowind did, the game engine won't let you moveto someplace that you shouldn't be, it may pick a random direction to move you in instead, or, move you to some specific point. (nearest doormarker?) Can lead to some interesting results.

Link to comment
Share on other sites

Rastafariel, I hope you won't mind me asking about your sine and cosine approximations. They don't appear to be Taylor/MacLaurin series or trigonometric series. For my own edification, can you tell me what approximation you used?

Thanks,

Vince

Link to comment
Share on other sites

Rastafariel, I hope you won't mind me asking about your sine and cosine approximations. They don't appear to be Taylor/MacLaurin series or trigonometric series. For my own edification, can you tell me what approximation you used?

Thanks,

Vince

I borrowed the sin/cosin script from Wyre's Summon Bed script:

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

Link to comment
Share on other sites

Ok so, Im going to try a combo mark/recall spell script and attempt to mark the location about 5' in front of the player, and then move to it.

Here is my script so far:

scriptname DNBShadowStepScpt

;attempt at teleporting player 5' in front of himself (150 units)

;using creature marker called exTeleport2Ref1

float pos

float ang ;(the measure of the angle, first deg, then radians)

float ang2 ;(ang^2) Just for convenience. Could use ang*ang directly.

float ang4 ;(ang^4) Just for convenience. Could use ang*ang*ang*ang directly.

float sign ;sign correction

float sin ;(sine of the angle)

float cos ;(cosine of the angle)

begin ScriptEffectStart

;Now, want to get player heading and location and move player 150 units.

;So, need to get player heading (north == 0, increasing clockwise,

;(east == 90), going up to 360.) Then use fourth/fifth order polynomial

;approximations for sin and cos.

;--sin, cos

set sign to 1

set ang to player.getAngle z

if ang > 270

set ang to ang - 360

elseif ang > 90

set ang to ang - 180

set sign to -1

endif

set ang to 0.017453*ang

set ang2 to ang * ang

set ang4 to ang2 * ang2

set sin to sign*ang*(1 - 0.16605*ang2 + 0.00761*ang4)

set cos to sign*(1 - 0.4967*ang2 + 0.03705*ang4)

;--Move Marker from Player

set pos to player.getPos x + 150*sin

exTeleport2Ref1.setPos x pos

set pos to player.getPos y + 150*cos

exTeleport2Ref1.setPos y pos

set pos to player.getPos z + 55 ;--Tweak offset to put object on ground.

exTeleport2Ref1.setPos z pos

;--Set angle relative to PC heading

set ang to player.getAngle z + 90

end

;--Done with calculating marker 1

begin ScriptEffectFinish

player.moveTo exTeleport2Ref1

playSound DRSOblivionGateOpen

end

_____________________________

COMMENTS:

right now, it seems like all Im doing is going to my creature cage where the critter marker starts.... I'm being silly here I know it... any ideas what Im doing wrong?

Edited by Rastafariel
Link to comment
Share on other sites

Had a look around, and there isn't really a good command in the vanilla scripting to make the script easier. Using PlaceAtMe tends to cause save game bloating, and given what you have in mind here, that WOULD be an issue. That said........ OBSE has a DeleteReference function, that would alleviate that problem, at the expense of requiring OBSE v18 or greater. It would dramatically simplify the script though. a breif outline would be:

placeatme markerobject direction distance <- one line to set the marker, no math involved.

player.moveto markerobject <- put the player in the right spot.

deletereference markerobject <- nuke the marker, and say goodbye to savegame bloat.

Thoughts?

Link to comment
Share on other sites

For a mark and recall spell a script like that is not needed, especially the math. A very simple location mark script can be found in WhoGuru's Eska Cair, it's a spell with two parts, one marks upto 5 or 6 locations and the other is used to recall to the chosen marker. This is done through using a menu.

Very simple stuff :), It could be easily expanded to add more mark/recall options and adjusted to place the marker just infront of the player.

HeyYou is right XD, however you could place your marker(s) in an empty unaccessible interior cell and then use the MoveTo function to move it to the player, this would both remove the need for OBSE and lessen any chances of bloat.

Link to comment
Share on other sites

Thanks for your thoughts guys. There is a great mark/recall mod out already. What I'm trying to do here is essecntially teleport the char 5' in front of himself (in RP sense from D&D Shadowdancer ability to move within shadows and appear somewhere else... like through a pesky grate that others wouldnt be able to get through...)

I have OBSE... so:

placeatme markerobject direction distance <- one line to set the marker, no math involved.

(the math would come in here - how do I get the marker say 5' in front of the player here? i.e. has to be 5' in front of the player need to get the angle the player is facing and then distance)

player.moveto markerobject <- put the player in the right spot. (easy enough...)

deletereference markerobject <- nuke the marker, and say goodbye to savegame bloat. (good idea)

OK - update - so Im trying this now and I dont know the command deletereference (that doesn't work in the code when I script it) Uh, nm, I see I have to run CS with OBSE.... how does one do that?

BTW, do I have to delete the REF if its a critter REF? I'm currently disabling it.

Edited by Rastafariel
Link to comment
Share on other sites

The way place at me works really lends itself to what you want to do.

PlaceAtMe ItemID, count, [distance], [direction]

so, itemID would be your marker object.

Distance would be distance in game units.

Direction would be 0, to place it directly in front of the PC.

It also has the advantage of deciding if an area is "safe", so, you won't teleport into the void, or into a wall, or some such. Might lend some interesting results though.

Link to comment
Share on other sites

Be sure and delete the reference after using it. And I am unsure if it will work on creatures. Might want to use a misc object instead.

Also, reading thru the obse thread, i think you have to disable the object first?? Poking around on that, as I remember some script snippets that worked, that did that.

Edit: Found something close:

1. Call Disable and set a state variable to 1

2. If the variable is 1, call GetDisabled

if GetDisabled returns 1, call DeleteReference and set the variable to 0

if GetDisabled returns, return and wait for next frame.

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...