Full Version : [REL] MWE Sneak Eye (alpha)
aerelorn >>Other Projects >>[REL] MWE Sneak Eye (alpha)


<< Prev | Next >>

halo112358- 05-03-2005
I've been running the light mod recently and I noticed that it's just *impossible* to see in dark caves without a light. However, carrying a light kills any stealth bonus due to darkness. The light mod (TLM) had a great idea that I shamelessly ripped, it stands to reason that any thief worth his salt has trained himself to see a little bit in the dark - especially if he's sneaking around in the dark regularly. Now you too can see in the dark somewhat when sneaking. The bonus ranges from 0 to 25 points of night eye applied while your character is in stealth mode and based on your proximity to light sources. The calculation code is based directly on tonto's stealth bolt on script and applies half the bonus that the character would receive to chameleon as a night eye spell.

grab the archive here, and while you're there grab MWE armor effects smile.gif

Right now I'm not really happy with the effect, I'd like the effect to ramp up gradually so that you only get the full bonus once you've been sneaking around in the dark for a bit. Now that I think of it this sort of thing could also apply to any adventurer who has no light source, though I think the bonus should be very small (range 0->5?) and I don't know if rolling that idea into this script is a good plan or not.

This script is shamelessly ripped from tonto's stealth script, all in all this took about 2 minutes to churn out since tonto did the real work already, so credit should be given where credit is due (thanks tonto!).

Any feedback is greatly appreciated, I haven't played this much so I'd love to hear your thoughts or ideas for improvement, ie: is the level of night-eye too strong, too weak? how long should it take for night vision to kick in, how fast should it fade?

tonto_101- 05-03-2005
I don't recall entirely how the script worked, but it should be possible to increase MWE_A and MWE_B to make the effects of light have greater range. Those variablbes should be local (object) and ambient (cell) lighting respectively. I'll try to have a look at the original script soon and see if I can re-decipher how the function worked.

Cid88- 05-03-2005
Nice!

I really wish I could release only a small mod in MWE, but every time I start one, I either add it to an existing one or start a whole new project... Jaina (my companion) is too busy getting dialouge to bother with more MWE functions (I experimented with an attack my target thing, but its rather wild, as the player regularly changes between NPC and Creature targets, and quite a chore to remember to turn off after having an enemy attacked). And while that script I asked you for help with earlier tonto is nearing completion (as cast actually plays the animation, something I didn't know, I'm making it explode spell type thingy).

halo112358- 05-03-2005
I played with this a little and added a timer to delay the effect startup/stop time to keep things from going bright/dark as soon as you toggle sneak mode, it's OK but it's not solid yet.

QUOTE (tonto_101 @ May 3 2005, 03:24 PM)
I don't recall entirely how the script worked, but it should be possible to increase MWE_A and MWE_B to make the effects of light have greater range.  Those variablbes should be local (object) and ambient (cell) lighting respectively.  I'll try to have a look at the original script soon and see if I can re-decipher how the function worked.

So I could vary MWE_A & MWE_B to affect the calculation, that's a pretty good idea .. changing those values over a period of time would let me ramp up the effect nicely. I'll look at the equation and see what I can do with those two smile.gif

hmm. I'm having some trouble getting the updates to be smooth, any time I swap spells there's a split-second (ie: one frame) where both spell 1 & spell 2 are active. The stack, so there's a brief full-screen flash before things settle back down.

tonto_101- 05-03-2005
@halo

I'm pretty sure it's MWE_A and B - something that's interacting with them at least [lazy me]. Also, you probably don't need the spell switching part. That was done to deal with a quirky little morrowind issue. The chameleon spell wouldn't update the player's see-through effect until a frame after the spell was "re-added". The only way to fix this was to have another spell waiting in the wings a frame before the change was made, otherwise the player would flicker between solid and see through. Since you're just doing night-eye, you only need to vary one spell. Just drop the whole spell phase part.

@cid or anyone else

I have a couple of mods laying around that will never be completed. If you have an interest in making the player sink in water due to encumbrance, armor, and skills, or making alchemy more interactive, let me know. I have the framework ready and waiting for both - I just need to make little fixes to some massively complex scripts.

