Azazellz Posted October 6, 2017 Posted October 6, 2017 So, for one of my scripts, I need to determine how high the character is falling from. We have several game parameters and a formula by which we can calculate the damage from falling. falling damage = ((height - fJumpFallHeightMin) * fJumpFallHeightMult)fJumpFallHeightExponent * modifiers fJumpFallHeightMin, fJumpFallHeightMult and fJumpFallHeightExponent coded into game settings and can be changed via scripts. But how we can get height from this formula? Any ideas?
afa Posted October 7, 2017 Posted October 7, 2017 I sure hope everything besides height and damage is a constant or something close to...and can you even capture damage as an input? fJumpFallHeightMin = min fJumpFallHeightMulti = multi fJumpFallHeightExponent = exp modifiers = mod falling damage = dmg height = h If I am reading it right the equation is dmg = mod*{[multi*(h-min)]^exp} log(multi) = a log(mod) = b {[log(dmg) - b] / exp} - a = log(h-min) 10^x both sides and then add min So something like.... h = min + 10^{{[log(dmg) - b] / exp} - a} It has been more than a decade since I fuss around with these, someone more familiar might be able to express each part individually and makes it look nicer or easier to apply in a mod.
Azazellz Posted October 7, 2017 Author Posted October 7, 2017 and can you even capture damage as an input? I thought about using this method, but I could not find a way, how to capture falling damage.
Lodakai Posted October 16, 2017 Posted October 16, 2017 Well, I can't say that I am an expert on scripts... but if your script can determine when the falling has started, cant you just use Getpos Z at the start and end of the fall? https://www.creationkit.com/index.php?title=GetPos https://www.creationkit.com/index.php?title=ObjectReference.GetPositionZ_(Papyrus)
Azazellz Posted October 16, 2017 Author Posted October 16, 2017 Well, I can't say that I am an expert on scripts... but if your script can determine when the falling has started, cant you just use Getpos Z at the start and end of the fall? https://www.creationkit.com/index.php?title=GetPos https://www.creationkit.com/index.php?title=ObjectReference.GetPositionZ_(Papyrus) Yes, this works - but only for third person view. Scriptname JumpFall extends activemagiceffect Spell Property LandingSpell Auto Actor Property PlayerRef Auto float Zpos1 float Zpos2 float Zpos3 Event OnEffectStart(Actor akTarget, Actor akCaster) registerForAnimationEvent(PlayerRef, "JumpFall") registerForAnimationEvent(PlayerRef, "JumpDown") endEvent Event OnAnimationEvent(ObjectReference akSource, string EventName) if (eventName == "JumpFall") Zpos1 = PlayerRef.GetPositionZ() elseif (eventName == "JumpDown") Zpos2 = PlayerRef.GetPositionZ() Zpos3 = math.abs (Zpos1 - Zpos2) if (Zpos3 > 250) LandingSpell.Cast(PlayerRef, PlayerRef) endif endif endEVENT From first person it seems this animation events do no work correctly ("landing spell" do not fire).
Recommended Posts
Archived
This topic is now archived and is closed to further replies.