Jump to content

Quest trigger doesn't (always) fire


Recommended Posts

I have a bazaar issue I can't seem to find anything on. I've got a quest startup trigger in place and set up, but doesn't always work. Some details... There is an activator attached to the trigger box with a default script (defaultSetStageTRIGSpecificActor) to begin the startup stage of a quest. The defined properties in CK are "myQuest" (my quest, of course), "stage" (to be set), and "triggerActor" (player). The rest are left default, which default to where I want them to (disableWhenDone = true, onlyOnce = true, and prereqStageOPT = -1 (since it is the first and startup stage)).

 

The quest itself is NOT set to be start-game enabled, and to only run once. A pretty simple quest similar to a "kill the bandit leader" quest, but rather a fetch object quest. There are 4 stages of the quest, and details are as follows:

 

(5) startup stage

(10) talk to NPC and accept quest

(20) retrieve item from random location (defined by keywords)

(30) return object to NPC and complete quest

 

Stage 5 is set by the script mentioned above when entering trigger. Stage 10 is set through dialog after accepting quest from NPC. Stage 20 is set using a "defaultSetStageAliasScript" on the object's alias with the trigger being when the item is added to player's inventory (type 7). Stage 30 is set and completed at the end of dialog when returning to NPC.

 

All appears to be solid, and when loading a clean save it is functional 100 percent of the time. But if I load the same clean save and go play a bit, the quest startup trigger stops functioning at some point. I can't seem to find any rhyme or reason as to when or why the trigger stops firing.

 

I also have a separate test PC so that I can pack my plugins into a .zip or .7z archive and install them the same way a person would when downloading from the site. With this one, when I pack it up with all the meshes, textures, scripts, sounds, etc, the trigger does not work. Period.

 

Any advice is very much appreciated. This is the final touch of a mod I've been working on for over a year and a half and plan to release upon completion.

 

Thanks so much,

-Chew

Link to comment
Share on other sites

You did not state how the quest gets started, only that it is not start game enabled.

 

The script stated does not start the quest. It assumes that it is already started. There are no checks in place to confirm that the quest is actually running. Thus if the target actor passes through the trigger volume box while the quest is not running, the prereqStageOPT variable is equal to -1, and the onlyOnce and disableWhenDone variables set to true ... The script will see that all conditions are valid i.e.

auto STATE waitingForActor
  EVENT onTriggerEnter(objectReference triggerRef)
    ; check for correct actor
    actor actorRef = triggerRef as actor
    if actorRef != None && actorRef.GetActorBase() == TriggerActor
      if prereqStageOPT == -1 || MyQuest.getStageDone(prereqStageOPT) == 1
        myQuest.setStage(stage)
        if onlyOnce
          gotoState("hasBeenTriggered")
        endif
        if disableWhenDone
          Disable()
        endif
        trace(self+" triggered by "+actorRef)
      endif
    else
      trace(self+" didn't trigger for base actor " + actorRef.GetActorBase() + " <> " + TriggerActor)
    endif
  endEVENT
endSTATE 

And subsequently fail to set the designated stage while continuing on to change the active state and disable the trigger volume box.

 

Without further information, I surmise that on the 100% success games you are immediately testing the quest while the 100% failure games you have passed through the trigger box prior to starting the quest.

 

If all this is indeed the case, one solution might be to have the trigger volume box initially disabled and use the initial startup stage of the quest (i.e. the stage that runs when the quest starts) to enable the trigger volume box.

 

As far as the second PC not running the quest at all, have you confirmed that that instance of the game has all necessary requirements for your mod in place and that the mod's plugin is active in the load order?

Link to comment
Share on other sites

Thanks for your detailed reply, and for the awesome info. What I'm looking for is to set the trigger box to start the quest when the player passes through. In detail, the trigger box is placed in an exterior cell at the entrance to a house, so that in attempt to enter the house, the player discovers that it is locked and requires a key. It is then that the quest is started and the first objective (speak to the NPC) is displayed in the quest log. This is functional when loading a clean save and testing. More details on that... As for the success and failures, yes the successful attempts only occur when loading and immediately testing. The failures, though, don't add up in my mind. I've made a point to stay away from the cell where the trigger is (the trigger is in Haafingar hold near solitude, and I don't think I've left Whiterun hold). The save point in use was created before the plugin was created. Yet if I disable the plugin and proceed with the game and re-enable the plugin on a later save, the trigger will not fire and the quest cannot be started (while again going nowhere near the trigger). As for the test PC, I know the plugin is active and functional, since the people and structures are there. If I am doing something horribly wrong I would like to know what and how to fix it.

 

Thanks again,

-Chew

Link to comment
Share on other sites

You want the trigger to start the quest? You will need to utilize a different script then.

 

The script you use will need to include the Start function. The function Start ensures that your quest actually starts and once started can then do what you need it to do. You could modify the existing script to include it but you would need to change the script name and save it with a different script name so as to not change the usage of the script with existing objects. Otherwise you might need to write your own custom script.

Link to comment
Share on other sites

I sure appreciate you steering me in the right direction, Ishara. You're awesome as always. I admit my lack of scripting knowledge, but I am learning the language. You are correct; nowhere in there do I have a 'start' function. But I think I have a decent feel for what I need to do now. I will develop a new script based on what I know, and report back.

 

