Elias555 Posted February 1, 2017 Share Posted February 1, 2017 What's the best way to make a teleport spell(like a blink spell) that allows me to check light level of the location prior to teleporting? I thought that using a marker would be fine but GetLightLevel is for actors only.This is for a summon spell, attached to the actor of course: Scriptname BlinkScript extends Actor Event OnLoad() Float LightLevel = Self.GetLightLevel() Utility.Wait(1) If LightLevel <20 Game.GetPlayer().MoveTo(Self) EndIf Utility.Wait(3) Self.Disable() Self.Delete() EndEvent For some reason in the same area where the light on the player is ~17, for the summoned actor is ~45. Any reason why? Any other methods? Link to comment Share on other sites More sharing options...
FrankFamily Posted February 1, 2017 Share Posted February 1, 2017 From my experience the values of GetLightLevel vary a LOT and not always predictable by the visual light intensity, so test in a few areas, you may need to put your cut point higher, going by memory but in my bow of shadows i think i used 35 for detecting shadows. Of course you risk false positives but it's better than false negatives imo. Link to comment Share on other sites More sharing options...
Elias555 Posted February 1, 2017 Author Share Posted February 1, 2017 From my experience the values of GetLightLevel vary a LOT and not always predictable by the visual light intensity, so test in a few areas, you may need to put your cut point higher, going by memory but in my bow of shadows i think i used 35 for detecting shadows. Of course you risk fase positives but it's better than false negatives imo.Oh..I know.Any shadow-y area late at night is around 17 LL. This is consistent in the areas I'm testing in. ~45 LL is way off, I think there's another factor at play. It does fire occasionally at the same spot if I spam and I'm not sure why. How did your bow place the actor? I was going to try explosion placing but if you've already done it like that there's no point. Link to comment Share on other sites More sharing options...
FrankFamily Posted February 1, 2017 Share Posted February 1, 2017 In my case i only needed to care about player's light level so didn't have the actor placing issue. Anyway, I'd do explosion too, not sure if it lets you select an actor as the thing to place though, if not then a marker than then spaws an actor. Link to comment Share on other sites More sharing options...
NexusComa Posted February 1, 2017 Share Posted February 1, 2017 What has a blink like spell and light level got to do with each other? Link to comment Share on other sites More sharing options...
FrankFamily Posted February 1, 2017 Share Posted February 1, 2017 One can guess he only wants to allow blinking to shadows Link to comment Share on other sites More sharing options...
Elias555 Posted February 2, 2017 Author Share Posted February 2, 2017 (edited) In my case i only needed to care about player's light level so didn't have the actor placing issue. Anyway, I'd do explosion too, not sure if it lets you select an actor as the thing to place though, if not then a marker than then spaws an actor.Ah, that would be easier but it wouldn't be what I want to implement. Explosions can spawn almost anything, very versatile. What has a blink like spell and light level got to do with each other? One can guess he only wants to allow blinking to shadowsCorrect. Hopefully someone can think of a way to do it because I'm stumped. EDIT: I think I've figured it out, partially at the very least. Light sources that cast a shadow don't register as an adjustment to light level on NPC. In other words, the spell works correctly 100% of the time when it's above the threshold and near a non shadow emitting light source but will fail(the check) if it's a shadow emitting light source. Out doors is almost never going to work(the moon emits a shadow I assume), the only time it did is when the light level was some how 0(guessing the script was too fast) and then it passed the check erroneously. Edited February 2, 2017 by Elias555 Link to comment Share on other sites More sharing options...
irswat Posted February 2, 2017 Share Posted February 2, 2017 can you use geometry to calculate where there should be shadows? Link to comment Share on other sites More sharing options...
Elias555 Posted February 2, 2017 Author Share Posted February 2, 2017 can you use geometry to calculate where there should be shadows? I don't know how to do that and it seems like over kill. I also thought about checking whether there's a shadow emitting light source within a certain range but the that only checks from the players position. Might have to change it so the light level condition is on the PC :( Link to comment Share on other sites More sharing options...
irswat Posted February 2, 2017 Share Posted February 2, 2017 (edited) You would need the x,y,z of the light source position, its angle, the height of nearby objects that block light, thus casting shadow, and the players position, the slope of the ground beneath the player would also be useful. If you can get this information, then you could simply use your explosion method, run a ref walking script, fill an array with nearby objects, and a parallel multidimensional array with x,y,z, height, of these objects sorted by distance from explosion, fill a multidimensional array/or JSON container with x,y,z, angle, of light sources. Get x,y,z of explosion. Get slope of ground if possible. The rest is relatively simple geometry. Here is a link using 3d coordinates and objects.during the daytime you can pretty much ignore any light sources except the sun, which would make this much easier to use during the day-I think. during the night time shadows are pretty much everywhere. Edited February 2, 2017 by irswat Link to comment Share on other sites More sharing options...
Recommended Posts