Talk:PushActorAway

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search

Playing with this revealed an interesting fact; doing "self.pushActorAway self 100" will launch an actor very high into the air, but it is all some sort of animation where the reference position of the actor does not change... if you do "self.getPos Z" on the actor high in the sky it will report the z height value of the ground where the actor was standing. If you then do "actor.setPos Z XXX" it will displace that reference point and the actor relative to it... also the reference point will be subject to havok gravity and will "fall". ABO 21:19, 21 May 2008 (EDT)


Ok I did some serious testing to see how it is affected by agility and I guess I found the right formula. Two game settings play important role and its fKnockbackAgilBase and fKnockbackAgilMult. Also palyer agility is capped between 0 and 100 so increasing over 100 in game will have no effect.

So lets say you apply force value of 100 to push actor who has 0 agility (0 agility means no modifiers) and he is pushed some distance (will explain distance vs force later). Now what if he have 100 agility and how will that affect the force?

Set agilBase to (GetGS fKnockbackAgilBase)   ; default is 1.0
Set agilMult to (GetGS fKnockbackAgilMult)   ; default is -0.008
Set agil to (target.GetAV agility)   ; lets say actor has 100 agility at the moment
Set force to 100   ; force we use

Question1: How much would the new force be?

Question2: How much force need to be applied to get the same result as with no modifiers (0 agility)

Answer1:

Set newForce to force * (agilBase + agil * agilMult)   ; result is 20

So with 100 force and 100 agility actor will be pushed the same as if we used force of 20 and if he had 0 agility.

Answer2:

Set newForce to force / (agilBase + agil * agilMult)   ; result is 500

So we need to apply force of 500 in order to push actor the same distance as if we used force of 100 with 0 agility.

Why all this matter, well lets say you want to make spell that pull actor to your feet no matter the distance and no matter its agility. I found approximate constant value we divide distance with in order to get the force we need (c=26.5). So lets say actor is 1000 units away and you want him at your feet. Also lets combine that with abovementioned agility modifiers.

Set constant to 26.5   ; magic number
Set distance to (player.GetDistance target)   ; lets say target is 1000 units away
Set force to (distance / constant)   ; force needed to move actor 1000 units is 38
Set newForce to force / (agilBase + agil * agilMult)   ; don't forget to test for divide by zero if someone messed with game settings
Set pullForce to (newForce * -1)   ; pull use negative values
player.PushActorAway target pullForce   ; and he arrives for a punch in the face :P

Mitchalek 17:26, 26 August 2011 (EDT)

Awesome! I encourage you to incorporate your findings into the main article, if you can. If not, I will try to remember to do so at some point, but it would be better if you did since you are more familiar with the results; I wouldn't want to include anything misleading.
Either way, thanks for reporting your findings! Always helpful to have more information!
Dragoon Wraith TALK 00:20, 27 August 2011 (EDT)