Jump to content

[LE] How to make a spell that causes the target to walk to a certain destination?


Recommended Posts

I haven't worked with AI at all. Is it possible to make a spell that gives the target a certain destination, and causes them to walk to that destination, then stay at that destination indefinitely?

 

I'm guessing I will need to make an AI package, and a quest that gives that package to an alias, and then the spell will tell the quest to use the target for its alias?

Link to comment
Share on other sites

There's a few ways to do it. That's one of them; it's also possible to do script-driven pathing and holding. Quest-based solutions suffer if you start wanting multiple possible path-to targets or to apply the spell to multiple targets; it's still possible but it starts turning into a rats nest of editor objects.

Edited by foamyesque
Link to comment
Share on other sites

It's very possible, and there's probably a multitude of ways you could achieve it.

 

Me, I'd use a spell that places an xmarker and forces the ref target and the xmarker to an empty aliases... and then the spell would fire a scene. In that scene i would run a package that makes the alias travel to that xmarker.

 

Of course, I've never tried this myself.

 

:)

Link to comment
Share on other sites

Quest-based solutions suffer if you start wanting multiple possible path-to targets

 

Would I have to define a path? The spell is intended to be used anywhere in the world, so I won't be able to do that. The only thing that will always stay the same is the destination.

 

I think I recall a return-to-editor-location, maybe if I look inside I can find a way to swap the editor location with an xmarker. Then if I set it to the highest priority, it should override whatever other behaviors the NPC wants to do, right?

 

I don't want it to apply to multiple targets, so I don't have to worry about that.

 

then the spell would fire a scene.

 

I'm completely unfamiliar with scenes, what benefit would this provide over just directly placing the package on a quest alias?

Link to comment
Share on other sites

Scriptname AceQuanChiTrance extends activemagiceffect  

Bool Switch
Actor kTarget
Keyword Property ActorTypeNPC Auto

Event OnEffectStart(Actor akTarget, Actor akCaster) 

	if akTarget.IsHostileToActor(akCaster) && akTarget.HasKeyword(ActorTypeNPC);you don't need this

		Utility.Wait(0.2)
		Switch = true
		akTarget.SetRestrained(true)

	
		While Switch == True

		akTarget.PathToReference(akCaster,1) ;You could change this to a marker or placed activator

		EndWhile

	EndIf

EndEvent

Event OnEffectFinish(Actor akTarget, Actor akCaster)

	Switch = False
	akTarget.SetRestrained(false);Change to true to get them to stay in place when the effect ends, not necessarily when they reach the destination

EndEvent



Check the trance spell out if you want to see how it looks http://www.nexusmods.com/skyrim/mods/61913/?

http://www.creationkit.com/index.php?title=PathToReference_-_Actor

You would need a check to see if the actor is near the marker/activator/actor if you want them to stop when they get there.

Link to comment
Share on other sites

If there's no need to make the spell apply to multiple objects simultaneously (i.e, it will reject an attempt to apply it to a second NPC while the first one is travelling), and if the destination is always the same, the quest-alias-package setup you proposed in the OP will be fine. If you want to extend it to multiple people pathing simultaneously, you could add additional aliases easily as long as the target remained the same. Once you start wanting independent targets, I don't know of a clean solution. :(

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...