halo112358- 05-04-2005
Hmm, does this mean I can update the spell in place without removing it? That would solve the flickering problem nicely. I tried dropping the spell phase code earlier today and wound up with a single-frame black flash when the updates were occuring. I'll play with it a bit more I guess.

Cid88- 05-04-2005
The alchemy intrigues me.

Especially since I can't come up with any ideas for re-working alchemy (many spells have been reworked or will be).

tonto_101- 05-04-2005
@Halo

Yeah, remove the spell phases and update only one spell. I don't think it'll give you any visual problems afterwards.

@Cid

I'll open up another thread for it.

halo112358- 05-05-2005
Hmm, if I only use one spell the update causes a dark flickering effect. If I remove the night-eye spell to do an addspell update then the effect doesn't kick in again until the next frame.

Is there a way to update a spell in place without removing it? I've tried player->getspell, but the spell doesn't seem to be affected until you remove it from the player and re-add.

Here's the dev kit quote on seamless spell effects,

QUOTE

If you are creating a dynamic spell “ability”, such as night eye that changes with ambient light, create two spells and alternate them.  Morrowind allows you to remove a spell on the frame you call removespell, but it will not add a spell back until the next frame.  This can cause a flickering effect with the menus, and a general slowdown.  Creating two identical spells allows them to be “replaced” on a per-frame basis.  For reference, check out Crime Enhanced’s Light Based Stealth bolt-on.


edit: eh, one last thing - is there any way to tell if the player is carrying a light source? I'd like to kill the night-vision bonus if the player is holding a torch, seems only fair.

tonto_101- 05-05-2005
QUOTE
Hmm, if I only use one spell the update causes a dark flickering effect. If I remove the night-eye spell to do an addspell update then the effect doesn't kick in again until the next frame.

Is there a way to update a spell in place without removing it? I've tried player->getspell, but the spell doesn't seem to be affected until you remove it from the player and re-add.

I guess you'll have to go with the two spell concept then. A spell keeps a seperate record from its template (what you're affecting with ModifySpell) once on the player, and nothing can affect it unless it's removed, time runs out, or it gets dispelled. Since you're using abilities you have to use removespell. You just have to figure out the proper frames to remove and add the ability in order to prevent flickering. I would have thought it would have matched up perfectly to the method I used for the stealth mod, but I guess not.

QUOTE
edit: eh, one last thing - is there any way to tell if the player is carrying a light source? I'd like to kill the night-vision bonus if the player is holding a torch, seems only fair.

MWE should recognize every light source, including ones carried by the player. If it doesn't, then let me know. Affecting MWE_A (local) and MWE_B (ambient) should have a positive linear affect on the radius calculation for each light, if I recall.

halo112358- 05-05-2005
QUOTE (tonto_101 @ May 5 2005, 01:35 PM)
I guess you'll have to go with the two spell concept then.  A spell keeps a seperate record from its template (what you're affecting with ModifySpell) once on the player, and nothing can affect it unless it's removed, time runs out, or it gets dispelled.  Since you're using abilities you have to use removespell.  You just have to figure out the proper frames to remove and add the ability in order to prevent flickering.  I would have thought it would have matched up perfectly to the method I used for the stealth mod, but I guess not.
Hmm, the stealth mod has the same flickering effect, only it's a stacked effect flicker (ie: you become more camoflaged for one frame as the update occurs). This is the same thing that happens in the two-spell sneak eye script, only the night-eye effect is stacked for a frame (hence the flash). I'm not sure there's a way around this.

QUOTE

MWE should recognize every light source, including ones carried by the player.  If it doesn't, then let me know.  Affecting MWE_A (local) and MWE_B (ambient) should have a positive linear affect on the radius calculation for each light, if I recall.

MWE doesn't seem to recognize player-held light sources, you can -*test*-('") this yourself with the stealth mod. Note that the magnitude of your chameleon bonus doesn't change when you equip a lightsource. The bonus does change however if you drop said lightsource on the ground.

Free Forum Hosting by Forumer.comTM!