ismelltacos Posted October 10, 2018 Share Posted October 10, 2018 (edited) So in my in progress mod the player will be assigned to grab three items, I have an "if" set on one of the three items that tells the game"if (other two items) are in inventory, advance quest to stage 80) but for whatever reason, if I grab this item first...it sets the stage to 80 and completes the objectives as if I picked up the other two items which is weird. This is the script for the item that has the "if" in it scn cletusfakecig1 begin onadd player SetObjectiveCompleted 01companioncletusQuestID 60 1 showmessage cletusfakecigmessage if Player.GetItemCount cletusplate == 1 && Player.GetItemCount cletuscarton == 1 SetStage 01companioncletusQuestID 80endif end essentially, what I believe it says is "when I pick this up, complete objective 60, show my message, and check if I have the other two items, if I do...then go stage 80, end" idk if I typed something wrong or what, but with this broken script it's possible to skip the entire part of picking up the other two items this is a script for one of the other two items, the third of these items shares the same script but has a different name, sets it's own objected to complete, and shows a separate message. This is the script for one of the other items scn cletuscarton1 begin onadd player setobjectivecompleted 01companioncletusQuestID 50 1 showmessage cletuscartonmessage end so I'm assuming someone experience with scripting will see something wrong with it, but I've been having trouble with this part of my quest mod and tbh It's made me so freakin' angry every time I grab the item and it says I grabbed all three, thanks for the help. Edited October 10, 2018 by ismelltacos Link to comment Share on other sites More sharing options...
Mktavish Posted October 11, 2018 Share Posted October 11, 2018 Not sure why it seems to totally bypass the "If Player.GetItemCount"Except maybe it would run better with "If PlayerRef.GetItemCount" ?Also a mention ... your quest ID using numbers in the prefix ... can cause problems.Although your problem doesn't seem a likely result of that ... but anyways it is recommended to not use numbers for the prefix of any form ID ... so do what you will with that advice. However with only one item checking the count and running the SetStage 80 from a "Begin OnAdd Player" block.Were the GetItemCounts to work , it would only set the stage if it was the last item picked up. Because the OnAdd block for that item and script ,only runs once , therefore never checking the item count again. So I would suggest to put the check item count and setstage 80 in each script. Or go a different route with making a global variable that would keep the count , and then set and check the global variable within the scripts.Although it may need a GameMode block for checking then setting the final quest stage , since the OnAdd is only going to run once , therefore may not register the increment change within the same frame.Although once it reaches the count of 2 items , logically the 3rd OnAdd could just advance the quest stage without needing to actually register the 3rd increment. Add edit : also you can use a quest variable if you don't want to mess with a global.Earlier I couldn't find this function in the lists , so that's why I mentioned the global .https://geckwiki.com/index.php/GetQuestVariable But ya you can just declare an Integer count variable in any quest script you already have. Or make a new one that is only for declaring this variable. Having quest scripts for only declaring and storing values is a pretty common practice ... and I think they are best done with very low script process delay , .1 being the lowest you can set it. Link to comment Share on other sites More sharing options...
Recommended Posts