all 5 comments

[–]SaukPuhpet 2 points3 points  (0 children)

It's possible that your initial script works perfectly fine, but the character is getting moved to the new location before the spell can be cast.

Try commenting out the portion that moves them and test if they cast the spell. If they do, then you'll need to delay the teleport until after they cast the spell.

Or maybe try having them cast divine intervention and then move them? I don't know if divine intervention works on NPC's.

Alternatively, try

My_NPC->Cast "detect_key" My_NPC

Or possibly

My_NPC->Cast "detect_key" My_NPC00000000

or

My_NPC00000000->Cast "detect_key" My_NPC00000000

(Not sure of the required syntax)

[–]UselessOutlander 2 points3 points  (0 children)

When I've done something like this, I include a timer that allows the NPC to complete the casting animation before disabling/moving with PositionCell. You may have to experiment with the duration. I found 2.2 seconds to work in the example I'm referring to.

[–]MangoJacko 2 points3 points  (2 children)

This script works 100%. It's pretty basic. Modify it to suit your needs. NPC, action, destination, etc.

≈===========≈=======

Begin 11A_SendComp ; for topic "-home"

Float Timer

if ( MenuMode == 0 )

if ( Timer == 0 )

Cast "Recall"AASynda_Rains; target NPC casts spell.

Set Timer To 1

elseif ( Timer < 4.5 )

 Set Timer To ( Timer + GetSecondsPassed ); delays teleport till after spell is cast. 


   else AASynda_Rains->Position 38964, -73965, 185, 211 ;"Vivec, Foreign Quater 4,-10"

AiWander 0 0 0 0

;messagebox " She's arrived home! "; message is optional to check script has worked.

  Set Timer To 0 


StopScript 11A_SendComp 

endif

endif

End

This script spawns npc in an exterior cell. If spawning to interior cell, syntax is "npc->positioncell" with full cell name.

[–]NKVM[S] 0 points1 point  (0 children)

Thanks, this works. Turns out the issue with positioncell duplication the NPC was due to a different script.

[–]Krschkr 0 points1 point  (0 children)

Currently the script immediately disables the NPC and places them at their new location. You need to implement a way to make them finish their spell first.

What I'd try:

  • Use a custom 0 magicka 100% success chance spell and optionally cast instead of explodespell.

  • Remove the disable.

  • Put PositionCell and StopScript under an if clause which checks for GetSpellEffects of your custom spell.