Jump to content

[LE] Need help with script fragment!


Sovrath

Recommended Posts

I put this on the Bethesda forums but as of yet have not been able to receive the help I require.

 

One person is trying but I don't think he understand what I need.

 

I can't script but need a script fragment. I found one on a similar forum as these that allowed me to have the npc attack after dialogue was finished.

 

What I need is a script fragment, original dialogue, that disables the npc after dialogue (it's a ghost)

 

Here is my original post on the Bethesda forums. It's my hope that someone who scripts (remember I'm not a scriptor/progammer) can post something I can use ... (thank you for your help!)

 

I have been working on a a mod for the past few years (started out a birthday present for a friend and yadda, yadda, yadda, the scope got much larger) and it seems I will finish it in the next month or so.

I am not a scripter but have had some luck following tutorial instructions for adding the few scripts that people have made available (DarkFox has been one of the invaluable contributors to this game) and I find I might be in the need of a script fragment.

I had found on another forum a small script fragment for when an npc finishes dialogue and then attacks. I was hoping to find one where the npc finishes dialogue and then "disables" or disappears. However, I have not been able to find such a thing.

The way I've been doing this is to have the player enter a trigger box that starts a countdown while the npc talks and then when the npc is done I've timed the "disable" trigger box to disable the npc. However, when testing last night, I dawdled a few seconds and the npc disabled just as they were finishing. I "could" just add a few seconds to the trigger box but it feels a bit clunky.

 

I'm wondering if there are any scripters out there who would be able to post a script fragment that I can place on the dialogue that would disable the npc after they are finished. I presume this would be on "goodbye?"

Thank you so much!

As a side note, I'll upload the mod to nexus forums and anywhere else that people can upload mods once it's done as I'd like someone else to enjoy it (hopefully) other than my friend. Again, thanks!

Edited by Sovrath
Link to comment
Share on other sites

You could do this in a quest.

 

Make the actor an alias in the quest. Let's call his alias 'MyGhost'

 

Add his dialogue lines. In the last line of dialogue that he says, edit the 'End' papyrus fragment. Add this line:

 

GetOwningQuest().setStage(#)

 

# is the number of the stage you want to set.

 

Now add the stage #. Edit the stage papyrus fragment and add this line:

 

Alias_MyGhost.TrytoDisable()

 

That will make the ghost pop invisible. If you want it to fade out:

 

Alias_MyGhost.TryToDisable(True)

Link to comment
Share on other sites

You could do this in a quest.

 

Make the actor an alias in the quest. Let's call his alias 'MyGhost'

 

Add his dialogue lines. In the last line of dialogue that he says, edit the 'End' papyrus fragment. Add this line:

 

GetOwningQuest().setStage(#)

 

# is the number of the stage you want to set.

 

Now add the stage #. Edit the stage papyrus fragment and add this line:

 

Alias_MyGhost.TrytoDisable()

 

That will make the ghost pop invisible. If you want it to fade out:

 

Alias_MyGhost.TryToDisable(True)

I will try this tonight. Thank you so much. If I'll be back and report if I was successful or not.

 

Very much appreciate it. Stay tuned.

 

Update: Ok, I was too excited so decided to try it and THEN rush to work. Works like a charm!

 

Always awesome to implement something and have it work on the first try! I posted your solution on the Bethesda forum where I also asked the question, in case someone was looking for the same thing. I attributed the solution to you and mentioned the Nexus forums (that site didn't like the link I posted). If that's not ok I'll happily remove it.

 

Thank you so much! If you are comfortable with messaging me your e-mail I'll throw a gift card your way as a way to say "Thanks!"

Edited by Sovrath
Link to comment
Share on other sites

No problem. It will work if it's set up correctly. I do it often. If you want an example of how this is done, open CK navigate to quests, find MQ101, go to the 'Stages' tab and look at stage 5. Here, the carthorses are disabled in just this fashion. The quest alias tab may also be useful to see how they've added their aliases in.

 

In your case, though, I take it your ghost is flagged as 'Unique' on their base data tab? If so, you can set the alias up as a 'Unique Actor' and from the dropdown menu next to that option, search for your ghost and select it.

 

Edit: I know the function 'TryToDisable()' looks odd, rather than using 'Disable()', but it's fine. I've never had it fail yet and it's the function Bethesda always used for these circumstances.

Edit 2: Setting aliases to unique actors is better for the game engine than using forced references. A forced Reference is made permanent and takes up memory. For adding things like books to an alias inventory, it's also good practice to add the actor alias, then the book alias below it and use 'Create In' as the option and point the reference to the actor's alias. This way he doesn't carry the quest items around from the moment he loads in-game. He only has it when the quest runs.

Link to comment
Share on other sites

No problem. It will work if it's set up correctly. I do it often. If you want an example of how this is done, open CK navigate to quests, find MQ101, go to the 'Stages' tab and look at stage 5. Here, the carthorses are disabled in just this fashion. The quest alias tab may also be useful to see how they've added their aliases in.

 

In your case, though, I take it your ghost is flagged as 'Unique' on their base data tab? If so, you can set the alias up as a 'Unique Actor' and from the dropdown menu next to that option, search for your ghost and select it.

 

Edit: I know the function 'TryToDisable()' looks odd, rather than using 'Disable()', but it's fine. I've never had it fail yet and it's the function Bethesda always used for these circumstances.

 

Thank you for the example. It works fine. I'll definitely check out that quest just to make sure I didn't miss anything or "do" anything weird that might cause issues, but it works! The Actors are unique.

 

I did think the "trytodisable", at first glance, seemed odd (there is no "try" just "do!") but as I said, I don't script so what do I know.

Edited by Sovrath
Link to comment
Share on other sites

  • Recently Browsing   0 members

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