Here is the building action script for the Artisan quest. Lots of thanks to Falcon for letting me use and modify his script from Annals.

add_loadsave("AMBARANNON_QUEST", 0)

SV_FOOD_FRUIT_LIFE = 44

-- Quests for Ambarannon
add_building_action
{
        ["index"] = 63,
        ["action"] = function()
                if (AMBARANNON_QUEST == 0) then
                        if quest(ARTISAN_QUEST).status == QUEST_STATUS_UNTAKEN then
                                quest(ARTISAN_QUEST).status = QUEST_STATUS_TAKEN
                                msg_print("A mad artisan created some gargoyles.")
                                msg_print("However, now they have gone out of control and taken over.")
                                msg_print("a ruined cathedral.  Please destroy them.")
                                msg_print("And also, please cure the artisan of his madness.")

                                return TRUE, FALSE, TRUE
                        elseif (quest(ARTISAN_QUEST).status == QUEST_STATUS_COMPLETED) then
                                msg_print("Thank you for your help. Please accept this reward")
                                
                                -- Give fruits of life
                                local reward

                                reward = create_object(TV_FOOD, SV_FOOD_FRUIT_LIFE)
                                apply_magic(reward,1,FALSE,FALSE,FALSE)
                                reward.found = OBJ_FOUND_REWARD
                                inven_carry(reward, FALSE)

                                quest(ARTISAN_QUEST).status = QUEST_STATUS_REWARDED
                                -- Increment quest number to get next quest
                                AMBARANNON_QUEST = 1
                        elseif (quest(ARTISAN_QUEST).status == QUEST_STATUS_TAKEN) then
                                msg_print("Please destroy the gargoyles and cure the artisan")
                        end
                elseif (AMBARANNON_QUEST == 1) then
                        -- They are in the second Ambarannon quest now
                        if quest(SEA_QUEST).status == QUEST_STATUS_UNTAKEN then
                                quest(SEA_QUEST).status = QUEST_STATUS_TAKEN
                                msg_print("There is a blockade around the Hallows!")
                                msg_print("Various evil sea monsters have appeared in the coastal waters.")
                                msg_print("They are led by a hoard of Water Demons.")
                                msg_print("Please destroy them for us.")
                        
                                return TRUE, FALSE, TRUE
                        elseif (quest(SEA_QUEST).status == QUEST_STATUS_COMPLETED) then
                                msg_print("Thank you for your help.  Please accept this reward.")

                                -- Create the Golden Key of Ambarannon.
                                
                                local reward = create_artifact_(246)
                                inven_carry(reward, TRUE)
                                
                                quest(SEA_QUEST).status = QUEST_STATUS_REWARDED
                                -- Increment quest number to get next quest
                                AMBARANNON_QUEST = 2
                        elseif (quest(SEA_QUEST).status == QUEST_STATUS_TAKEN) then
                                msg_print("Please destroy the evil monsters!")
                        end
                elseif (AMBARANNON_QUEST > 1) then
                        msg_print("We don't have any more quests for you, sorry.")

                end
                return TRUE
        end,
}

CosmicGerbil/Building Action for Artisan quest (last edited 2006-02-06 14:21:35 by proxy-24)