Thanks again,

-Chew

Link to comment
Share on other sites

So I developed a custom script to initiate my quest through the trigger box, set my variables in the CK, and it seems to work thus far. Here is my script attached to the trigger:

Scriptname ClearpineQuest01Script extends ObjectReference
{main script for ClearpineQuest01}

Int RunOnce

quest property ClearpineQuest01 auto
{reference to quest}

key property QuestKey auto
{reference to Quest object}

Actor property PlayerREF auto
{only player can activate trigger}

Event OnTriggerEnter(ObjectReference akActionRef)
	If akActionRef == PlayerREF
		If RunOnce == 0
			ClearpineQuest01.Start()
			ClearpineQuest01.SetStage(5)
			RunOnce = 1
		EndIf
	EndIf
EndEvent

When loading my clean save, all is well; the trigger fires as desired. I've only done minimal testing so far, but I have noticed a pattern in terms of functionality. I shall do my best do explain. I set the 'ObjectLocation' alias to a boss-type chest ('ObjectContainer' alias) of random location based on keywords. It would seem as though if the ObjectContainer' has been looted, with the plugin inactive, the trigger will not fire. I have confirmed this through different save stages with the plugin inactive. For simplicity of testing, I temporarily narrowed down the potential locations of the 'Object' alias ('key') to only six options, and have made five more clean saves to test with. From one save to the next, where the ONLY difference was clearing two more of the six dungeons. In this case, three of them were cleared on save 97, and five were cleared on save 98. So the only variable is having cleared those two dungeons and looted the chests where the key may possibly reside.

 

In short, if the containing chest has been modified before the plugin is activated, the quest does not start. This makes me believe there is something with the script I'm using attached to the 'Object' alias (key). The script I have now is the "defaultSetStageAliasScript", as mentioned in the original post. Also, FWIW, in stage 10 of the quest (after speaking with the NPC and accepting the quest), I have a fragment to run a check to see if the key has been found. Currently the fragment in stage 10 is:

SetObjectiveCompleted(10, 1)
SetObjectiveDisplayed(20, 1)
Alias_MapMarker.GetRef().AddtoMap()

;check if player has obtained key, advance to next stage
If Game.GetPlayer().GetItemCount(Alias_Object.GetReference()) >= 1
  SetStage(20)
EndIf

I don't know if it has any impact or not, but by using 'Alias_Object.GetReference' is the only way I could get the fragment to compile. But by reverse-engineering the game, it looks like the item being counted should be called by, in my case, 'QuestKey'. No matter what I do it gives me an error stating that the 'QuestKey' variable is undifined. I mentioned the details on this in a separate post. Seems like maybe I'm missing something else, or need to write another script?

Link to comment
Share on other sites

How is your key being added to the container?

 

Have you checked the various "boss type chest" containers in their specific location within the CK? Could it be possible that there are two overlapping containers? One linked specifically with the boss that clears the dungeon and another that is used for all other respawned bosses???

 

Seeing the plugin records might be the only way anyone else could truly determine what is going on. I doubt that the current issue is tied to a specific script.

 

If you have a separate post that goes into more detail about this issue, linking to it might help...

Link to comment
Share on other sites

Another good point. As it sits, (assuming I understand correctly) the key is added to the container alias when the quest starts. Until the quest triggers, there is no key to be found. Which seems to be part of my complication. I'd like to have the key placed BEFORE the quest starts, for the interest of realism. Is there a better way to accomplish the placement of the object alias (key) into the object container alias (Boss container)? Maybe I'm just not thinking outside the box.

 

I have looked to make sure there are no duplicate/overlapping containers, and there does not appear to be any issues there.

 

My apologies, I meant to put a link to the other topic. Not that it goes into greater detail, per say, but does include most of the events leading to this point. It can be found here: https://forums.nexusmods.com/index.php?/topic/11479183-questdialogue-help/ . Being the first quest I've created, naturally I've had to do a lot of reading, watching, and trying. I may also remind that I do have decent Creation Kit experience, as I have been making mods for Skyrim for several years. I've made followers, merchants, spells, items, equipment, etc. and have always been able to overcome obstacles, but this one is driving me crazy. What I thought to be a minor detail has become a big hinderance.

Link to comment
Share on other sites

To have the key placed in some container prior to starting the quest... two methods that I know of.

 

Option 1

Reverse engineer how Bethesda did the quest containing the Beacon of Meridia and do your quest like that. Why? The Beacon of Meridia is randomly placed in a boss type container prior to the player knowing that the quest has started.

 

Option 2

Create a second quest that is start game enabled. Use this quest to have the key created in the random keyword valid container.

On the original quest, change any aliases as needed to pull their data from the start game enabled quest aliases.

Link to comment
Share on other sites

Seems like you're onto it, as I dissected the "break of dawn" quest as you suggested, and it's almost like you mentioned in option 2 in your previous post. They have a second quest that places the beacon in a random boss container as soon as the player enters a cell with such container in it, using a 'change location' event. I'm going to study it a bit more when I get the chance.

 

Once again, thank you very much. I sure appreciate the wealth of knowledge. I will report back with the results.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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