Jump to content

Repeat item disable failure


Helena7t5

Recommended Posts

Not a title that rolls off the tongue I know ! The problem I have is this;

 

I have a Murder mystery Quest mod which begins on a large working farm. Before the PC solves the mystery s/he has a very limited stock range but bringing the culprits to justice unlocks many more options. One of these is a tamed boar which, when fed 3 specific special apples, will show the PC a grove where truffles grow. these are both valuable and useful.

Because I want the PC to only be able to access the truffle patches weekly, and with the boar present, the quest disables various triggers and then resets after a week. The basic principle works like this:

 

PC gets quest when s/he buys the boar, so quest is running from then.

PC finds 3 special apples, all separate individual items made by me from the std apple mesh and texture.

PC holds out apples to boar and they disable - (the boar "eats" them.)

As each special pigapple disables it adds a normal std apple to container (the boars body.)

When boar container contains 3 apples the boar gets a new package added by AddScriptPackage

The special pigapples having disabled are sent back to their X mark where they wait to be enabled again when the timer runs out.

After boar has found several truffle patches for the PC you get a stage bump, all items are removed from the boar, all declared variables are reset

 

This all works perfectly ! What does not work the second time around is that, having obtained the special apples again when they're enabled at their x mark by the timer, they do not disable when "eaten" as they do the first time and the boar does not therefore receive the AI pack that sends him off to hunt for truffles.

I have been working on this Mod for three whole years, mostly because I cannot solve this problem. I would very much appreciate some help! I have to admit to being beaten on this, I've tried every darn thing I can think of. I would post the code but its long and involves several scripts, I will if necessary but don't want to take up half the site!

I think the mod is worth posting for others as it has a number of interesting quirks, an exciting skirmish and a relatively challenging mystery, but I really want to fix this first.

Thanks for reading this far !

 

Regards

 

Nanny Oggins

 

aka Helena7t5

Link to comment
Share on other sites

After boar has found several truffle patches for the PC you get a stage bump,

Stages are one-time use. You can go up in stage, but never down. So if you want to go truffle hunting over and over, a different approach would be better.

 

Do you have a DoOnce on the code which enables apples? If they are constantly enabling, a single disable will do no good.

 

I am suspicious of AddScriptPackage. It was not reliable when I tried to use it. Now I use quest variables or global variables or setstages or things on multiple AI packages which the actors have from the beginning.

 

I am suspicious of container content operated triggers. There have been times when they have not worked for me.

 

What trigger do you use to trigger the apple disabling? Perhaps you have an unreliable trigger and a better one could be found.

 

You may wish to post pertinent portions of your scripts. By seeing them, an error might jump out at someone and they could instantly diagnose your problem.

Link to comment
Share on other sites

Thanks for the offers of help, I really appreciate it :)

 

The special apples are enabled/disabled by scripts, but I take your point Ub3rman123 it's an easy mistake !

 

Ok, first I should say that in fact, the quest stages do repeat. I've ticked the 'allow repeated stages' box on the Quest Data page, then reset the stages with scripts. It works fine until the apples don't disable the second time round. I'll try to be clearer;

There are 4 stages 0,10,20 and 50 . Stage 10 is triggered by a trigzone as player approaches & picks up apples, stage 20 is triggered by the boar having 3 std apples in his 'stomach' (container), stage 50 is triggered by his script when the boar ends his hunt package after an hour.The std apples are then removed from his container. Incidently, I know they are removed because I've added a PC spell to check his inventory and they are gone after stage 50.

 

Stage 0 is initially triggered with a once only Topic, 'Buy Boar' and resets with a timer script within the quest script, its a std timer followed by ;

 

;;;;;;;;;;;;;;;;;;;;;;Boar Eats apples;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 

 

If (ApDis1==0)&&(GetStage HBLTruffleQuest ==10)&&(HBLPApple1.GetDistance HBLFarmedBoar <=100)

 

HBLPApple1.Disable

HBLPApple1.MoveTo HBLPigApplePlaceMark 0, 0, 10

HBLFarmedBoar.AddItem HBLPigApple,1

Set ApDis1 To 1

endif

 

for each apple then;

 

If (HBLFarmedBoar.GetItemCount HBLPigApple==3)&&(AppCount ==0)&&(GetStage HBLTruffleQuest ==10)

 

Set AppCount To 1 ;When Boar has 'eaten' 3 apples

SetStage HBLTruffleQuest 20

Set Restart To 0

endif

 

EnD

 

