-
Notifications
You must be signed in to change notification settings - Fork 650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[lua, quest] Convert 'Community Service' quest to interaction framework #6796
base: base
Are you sure you want to change the base?
Conversation
3f32ff4
to
cab7b7b
Compare
I know Lua Diagnostics is mad at me about the return but the quest wont work without the return :( |
|
||
if hasCompletedQuest and option == 1 then | ||
-- Lua Diagnostics complains about this return but key item wont be given without a return | ||
return npcUtil.giveKeyItem(player, xi.ki.LAMP_LIGHTERS_MEMBERSHIP_CARD) -- only get this key item for repeating the quest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an invalid return. onEventFinish does not process any return at all. Just use npcUtil.giveKeyItem directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you need to exit the function, just use return with no args.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I spent like an hour trying to get this keyItem. I tried npcUtil.giveKeyItem in other places and it worked without the return. I tried player:addKeyItem here and it didn't work. I can remove the return but just for the record getting the keyitem isn't working for me without the return.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an invalid return. onEventFinish does not process any return at all. Just use npcUtil.giveKeyItem directly.
And what's even weirder is that I would try getting different key items at this onEventFinish without the return and it worked fine. Call me crazy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DIdnt have my key items open in the screenshot but it's not there. No key item
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adds some prints in the logic to find where its failing, you sure it has an option of 1 to process? why no option check if you have not completed quest?
and i didnt realise this until now that this is onEventFinish code, there is no need to ever return in this block.
should just be:
if hasCompletedQuest and option == 1 then
npcUtil.giveKeyItem(player, xi.ki.LAMP_LIGHTERS_MEMBERSHIP_CARD)
end
make sure you dont have the keyItem and everything spelled correctly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the logic is failing. It gets to the right area and then prints that I got the key item. I would never get the text that I received the key item if the logic was failing right?
There is an option check for not completing the quest - line 358 in the last screenshot.
I have tried dozens of times without a return. It works fine without a return if I change it to other key items instead of the membership card. I can get the membership card if I just move the line to add the key item to an onTrigger. But it will not work without a return on this onEventFinish. Ill make a 1 min video this evening showing the quest and code side by side and I'll complete the quest without a return and with a return.
It takes like 30 seconds to do the quest you just need to change server vars
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adds some prints in the logic to find where its failing, you sure it has an option of 1 to process? why no option check if you have not completed quest? and i didnt realise this until now that this is onEventFinish code, there is no need to ever return in this block. should just be:
if hasCompletedQuest and option == 1 then npcUtil.giveKeyItem(player, xi.ki.LAMP_LIGHTERS_MEMBERSHIP_CARD) endmake sure you dont have the keyItem and everything spelled correctly
https://cloud.atavismxi.com/s/MDf4LxX3ffS7yZy
It's like 40 seconds to complete the quest twice. The first time I complete it it's the code from this PR and I don't get the key item. The only thing I changed was the times the quest is available.
Then like half way through you'll see me add a return and then I get the key item.
…community-service
I affirm:
What does this pull request do?
Converts the quest "Community Service" to the new framework and fixes some bugs like those listed here: AirSkyBoat#2697
I referenced this capture by Siknawz to code the quest: https://www.youtube.com/watch?v=dMCHSUnPDlg
The quest was coded so that even though you could accept the quest at 6pm you couldn't start until a few hours later. From my research I found that this was how the quest was in retail until mid 2005. Since then it was changed so that you could start the quest as soon as you accepted it. So CS 115 - to remind players to start later on after they accepted the quest - was removed
Cut scene 113 was added. The NPC uses it after you light the lamps until the next morning when the lamps are unlit.
Some code related to the quest remains in Zone.lua:
The quest will only offer you he key item as a reward if you do not already have it. I believe it would be repeatedly offered the way it was coded.
You can now turn in the quest anytime - something the internet seems to agree with. Before you had to turn it in by 1am. You just have to light the lamps by 1am. Talking to the NPC to complete the quest can be done anytime.
Finally in most quests what changes the behavior of NPCs is whether the quest is available, accepted, or completed. That was not the case for this quest due to it being repeatable, only available during certain hours, and only one person on server can do it per night. I try to name variables and conditions appropriately for each check function.
Steps to test these changes
Complete the quest "Community Service" in Lower Jeuno.