Jump to content

[LE] How to set up DefaultCounter and DefaultCounterIncrementOnDeath?


Recommended Posts

I'm making a quest to clear out a dungeon but I don't really know how to check if everyone is dead. I can't really wrap my head around the civil war quest scripts and the best resource i could find for pulling it off (found here) is for fallout 4 (and when I tried following it it didn't work, unfortunately)

 

I was wondering if anyone could give me some step by step instructions for using the default counter scripts to advance a quest? I'm very much a newbie to quest scripting.

Link to comment
Share on other sites

1) - Create an empty cell and place in it an xMarker.

- Give to the xMarker a unique name.

- Double click the xMarker and add to it in the script section the 'defaultCounter' script.

- In the 'defaultCounter' script's properties check this values and options:

> OnlyOnce

> TargetValue = the number of actors death that will trigger this

> myQuest = add your quest's name

> myStage = add the number of the stage that will be fired


2) - Find in the CK's render window your actors and add to them the 'defaultCounterIncrementOnDeath' default vanilla script.

- Double click each actor you have added the 'defaultCounterIncrementOnDeath' script and in the 'Link Ref' tab Link Ref the actors to the xMarker you created in step "1"


You are done.


NOTES:

- It's not mandatory to create a new empty cell to add the xMarker, you can place it anywhere in the game's world / cells.

But, a good practice is to always have an empty cell in your mod for all of this kind of applications and to avoid incompatibilities by placing an object in the game's world which can be occupied by another mod.

- There was something else I needed to mention, but I forgot what it was with all this writing.

If I get to remember it, I'll come back to this later on.

Link to comment
Share on other sites

  • 1 year later...

Sorry to Necro this thread but I am having a similar problem. After watching many tutorials. I made my first ever quest. A simple Radiant Quest to kill 3 baddies. I placed a large number of XMarkers with a specific RefType. All around my city map. The Location Alias using "Find Matching Location" and condition looking for my specific RefType. A Reference Alias using "Location Alias Reference" pointing to the XMarker the Location Alias dynamically selected. Then the baddies are Dynamically Generated by their Aliases using "Create Reference to Object" and placed on the randomly selected XMarker. Complicated I know and possibly the wrong way to do it. However the chain of steps to this point does work. The baddies are randomly placed at a marker in the city. Unfortunately, I could only find the same tutorial ArmsSamedi did on Kill Counters Here by Seddon4494. It's for Fallout 4 using DefaultCounter scripts made for Quests. Skyrim doesn't have them that I can see.

The snag with these wonderful instructions from maxarturo for me is. The NPCs in my quest spawn in. They are not placed anywhere in the world until the quest creates them. Therefore I can't select them as objects in the Render Window and point their "Link Ref" to the needed XMarker with the counter script as maxarturo describes. I have been banging my head against this wall for days. 😞

I took a peek at the Destroy Dark Brotherhood Quest. I saw they use the condition "GetDeadCount" combined with a custom script written for that specific quest. Something that is over my head.

Can anyone help? I am soooo close. 😞

Edited by LCountach
Link to comment
Share on other sites

Watch the video closely it is two scripts, one is an reference alias script and the same script is attached to all three baddies

ScriptName DefaultCounterAliasIncOnceOnDeathA Extends  ReferenceAlias

Bool doOnce = False

Event OnDeath(Actor akKiller)
	if !doOnce
		(GetOwningQuest() as DefaultCounterQuestA).DeathCount()	
		doOnce=True
	endif
EndEvent

and the other goes to the Quest Scripts Tab

ScriptName DefaultCounterQuestA extends Quest

Int Property TargetValue Auto

Int Property MyStage Auto

Int counter=0

Function DeathCount()
	counter+=1
	If counter == TargetValue
		Self.SetStage(MyStage)
	EndIf
EndFunction

I exactly duplicated the naming convention in the video to make easy for you, but there is extra step, you need to compile them 

Then fill the value just like in the video OK? On the Quest Script

Link to comment
Share on other sites

8 hours ago, PeterMartyr said:

Watch the video closely it is two scripts, one is an reference alias script and the same script is attached to all three baddies

------------------------

and the other goes to the Quest Scripts Tab

------------------------

I exactly duplicated the naming convention in the video to make easy for you, but there is extra step, you need to compile them 

Then fill the value just like in the video OK? On the Quest Script

THANKS! I think I can follow this. Will try it as soon as I have time later today. Will report back the result.

Link to comment
Share on other sites

Unfortunately I was unable to test run these scripts. In the first script "Extends ReferenceAlias". The compiler didn't know what DefaultCounterQuestA was and threw an error.

(GetOwningQuest() as DefaultCounterQuestA).DeathCount()

I only understand at best 50% of the scripts myself and was unable to trouble shoot.

Link to comment
Share on other sites

I quickly installed the game, they compiled fine me) the only thing I could think of, being your first time, you did not unpack the scripts.rar in the data folder

WARNING: unpacking the Scripts.rar has the potential to break SKSE, if SKSE scripts are installed directly to the Data Folder, the fix is reinstall SKSE

https://forums.nexusmods.com/search/?q=Scripts.rar&quick=1&type=forums_topic&nodes=8921

for more information

 

EDIT is is very common mistake constantly repeated in these forum, by first time coders 

Link to comment
Share on other sites

4 hours ago, PeterMartyr said:

I quickly installed the game, they compiled fine me) the only thing I could think of, being your first time, you did not unpack the scripts.rar in the data folder

WARNING: unpacking the Scripts.rar has the potential to break SKSE, if SKSE scripts are installed directly to the Data Folder, the fix is reinstall SKSE

https://forums.nexusmods.com/search/?q=Scripts.rar&quick=1&type=forums_topic&nodes=8921

for more information

 

EDIT is is very common mistake constantly repeated in these forum, by first time coders 

The Scripts.zip was a problem I ran into in the past but, I've had it installed for a while now. I tested several more times. I think I figured out why the "Extends ReferenceAlias" script would not compile. Like I said, I can't read code very well. The line:

(GetOwningQuest() as DefaultCounterQuestA).DeathCount()

Seems like it points to the second script literally named "DefaultCounterQuestA"? That script needed to exist first. Before the first script would see it and pass the compile checks. I think? Anyway... I'm a noob with scripting. Thanks again for trying to help! I'll report back tonight or tomorrow night. If it works or not.

Also, thanks for the warning about SKSE breaking. It's ok though. My install of Creation Kit lives by itself in an empty Skyrim SE folder. With the resource files from Skyrim VR copied over so it will run. Skyrim VR installs itself in a different VR named folder that CK refuses to run from.

Edited by LCountach
Link to comment
Share on other sites

It Worked!!! It Worked!!! Thank you so much! It Worked!!! 😀

I've put over 2000hrs in Skyrim's CK and faced 3 big showstopper challenges along the way. #1 Getting the Creation Kit itself to simply run with Skyrim VR. #2 Writing the scripts to get the city population continually refreshing. And #3 This one! Getting a Radiant Quest to Dynamically choose a Marker and spawn enemy NPCs on it.

Thank you so much! I don't think I would have solved this one on my own.

Edited by LCountach
Link to comment
Share on other sites

  • Recently Browsing   0 members

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