Jump to content

Companion Teleportation


Muralin

Recommended Posts

I am trying to make my companion teleport to the IC Marker District after completing a stage of the companions quest, the script I made is:

 

ScriptName CrysellaMain01GrandTeleportSpell

 

ref CrysellaToucher

short doState

float CrysellaZ

 

Begin ScriptEffectStart

set doState to 0

if (CrysellaRef.GetItemCount Torch02 > 0)

CrysellaRef.RemoveItem Torch02 1

endif

End

 

Begin ScriptEffectUpdate

if doState == 0

CrysellaRef.MoveTo ICMarketDistrictCenter

 

CrysellaToucher.moveto CrysellaRef

set CrysellaZ to CrysellaRef.getpos Z

CrysellaToucher.setpos z CrysellaZ

 

CrysellaRef.pms CrysellaHolyEffect 1

endif

set doState to 1

endif

 

endif

End

 

Begin ScriptEffectFinish

CrysellaRef.RemoveScriptPackage

End

 

I'm not sure what I did wrong and any suggestion would be appreciated, if I can manage to do this, this is going to be a great companion mod! :biggrin:

Link to comment
Share on other sites

In most cases it would be a simple:

if getstage <questname> == <stage> && <actorRef>.<local variable> == 0
set <actorRef>.<local variable> to 1
<actorRef>.movetomarker <marker>
endif

 

But, you should be aware that scripts on NPCs only run when the NPC is in the active area around the player, and moving an actor from an active cell to an inactive cell can cause some stability issues. Meaning that the bit of scripting which moves an actor usually needs to be attached to a script which is in an active cell (or quest) and the actor usually needs to be moved to an active cell.

Link to comment
Share on other sites

Vagrant0, in the quest the actor will be around the player when they use their spell. An example is like in the Rhianna Companion mod she is able to use a return home spell where she casts it and is teleported to her home marker. The example of Rhianna is something of what I want except that I want my companion mod to cast a unique spell that will show every time she teleports ( CrysellaRef.pms CrysellaHolyEffect 1 ), it looks really cool. Also, is there a way to make an option to always teleport, and not during specific quest stages? And is it possible to add your own spell effect when companion teleports (like a burst of light comes out of the companion then they teleport) or is that impossible? Thx for the advice, nice to know people can help with these complicated scripts.
Link to comment
Share on other sites

  • Recently Browsing   0 members

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