I'm working on a quest script that will track the completion of multiple Quest Objectives in any random order and once all options have been completed the main quest will update with a new objective. It seems to be working properly in game, and it validates in the script validator, but I'm no expert, lol. So, it this the correct way I should be approaching this, or is there a better, more efficient way of doing that I'm trying to do?
Basically, I have 5 optional objectives that can be completed in any random order. Once they're all completed the quest should update with a new objective and continue forward.
scn BalokTrackUpgradesSCRIPTshort DoOnceBegin GameMode if DoOnce == 0 set DoOnce to 1 endif if doonce == 1 && getobjectivecompleted BalokFinishSchoolQuest 75 && getobjectivecompleted BalokFinishSchoolQuest 80 && getobjectivecompleted BalokFinishSchoolQuest 85 && getobjectivecompleted BalokFinishSchoolQuest 90 && getobjectivecompleted BalokFinishSchoolQuest 95 SetObjectiveDisplayed BalokFinishSchoolQuest 100 1 set doonce to 2 endifend
Well, I could either make that form of your script slightly more optimized by taking out the pointless DoOnce setting:
scn BalokTrackUpgradesSCRIPTshort DoOnceBegin GameMode if doonce == 0 && getobjectivecompleted BalokFinishSchoolQuest 75 && getobjectivecompleted BalokFinishSchoolQuest 80 && getobjectivecompleted BalokFinishSchoolQuest 85 && getobjectivecompleted BalokFinishSchoolQuest 90 && getobjectivecompleted BalokFinishSchoolQuest 95 SetObjectiveDisplayed BalokFinishSchoolQuest 100 1 set doonce to 1 endifend
Or; You could change how you are doing it slightly to make it less complicated. In each place where you set one of those objectives to completed, also do 'Set MyQuest.DoOnce to MyQuest.DoOnce + 1' then make your quest script (I assume this is a quest script) look like this:
scn BalokTrackUpgradesSCRIPTshort DoOnceBegin GameModeBegin GameMode If DoOnce == 5 Set DoOnce to 6 SetObjectiveDisplayed BalokFinishSchoolQuest 100 1 EndIfEnd
That way it simply looks for if 5 objectives have been completed, then forwards the quest. Really either way works, neither are super inefficient or anything, and the second way would take more work to change to. So I suggest the first one, simply take out the redundancy.
Alexander J. Velicky