Help me with a Moveto Script

Post » Fri Aug 29, 2014 12:36 am

Scriptname Blink extends activemagiceffect  Actor TargetInt DodgeKey float cost = 25.0SPELL Property BlinkFX AutoEvent OnInit()	RegisterForKey(48)	DodgeKey = 48EndEventEvent onEffectStart(Actor akTarget, Actor akCaster)	Target = akTarget	RegisterForControl("Jump")EndEventEvent OnKeyDown(Int KeyCode)if (!Utility.IsInMenuMode())	     if(KeyCode == DodgeKey && Target.GetActorValue("Magicka") >= cost)    BlinkFX.Cast(Target)             Target.MoveTo(Target, 120.0 * Math.Sin(Target.GetAngleZ()), 120.0 * Math.Cos(Target.GetAngleZ()), Target.GetHeight() - 35.0)             Target.SetGhost(True)			Utility.Wait(0.3)		Target.SetGhost(False)		Target.DamageActorValue("magicka", cost)	endifendifEndEvent

I have created this script to allow the player to press "B" to teleport forward (just a small distance, enough to dodge weapon hits but im having 2 problems :

1) if standing still, it causes me to not only teleport forward, but also upward too (like some instant jump)

2) It can pass through walls and any other areas I shouldn't go to, and I have no idea how to fix this

Thanks for help

User avatar
Nicole Kraus
 
Posts: 3432
Joined: Sat Apr 14, 2007 11:34 pm

Post » Fri Aug 29, 2014 12:48 am

No clue about the upward movement - and finding proper Z coordinates for this sounds tricky on unlevel ground - but one way to prevent movement through walls or to areas that shouldn't be accessed might be to place an invisible object at the location first, and then check if the player http://www.creationkit.com/HasLOS_-_Actor to that object.

User avatar
Tiffany Carter
 
Posts: 3454
Joined: Wed Jul 19, 2006 4:05 am

Post » Fri Aug 29, 2014 1:17 am

I will try the HasLOS trick, thanks.

Do you know of any mod that has an idea similar to mine, so I could look into it ? (The only one I know is Smokin Sick Style and the author did not include source files for his script. And other blink spells mods use targeted spell to reference an area where you teleport)

Would it possible to create an invisible, very fast projectile with very high gravity that would "hit the ground" in very very short time and use that location as a reference to Move the player there?

User avatar
I love YOu
 
Posts: 3505
Joined: Wed Aug 09, 2006 12:05 pm

Post » Thu Aug 28, 2014 10:36 pm

CDM_ made a blink teleport mod recently, you might try sending him a message here or on the nexus. The projectile idea sounds promising to me.

User avatar
Red Bevinz
 
Posts: 3318
Joined: Thu Sep 20, 2007 7:25 am

Post » Fri Aug 29, 2014 8:20 am

MoveTo sends you up in the air because of the GetHeight setting. Remove that and you'll be planted back on the ground.

Secondly, MoveTo shouldn't be voiding the player's collision box, which seems to be the case with your description of issue #2, though this could be normal behavior as MoveTo is basically Fast Travel without COCMarkerHeadings to place you in a safe spot.

Placement of ObjectReferences at ground level will never be perfect for uneven terrain. This doesn't apply to Actors.

As a bit of a tip: If you want to move something to another objects position specifically, you can store their coordinates using GetPositionX,Y,Z and then use those coordinates to pass into MoveTo, SetPosition(), TranslateTo, etc.

User avatar
Killer McCracken
 
Posts: 3456
Joined: Wed Feb 14, 2007 9:57 pm


Return to V - Skyrim