Jump to content

How to Get Rid of an NPC on Quest Finish?


Allannaa

Recommended Posts

I've made a very short quest where an NPC asks the player to bring her a few items. In exchange for the help, she gives the player a key to a cottage, and is supposed to "retire" at this point.

 

However, I can't quite figure out how to make her go away (that is, remove her from her cell in Whiterun, or just remove her from the game, either way.)

 

Where can I look to find this info? I've been through the official CK tutes and I didn't see it (though that doesn't mean it's not there.)

 

I'm not really good with writing Papyrus scripts, so specifics would be welcome.

 

I should note, I've been sorting thru the forums here since noon... without being able to find this -- UNLESS -- it's some form of "disable" script?

 

Thanks in advance!

Link to comment
Share on other sites

Well, you're already running some kind of script, right?

 

There are a number of ways to go about it but it sounds like yes, you want the disable() function. However, if you just call this function the actor will just pop or fade out right in front of the player. Which will look odd.

 

What you could do is add an event that will disable the actor when the player leaves the cell with a check to see if your quest is completed, so the actor simply won't be there anymore when the player returns.

 

I assume you already have something like the following in your script:

actor property ACTORREFNAME auto
quest propert QUESTNAME  auto

 

What you would add is

 

Event OnCellDetach()
if (QUESTNAME.IsCompleted()) 
ACTORREFNAME.disable()   
endIf
endEvent

 

I'm a beginner at papyrus scripting, so this may be a horrible way to go about it though :)

 

Event OnCellDetach() is an event which fires if the cell in which the object on which the script is running is unloaded.

QUESTNAME.IsCompleted() checks whether the quest QUESTNAME is completed.

and disable() disables the reference.

 

 

(this script snippet is also assumed to be running on the actor reference, I don't know how you set up your scripts or what they are attached to, I haven't really gotten into quest scripting yet)

Edited by acidzebra
Link to comment
Share on other sites

 

What you could do is add an event that will disable the actor when the player leaves the cell with a check to see if your quest is completed, so the actor simply won't be there anymore when the player returns.

 

Event OnCellDetach()
if (QUESTNAME.IsCompleted()) 
ACTORREFNAME.disable()   
endIf
endEvent

 

 

Okay, every time I run anything like this, with an Event or a Function, the compile fails --

mismatched input 'Event' expecting ENDFUNCTION

and

missing EOF at 'EndFunction'

 

No matter WHAT, any time I use blocks like this, that's the fail I get. Always, no matter what the function or event is, in every case. I've done things like copy a block of code exactly, both by the copy/paste method, and by typing exactly what I see in one window, into another. Those two fails are what I get, no matter what.

 

What on earth is up with that?

Link to comment
Share on other sites

I will check out a code and see if it works.

I was in the middle of my own project, but 90% of my project results in

banging my head against a jagged steel wall.

 

I will take a break and see if I can have a quest complete then disable

the character.

Link to comment
Share on other sites

 

No matter WHAT, any time I use blocks like this, that's the fail I get. Always, no matter what the function or event is, in every case. I've done things like copy a block of code exactly, both by the copy/paste method, and by typing exactly what I see in one window, into another. Those two fails are what I get, no matter what.

 

What on earth is up with that?

 

That is... very odd. I tested my code on a dungeon, added NPC, added script to npc, and it worked fine. Could you paste an example of failing code?

Link to comment
Share on other sites

Okay, every time I run anything like this, with an Event or a Function, the compile fails --

mismatched input 'Event' expecting ENDFUNCTION

and

missing EOF at 'EndFunction'

I suppose you have a function above that one that you simply missed to add EndFunction for it...or more exactly you pasted the new code above that EndFunction thous inside the said function (judging the second error)

Link to comment
Share on other sites

The following is tested, I actually did this via DIALOGUE. I borrowed it from the decorate house dialogue which will activate your furniture once you

purchase the home and upgrade. In this case it will disable an npc.

 

The problem is that it happens immediately and looks strange for npc to disappear after talking.

So, I will work on that next.

 

If you don't want to wait, you might do an ALTERNATE dialogue which means don't have the old

