Closed Elise39u closed 6 years ago
Fixed by turning the ajax code to the open click button $("#opener-2").click(function () { $.ajax({ url: "/checkQuest", dataType: 'json', data: {npc_id: currentDialog[0]['id']}, success: function (result) { if (result.Answer == 'Active') { $("#dialog-2").hide(); alert('Complete the quest first') } else { $("#dialog-2").dialog("open"); } } }) })
A. There is a chance that the system wont pop up the box beacus of undefined open method B. So far by Npc 1 is a one time visist enough to activate the quest
i need to check of this is By both with A and how to prevent that B happens by 1 and future quest But A can be created with a random chance and B yeah visit Npc 1 and you will see it
B is due to this piece of code $.ajax({ url: "/checkQuest", dataType: 'json', data:{npc_id: currentDialog[0]['id']}, success:function(result){ if(result.Answer == 'Active'){ $("#dialog-2").hide(); alert('Complete the quest first') } else { $("#dialog-2").dialog({ autoOpen: false, width: 600, buttons: [{
By making the ajax call before the player presses the button the call wil auto load and check if the player has activated the quest so not the call try`s to open the dialog box but the cannot happen unless the player presses the button.