In my first first mod I' tryin to add a more versatile version of telekinesys, As a start I decided to infrodure a "telekinetic force" spell with this script. The spell was desigend to control the force only when the caster is calmed (not running) so litte dealys are not a problem (proper timing to "concentrate" was planed as essential) but I found the scrip to Apply the HavokImpulse too slowly in some situations (the target is pushed several seconds after the spell started ) .
I think that it has something to do with the GetPosition lines .
I'd like to reduce this delay.
Any idea?
Spoiler
Scriptname voicepusheffectscript2 extends ActiveMagicEffect int Property PushForce2 Auto ;for in adjustable intensity future versionint Direccion ;for in adjustable intensity future version;positions of target an caster relative to worldfloat tarposx float tarposyfloat tarposzfloat plaposxfloat plaposyfloat plaposz;positions of target relative to caster float distradialfloat distradiallxfloat distradialyfloat distradialzfloat distradial2;speed of caster float speed0MagicEffect Property NewProperty Auto Event OnEffectStart(actor Target, actor Caster)Direccion=1speed0=Caster.GetAV("SpeedMult") if !Caster.IsRunning() plaposx= Caster.GetPositionX() plaposy= Caster.GetPositionY() plaposz= Caster.GetPositionZ() ;reduce caster speed (caster must concentrate deeply) Caster.SetAV("SpeedMult", speed0/5) ; aply force to moce the targen in the direction the caster is moving utility.wait(0.01) Caster.PushActorAway(Target,0 ) Target.ApplyHavokImpulse((Caster.GetPositionX()-plaposx)*900,(Caster.GetPositionY()-plaposy)*900,(Caster.GetPositionZ()-plaposz)*900,500) ;restore speed Caster.ForceAV("SpeedMult", speed0) else if Caster.IsSneaking() ;casteris abel to throw the target vericaly tarposx=Target.GetPositionX() tarposy=Target.GetPositionY() tarposz=Target.GetPositionZ() distradial2= Caster.GetDistance(Target) Caster.PushActorAway(Target,1 ) Target.ApplyHavokImpulse(00,00,-(distradial2-distradial)/distradial*40, 400) else Caster.PushActorAway(Target,1 ) ; the spell is tlaned to act on objects so i use an equivalent of pushactoraway using ApplyHavokImpulse Target.ApplyHavokImpulse((Caster.GetPositionX()-plaposx)/distradial*100,(Caster.GetPositionY()-plaposy)/distradial*100,(Caster.GetPositionY()-plaposz)/distradial*100, 400) endif ; if anythig fails Caster.PushActorAway(Target,114) endIf ; damare te target a litle Target.DamageActorValue("health", 1)EndEventEvent OnEffectFinish(actor Target, actor Caster) ;restore speed ; otherwise, the peed is not restored correctly sometimes Caster.SetAV("SpeedMult",speed0)endEventedit:
cleraned and comented code
yes it′s planed to ve a concentration speed.that allows yopu to move the target in any direction relative to the caster wiile walking . ingame descriptin of the spell contains:"walking wile cating the spell allows to chanel correctly tho the flor the reaccion of the makical force on the caster "
example of use: confronting a mage an tho warriors you can thow the warriors in fidderent directions leaving a clear combat betwen you and the mage.
next versions could include :
- able to aplay the telekinetic force to objects
- key strike detection form scrips stender
- a risk factor (an aprentive trying to use this master spell will not valance the magick-force reaction correcty and will be thrown away).
- quest to learn the spell
- and more
thanks and sorry http://www.gamesas.com/user/696011-randomnoob/