Obviously ApDis1 (2 & 3), AppCount and Restart are declared variables in the script header.

 

The quest script resets after the timer reaches 7 days to stage 0, and PC gets the stagebump message box. The variables are reset at stage 0 again in the quest Stage Result script box.

 

HBLTruffleQuestStage10Trigger.enable

HBLTruffleEnableMaster.enable ;Truff Patches appear

HBLPApple1.enable

HBLPApple2.enable

HBLPApple3.enable

Set HBLTruffleQuest.ApDis1 To 0

Set HBLTruffleQuest.ApDis2 To 0

Set HBLTruffleQuest.ApDis3 To 0

Set HBLTruffleQuest.AppCount To 0

 

 

Stage 10 is then triggered by the PC activating a Trigzone as s/he picks up the apples that are newly re-enabled.

 

This all works, yeah I'm as surprised as you but it does Lol ! Over and over and over it works but,..the darned apples don't disable the second time around and so the boar container doesn't receive the std apples and so he doesn't get the 'Hunt' Ai package !

 

I 've tried using the formid's of the 3 PigApples instead of the name, but the result is the same.

 

This mini-quest is really quite fun as the PC has to be very agile to 'snatch' the truffles. It takes only about 90 mins (game time) and is entirely optional each reset.

 

hope you have some ideas fellas, my brain is overheating !

 

 

Regards

 

Nanny O

 

aka helena7t5

Link to comment
Share on other sites

The 'allow repeated stages' box is unreliable. I got burned and have steered clear of it ever since. There are very few vanilla quests which use this box and very little documentation written on it. Since it doesn't work for me, I haven't studied it much and don't understand it. From what I have read, I suspect that it is misnamed, doesn't do what you expect, and would be better if it had a more descriptive name.

 

I have no confidence at all in ever getting a script to work that uses this box, but I am not a master scripter.

 

You might play-test and use a console command see what setstage you are at when your apples fail to disable.

 

GetStage HBLTruffleQuest 

 

According to your theory, you will be at stage 10. According to my theory, you will be at stage 50.

 

Here is what came up when I searched for the function of the Allow Repeat Stages box:

 

http://cs.elderscrolls.com/constwiki/index.php/Quest_Stages_Tab

Log Entry: The text that is displayed in the player's quest log when the stage item is applied. Only one journal entry is permitted per stage, unless the "Allow Repeat Stages" flag is checked under the "Quest Data" tab. SetStage must still be called for each entry.

 

 

 

http://cs.elderscrolls.com/constwiki/index.php/A_beginner%27s_guide_-_Appendix_1

Allow Repeated Stages

 

The vast majority of storyline quests work on the basic idea that each stage is a development that precludes the previous stages. Once you've done stage 10 then it is considered as executed. Any effects that the stage has, like adding a sword or displaying a message, are then ignored in future. Using script functions like SetStage 10 on an executed stage have no further effect. (Other than setting the stage counter to 10).

 

If this flag is checked, a journal entry will be displayed and the quest stage result scripts will be executed every time SetStage is called for a particular stage number.

 

Again, the vast majority of the time, we should leave this unchecked.

 

If my boss assigned me to debug this script, I would throw out the setstages and restructure it to use quest variables which can reliably go up and down in value as many times as you want them to.

Link to comment
Share on other sites

You're absolutely right David ! I did as you suggested and found that it was actually at stage >>50. It's puzzling, as the references that should only enable at 0, and 10 do exactly that, which is why I assumed the repeat stage was working.

 

I shall certainly not use 'repeat stages' again !

 

If you would be so kind as to indulge me a little longer, I'd really appreciate it if you could post me a little bit of example code. I mean, how would you use quest variables in this way, It'd really help.

 

Thanks for your help so far, I should have asked earlier but I tend to be stubborn when It comes to working stuff out for myself !

 

Regards

 

Nanny O

Link to comment
Share on other sites

I am not sure of the structure of your scripts. The quest variable must be initialized in the quest script. In that script it could be called HBLQuestVar. All other scripts referring to it would then have to call it HBLTruffleQuest.HBLQuestVar. The variable is only initialized in the quest script. For simplicity, you could retain the quest stage numbers as values your variable will hold. Result scripts on quest stages will need to be moved to your scripts.

 

;;;;;;;;;;;;;;;;;;;;;;Boar Eats apples;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Short HBLQuestVar