lady do the conversation. The player will talk to another npc in the area out of sight of the old lady.

She would then disappear and the PLAYER won't be the wiser.

 

 

1. Add this to one of the dialogue begin, end fragment boxes.

 

decoratemarker.disable()

 

(when you click somewhere else, it will CREATE a script)

 

2. Drag an Xmarker to the outside part of your cell.

Do not modify.

 

3. Double Click on Oldlady NPC that you created and click on: Enableparent tab

Select reference in window to the xmarker you just dropped.

You will not modify anything here either.

 

 

4. Inside the dialogue script that got created when you added 'decoratemarker.disable()' ,

 

you will delete everything the script created except:

scriptname tif_(name of your script)

;begin fragment code

;next fragment index

 

You will paste this under all 3 of the above headers:

 

 

; =================================begin script ============================================

 

 

;BEGIN FRAGMENT Fragment_0

Function Fragment_0(ObjectReference akSpeakerRef)

Actor akSpeaker = akSpeakerRef as Actor

;BEGIN CODE

 

decoratemarker.disable()

;END CODE

EndFunction

;END FRAGMENT

 

;END FRAGMENT CODE - Do not edit anything between this and the begin comment

 

ObjectReference Property DecorateMarker Auto

 

; =======================================End Script =====================================

 

 

5. Test it in the game.

Edited by Ashenfire
Link to comment
Share on other sites

Okay, every time I run anything like this, with an Event or a Function, the compile fails --

mismatched input 'Event' expecting ENDFUNCTION

and

missing EOF at 'EndFunction'

I suppose you have a function above that one that you simply missed to add EndFunction for it...or more exactly you pasted the new code above that EndFunction thous inside the said function (judging the second error)

 

Alas, that would be the simple answer wouldn't it? But it's not. Even if that is the ONLY thing in a "script"... no other lines, no spaces, nothing -- that's the result I unfailingly get.

 

Ash, I'm going to try your method. I don't actually care if Eldah Cronne pops out from in front of the player's very eyes. I mean after all, we all pop out from in front of people all the time when we hit Fast Travel, or "The Poor Man's Teleport"... amirite?

Edited by Allannaa
Link to comment
Share on other sites

The following is tested, I actually did this via DIALOGUE. I borrowed it from the decorate house dialogue which will activate your furniture once you

purchase the home and upgrade. In this case it will disable an npc.

 

The problem is that it happens immediately and looks strange for npc to disappear after talking.

So, I will work on that next.

 

If you don't want to wait, you might do an ALTERNATE dialogue which means don't have the old

lady do the conversation. The player will talk to another npc in the area out of sight of the old lady.

She would then disappear and the PLAYER won't be the wiser.

 

 

1. Add this to one of the dialogue begin, end fragment boxes.

 

decoratemarker.disable()

 

(when you click somewhere else, it will CREATE a script)

 

2. Drag an Xmarker to the outside part of your cell.

Do not modify.

 

3. Double Click on Oldlady NPC that you created and click on: Enableparent tab

Select reference in window to the xmarker you just dropped.

You will not modify anything here either.

 

 

4. Inside the dialogue script that got created when you added 'decoratemarker.disable()' ,

 

you will delete everything the script created except:

scriptname tif_(name of your script)

;begin fragment code

;next fragment index

 

You will paste this under all 3 of the above headers:

 

 

; =================================begin script ============================================

 

 

;BEGIN FRAGMENT Fragment_0

Function Fragment_0(ObjectReference akSpeakerRef)

Actor akSpeaker = akSpeakerRef as Actor

;BEGIN CODE

 

decoratemarker.disable()

;END CODE

EndFunction

;END FRAGMENT

 

;END FRAGMENT CODE - Do not edit anything between this and the begin comment

 

ObjectReference Property DecorateMarker Auto

 

; =======================================End Script =====================================

 

5. Almost forgot, make sure you have dialogue open and click on PROPERTIES and verify that you have

DecorateMarker edited/assigned to the marker you placed, (sometimes they don't behave the first time you try).

 

 

6. Test it in the game.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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