Jump to content

Replicate the effects of dialogue?


Recommended Posts

These are typically handled inside quests. In your specific example, the line is handled by the DialogueFavorGeneric quest; you then (re)do the associated dialogue fragment into your spell's magic effect script.
Link to comment
Share on other sites

The script fragments used by dialogue topics work a little bit different than spell scripts. Basically, you can copy them over to a spell script but you need to do a little bit more.

 

First off: to find these script fragments, you'd open the quest that handles the dialogue which does the effect you want. For example DialogueFavorGeneric or DialogueFollower. Then you select the Player Dialogue Tab, look through the Branches and Topics, and then doubleclick the Info. There you will find the script fragments you need. Sometimes there are multiple Infos, but most of the time their script fragments are the same.

In this particular case, you'd open the DialogueFavorGeneric quest and look for the Info that says "lead the way", and there you got your script fragment.

 

 

I once made a simple mod for testing purposes, it does exactly what you want (ie. any NPC hit by the spell will be your follower) so explaining this will be easy for me, I hope it's understandable.

 

So here's what you do:

  1. Create a new Magic Effect or better yet, copy one of the existing spells to save you the time to set up visual fx and sounds. Reanimate spells work fine as a base.
  2. Set the Effect Archetype to "Script", Casting Type to "Fire and Forget", Delivery to "Aimed".
  3. Add a new script to the effect, in my example I named it FollowMagicScript. Edit the script as follows:
    Scriptname FollowMagicScript extends ActiveMagicEffect  
    
    Quest Property pDialogueFollower  Auto  
    
    Event OnEffectStart(Actor akTarget, Actor akCaster)
    
    if akCaster == Game.GetPlayer()
    	(pDialogueFollower as DialogueFollowerScript).SetFollower(akTarget) ; this is the line from the script fragment
    endif
    
    EndEvent
    


  4. Save the script and close it. Click "Properties", click "Auto-Fill All".
  5. Create a new Spell and add the Magic Effect to the effect list.
  6. Create a spellbook or a quest that adds the spell to the game. Done!

 

The NPC hit by the spell will follow you until death or the follower limit is hit when you "hire" another NPC.

If you want to auto-dismiss the follower after the spell has worn off, you'd give the Magic Effect a duration, and add this to the script:

Event OnEffectFinish(Actor akTarget, Actor akCaster)

(pDialogueFollower as DialogueFollowerScript).DismissFollower(0, 0) ; this is the line from the script fragment

EndEvent

The line above was taken directly from the script fragment of the dialogue that says "It's time for us to part ways", from one of the responses to be exact. It's in the DialogueFollower quest.

 

You can basically create spells from any other effect that is usually caused by certain dialogue lines. You just have to look up the script fragment responsible for the effect, and put it inside an OnEffectStart, OnEffectUpdate or OnEffectFinish event in your spell script. Do not forget to declare and fill any properties that were used in the original script fragment.

 

Another thing worth mentioning: If the code you copied from the script fragment doesn't work as intended, you should lookup which functions that script fragment calls, and instead copy the code of those functions to your Magic Effect script, alongside with all properties necessary.

 

 

edit: Damn, I just replied to someone who is already banned. Well, I hope this will help someone else.

Also, If anyone wants to have it, I can upload my follow magic mod. Right now it's just a little cheat mod for my own convenience and testing purposes.

Edited by Volek
Link to comment
Share on other sites

  • Recently Browsing   0 members

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