If (ApDis1==0)&&(HBLQuestVar == 10)&&(HBLPApple1.GetDistance HBLFarmedBoar <= 100)

    HBLPApple1.Disable
    HBLPApple1.MoveTo HBLPigApplePlaceMark 0, 0, 10
    HBLFarmedBoar.AddItem HBLPigApple,1
    Set ApDis1 To 1
endif

; for each apple then;

If (HBLFarmedBoar.GetItemCount HBLPigApple==3)&&(AppCount ==0)&&(HBLQuestVar == 10

    Set AppCount To 1 ;When Boar has 'eaten' 3 apples
   Set HBLQuestVar to 20
    Set Restart To 0
endif

End

; Obviously ApDis1 (2 & 3), AppCount and Restart are declared variables in the script header.

; The quest script resets after the timer reaches 7 days to HLBQuestVar == 0, 
; and PC gets the Messagebox: (Messagebox "Time for more truffle hunting! etc. etc.")
; The variables are reset to HLBQuestVar == 0 again in the following script.

Begin Gamemode
    If HBLQuestVar == XX
         HBLTruffleQuestStage10Trigger.enable
         HBLTruffleEnableMaster.enable ;Truff Patches appear
         HBLPApple1.enable
         HBLPApple2.enable
         HBLPApple3.enable
         Set HBLTruffleQuest.ApDis1 To 0
         Set HBLTruffleQuest.ApDis2 To 0
         Set HBLTruffleQuest.ApDis3 To 0
         Set HBLTruffleQuest.AppCount To 0
         Set HLBQuestVar to HBLQuestVar + YY   ;  OR    Set HLBQuestVar to ZZ 

    EndIf
End

; HLBQuestVar == 10 is then triggered by the PC activating a Trigzone as s/he picks up the 
; apples that are newly re-enabled.

Link to comment
Share on other sites

I am not sure of the structure of your scripts. The quest variable must be initialized in the quest script. In that script it could be called HBLQuestVar. All other scripts referring to it would then have to call it HBLTruffleQuest.HBLQuestVar. The variable is only initialized in the quest script. For simplicity, you could retain the quest stage numbers as values your variable will hold. Result scripts on quest stages will need to be moved to your scripts.

 

;;;;;;;;;;;;;;;;;;;;;;Boar Eats apples;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Short HBLQuestVar

If (ApDis1==0)&&(HBLQuestVar == 10)&&(HBLPApple1.GetDistance HBLFarmedBoar <= 100)

    HBLPApple1.Disable
    HBLPApple1.MoveTo HBLPigApplePlaceMark 0, 0, 10
    HBLFarmedBoar.AddItem HBLPigApple,1
    Set ApDis1 To 1
endif

; for each apple then;

If (HBLFarmedBoar.GetItemCount HBLPigApple==3)&&(AppCount ==0)&&(HBLQuestVar == 10

    Set AppCount To 1 ;When Boar has 'eaten' 3 apples
   Set HBLQuestVar to 20
    Set Restart To 0
endif

End

; Obviously ApDis1 (2 & 3), AppCount and Restart are declared variables in the script header.

; The quest script resets after the timer reaches 7 days to HLBQuestVar == 0, 
; and PC gets the Messagebox: (Messagebox "Time for more truffle hunting! etc. etc.")
; The variables are reset to HLBQuestVar == 0 again in the following script.

Begin Gamemode
    If HBLQuestVar == XX
         HBLTruffleQuestStage10Trigger.enable
         HBLTruffleEnableMaster.enable ;Truff Patches appear
         HBLPApple1.enable
         HBLPApple2.enable
         HBLPApple3.enable
         Set HBLTruffleQuest.ApDis1 To 0
         Set HBLTruffleQuest.ApDis2 To 0
         Set HBLTruffleQuest.ApDis3 To 0
         Set HBLTruffleQuest.AppCount To 0
         Set HLBQuestVar to HBLQuestVar + YY   ;  OR    Set HLBQuestVar to ZZ 

    EndIf
End

; HLBQuestVar == 10 is then triggered by the PC activating a Trigzone as s/he picks up the 
; apples that are newly re-enabled.

 

Many thanks for your time David. I will apply this and get back to you when I've tested it.

 

Regards

 

Nanny O

Link to comment
Share on other sites

Finally ! Thanks to your sound advice, I have now got the Truffle hunt section working perfectly. in fact, due to the absense of repeated stage bump message boxes, it is even better than I'd hoped.

 

Many thanks, you'll definitely get a mention in my Readme.

 

Regards

 

Nanny O :biggrin:

Link to comment
Share on other sites

  • Recently Browsing   0 members

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