SUG: QuestIsComplete and SetStepComplete + others

Discussions on development of both the EQ2Emulator LUA Script Engine and Script specifications

Moderator: Team Members

Post Reply
User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

SUG: QuestIsComplete and SetStepComplete + others

Post by Ememjr » Wed Mar 27, 2019 4:27 pm

these two lua functions always require you to check to see if you have the quest with hasquest first unless you are absolutely sure you already have it
if you dont check and you dont have the quest it will crash the server

I have in testing and so far it is working when these to functions are executed the lua function will check if you have the quest and just return 0 if it doesnt, no more crashes, and as a sid benifit
you do not have to have a if hasquest state prior to using the above functions, which will make our scripts much cleaner

thoughts comments, are welcome, ie there is a situation where this might not work. before i commit

there are other functions as well i just didnt list them

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: SUG: QuestIsComplete and SetStepComplete + others

Post by Jabantiz » Wed Mar 27, 2019 6:56 pm

That is fine, I would have thought those functions would check for the quest first to begin with but I guess not.

User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

Re: SUG: QuestIsComplete and SetStepComplete + others

Post by Ememjr » Thu Mar 28, 2019 2:54 am

Code: Select all

function enter_poi_location(zone, player, location)
    if location == 10 then
        if HasQuest(player,477) then
            SetStepComplete(player,477,1)
        end
        if HasQuest(player,474) then
            SetStepComplete(player,474,2)
        end
        if HasQuest(player,475) then
            SetStepComplete(player,475,3)
        end
        if HasQuest(player,478) then
            SetStepComplete(player,478,1)
        end
            end
end
that now can be reduced to this

Code: Select all

function enter_poi_location(zone, player, location)
    if location == 10 then
        SetStepComplete(player,477,1)
        SetStepComplete(player,474,2)
        SetStepComplete(player,475,3)
        SetStepComplete(player,478,1)
     end
end
much cleaner

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests