Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

How to start a stage upon NPC death?


KWITS
 Share

Recommended Posts

Good Day,

What a wonderful website! I have an issue that still stumps my understanding and it deals with triggering a new stage immediately upon the death of a battling NPC. I have tried several functions such as GetDead or GetDeadCount but all without success. There is a note within the NPC's inventory that I want the Player to be reminded to search for. Please provide a sample script how you would resolve this issue.

Regards,

KWITS

Link to comment
Share on other sites

Either in your quest script's GameMode block, like this:


If [YourNPC'sRef].GetDead == 1
SetStage [YourQuestID] [Stage#]
EndIf
[/codebox]

or on the NPC's script in an OnDeath block, like this:

[codebox]
Begin OnDeath

SetStage [YourQuestID] [Stage#]

End

In either case, of course replace the stuff in brackets with the appropriate IDs/numbers. :)

Link to comment
Share on other sites

Either in your quest script's GameMode block, like this:


If [YourNPC'sRef].GetDead == 1
SetStage [YourQuestID] [Stage#]
EndIf
[/codebox]

or on the NPC's script in an OnDeath block, like this:

[codebox]
Begin OnDeath

SetStage [YourQuestID] [Stage#]

Thank you so much for taking the time to answer my request. Unfortunately, the code you referenced did not produce the results that I had expected. After I killed the NPC and the battle was ended, there was no set stage, pop-up. Do you have any more ideas?

KWITS

End

In either case, of course replace the stuff in brackets with the appropriate IDs/numbers. :)

Link to comment
Share on other sites

Good Day,

Thanks again to everyone's contributions to my forum thread! Here is my latest code update for beginning a new Stage upon the immediate death of a NPC in active combat with the Player:

WaVDarkPriestVoidRef.Startcombat Player

If WaVDarkPriestVoidNPCRef.GetDead == 1

SetStage WaV001 31

Endif

This code is actually within the topic discussion area as a resulting script to be executed upon end of the said topic with the Player.

Cheers,

KWITS

Link to comment
Share on other sites

This code is actually within the topic discussion area as a resulting script to be executed upon end of the said topic with the Player.

At the time the dialog is spoken that has this script attached, is WaVDarkPriestVoiceNPCRef actually dead? Because results scripts only fire once, so it's only going to check that once to see if he'd dead or not.

Link to comment
Share on other sites

Either in your quest script's GameMode block, like this:


If [YourNPC'sRef].GetDead == 1
SetStage [YourQuestID] [Stage#]
EndIf
[/codebox]

or on the NPC's script in an OnDeath block, like this:

[codebox]
Begin OnDeath

SetStage [YourQuestID] [Stage#]

I just tried the code for Begin OnDeath and still no positive results upon killing the NPC that was in combat with my Player. No stage was set.

Regards,
KWITS

End

In either case, of course replace the stuff in brackets with the appropriate IDs/numbers. :)

Link to comment
Share on other sites

At the time the dialog is spoken that has this script attached, is WaVDarkPriestVoiceNPCRef actually dead? Because results scripts only fire once, so it's only going to check that once to see if he'd dead or not.

The Player encounters the NPC and begins a conversation dialogue sequence. As soon as the NPC finishes his dialogue, he immediately begins attacking the Player. When the Player kills the NPC, I was trying to set a new stage to prompt the would be Player to check the body for a special document.

Regards,

KWITS

Link to comment
Share on other sites

Ah, yes, then that is why your stage is not getting set. Here is what is happening:

1) Player talks to NPC. The script runs.

2) NPC attacks player, as per the script.

3) NPC dies, but the script was done running a long time ago so the stage never gets set.

This:


If WaVDarkPriestVoidNPCRef.GetDead == 1
SetStage WaV001 31
Endif
[/codebox]

will only set the stage if it runs after the NPC dies, so it needs to be in the GameMode block of your quest script.

Link to comment
Share on other sites

Good Day,

Thank you again for reviewing my postings. I tried your recommendations but still my new stage did not start. I tried placing the code snippet within a script for the NPC and tried to place it under my main script but with no positive results.

Begin GameMode

; main WaV001 Quest sections

If ( GetStage WaV001 ==30 ) && ( WaVDarkPriestVoidNPCRef.GetDead == 1 )

SetStage WaV001 31

Endif

End

Best Regards,

KWITS

Link to comment
Share on other sites

If ( GetStage WaV001 ==30 ) && ( WaVDarkPriestVoidNPCRef.GetDead == 1 )

There is a space missing in that line, should be "GetStage WaV001 == 30" instead of "GetStage WaV001 ==30". See if that fixes it.

If not, then go in-game and kill the NPC, and then use "GetStage WaV001" in the console to make sure the stage is actually 30.

Link to comment
Share on other sites

Good Day,

Thank you again for reviewing my postings. I tried your recommendations but still my new stage did not start. I tried placing the code snippet within a script for the NPC and tried to place it under my main script but with no positive results.

Begin GameMode

; main WaV001 Quest sections

If ( GetStage WaV001 ==30 ) && ( WaVDarkPriestVoidNPCRef.GetDead == 1 )

SetStage WaV001 31

Endif

End

Everyone,

I was finally able to get my script to work late this Friday evening. Once I corrected the object ID ref for my NPC to be killed, everything began to work. Thank you for all of your help.

Best Regards,

KWITS

Link to comment
Share on other sites

I am glad to hear this. Good luck with the rest of your mod! :thumbup:

Thank you sincerely Khettienna for all of your ideas. I am not a programmer by trade but an artist and a novelist of ideas. However, I have intermediate expertise in VB scripting; this is my main stumbling block. My resolution for this topic of interest was interesting. When I initially chose to place the GetDead script piece within the main WAV001 script, this was the the track of success. I had earlier devised several script versions within the actual quest topic results area but without any success. The CS allowed both object IDs and reference IDs within the main WAV001 script which threw me for a loop. The final resolution was to change WaVDarkPriestVoidNPCRef to simply WaVDarkPriestRef. This topic is now closed; moving on to my next topic of interest!

Have a great day,

KWITS

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...