Jump to content

Creation Kit: Kill Quest Counter Changes Stage Help!


Recommended Posts

Posted (edited)

Essentially, my goal is to make an NPC initiate a greeting after a specific number of NPC have been killed. I am uncertain if I can include a condition within the dialogue itself, as I never got it to function with the conditions getdead or getdeadcount. Alternatively, I am unsure if I need to create a script counter, as I have not been able to find a suitable tutorial that fully explains how to do this. It's important to note that I am not highly experienced in modding, so I would greatly appreciate a detailed, step-by-step explanation.

 

Help is greatly appreciated!

Edited by Jenova23
  • Jenova23 changed the title to Creation Kit: Kill Quest Counter Changes Stage Help!
Posted
On 4/25/2024 at 7:33 PM, Jenova23 said:

Essentially, my goal is to make an NPC initiate a greeting after a specific number of NPC have been killed. I am uncertain if I can include a condition within the dialogue itself, as I never got it to function with the conditions getdead or getdeadcount. Alternatively, I am unsure if I need to create a script counter, as I have not been able to find a suitable tutorial that fully explains how to do this. It's important to note that I am not highly experienced in modding, so I would greatly appreciate a detailed, step-by-step explanation.

 

Help is greatly appreciated!


If you're just interested in #people killed (by PC (team)) then look at GetPCMiscStat "People Killed" ( Game.QueryState("People Killed") in papyrus scripts ).

 

GetDeadCount only works on actor base, so say if you want to test if 10 Skeevers have been killed that is ok. NPCs typically each have their own actorbase so its much harder to count. (Not sure what will happen if you check for an actorbase that is linked to a leveled list.)
If you're interested in a specific set of NPCs then it may be possible. (eg create a quest with them in aliases and add a script to those aliases that updates a counter on the ondeath event, if counter high enough advance stage and use the stage in the condition for the dialog.)

For easier testing you can test your condition with a topic and speak to the NPC to see if they have the topic.
If that works, turn it into a forcegreet (put NPC in quest alias and give a `forcegreet' AI behavior) so the NPC will initiate.

 

 

Posted (edited)
On 4/27/2024 at 3:38 AM, MTB said:


If you're just interested in #people killed (by PC (team)) then look at GetPCMiscStat "People Killed" ( Game.QueryState("People Killed") in papyrus scripts ).

 

GetDeadCount only works on actor base, so say if you want to test if 10 Skeevers have been killed that is ok. NPCs typically each have their own actorbase so its much harder to count. (Not sure what will happen if you check for an actorbase that is linked to a leveled list.)
If you're interested in a specific set of NPCs then it may be possible. (eg create a quest with them in aliases and add a script to those aliases that updates a counter on the ondeath event, if counter high enough advance stage and use the stage in the condition for the dialog.)

For easier testing you can test your condition with a topic and speak to the NPC to see if they have the topic.
If that works, turn it into a forcegreet (put NPC in quest alias and give a `forcegreet' AI behavior) so the NPC will initiate.

 

 

I am uncertain if this is the correct way of doing this. I included a defaultcounter and a defaultcounterincrementondeath script and edited the values, although I'm unsure if this will work as I haven't tested it out yet. Additionally, I connected a keyword to each NPC, but I am also uncertain if I am supposed to add it to there reference where I did?

 

I have provided some visual references for clarification and thank you for the help.

 

 

Spoiler

Screenshot(2394).jpg.bd99673d1cc1bb31613159576d8149fc.jpgScreenshot(2389).jpg.486f17dce9bb64fb23db558cc6dba953.jpgScreenshot(2392).jpg.d755080e58cdbc3586812cd04e249cf1.jpgScreenshot(2390).jpg.9a8abcedaae5f6663417fa6e143608df.jpgScreenshot(2393).jpg.9f65c4272ce7bde55a1d8234db5f4e8a.jpg

 

 

Edited by Jenova23
Posted (edited)
On 4/30/2024 at 5:45 PM, Jenova23 said:

I am uncertain if this is the correct way of doing this. I included a defaultcounter and a defaultcounterincrementondeath script and edited the values, although I'm unsure if this will work as I haven't tested it out yet. Additionally, I connected a keyword to each NPC, but I am also uncertain if I am supposed to add it to there reference where I did?

 

I have provided some visual references for clarification and thank you for the help.

 


Ok, so the first problem you need to solve is that you need to be notified of the deaths of relevant NPCs.  Each NPC will send out an ondeath event when killed, but you need to be listening for this somehow; a script needs to be attached to the NPC to do this.  Typical way to do this is to put the NPC in a quest alias; then you can put a script on the alias that will get the ondeath event.
eg:
Script TrackedNPC extends ReferenceAlias

Event OnDeath( actor akKiller )
  NA_MQ_Wolfscript q = GetOwningQuest() as NA_MQ_Wolfscript

  Debug.Notification( "Tracked actor killed" )  ; For testing, remove this line once confirmed it works.

  q.counter += 1
  if q.counter >= q.advanceAt
    q.setStage( 10 ) ; or whatever the new stage is.
  endif
EndEvent

 

To make this script work, add a variable `counter' and a constant `advanceAt' in the NA_MQ_WolfScript script that you already have:
int property counter = 0 auto
int property advanceAt = 5 autoreadonly

 

Creating the aliases:  
- Create a first alias eg TrackedNPC:
    + set fill type to "Find Matching Reference"  & use a condition that will select a relevant NPC. (*)

    + tick optional, and allow reserved, ensure allow-resuse-in-quest is not ticked.
    + attach the script.
    Close.
- Now duplicate the alias (right click choose duplicate) several times until there is at least as many as there are in your list.  (CK will call them TrackedNPC000, TrackedNPC001, etc.)

 

(*) If the relevant NPCs are correspond to a faction then you can use that, else easiest is likely to make a formlist and drag each relevant NPCs onto it.
Then IsInList  can select them.
You could also use `unique actor' and fill each alias with one of the relevant actor (but that's a lot of work if there are many).


With that the quest will be updated once the kill count has been reached and you can use the quest stage script to do stuff/use the stage as a condition eg on dialog/forcegreet behavior.
(Note counts only kills after the quest started, if kill before should also count you need to adjust)

 

(The picture shows a linked ref back to itself; here the keyword describes the `type of link' that the ref has to the linked ref, not a property of the ref itself.
A keyword would normally be added to the actor itself not the reference. However changing actors/refs themselves is a recipe for mod conflicts; instead put them in a list or directly in the alias.)

 

Edited by MTB

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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