quests = {} questTargets = {} questCounter = 0 maxTargets = 10 currentQuest = 0 pointerImage = 0 pointerSprite = 0 mouseOn = 0 haveBuiltQuests = 0 questBuildDelay = 0 --[[ Quest modes: inactive offer active returning handingIn complete --]] function killquests_init(e) pointerImage = LoadImage ( "stuff\\pointer.png" ) pointerSprite = CreateSprite ( pointerImage ) SetSpriteSize ( pointerSprite , 5 , -1 ) SetSpriteOffset ( pointerSprite , 2, 0) end function killquests_main(e) if haveBuiltQuests == 0 then questBuildDelay = questBuildDelay + 1 if questBuildDelay > 1 then haveBuiltQuests = 1 quest = newQuest(39,"Eyy,Listen pussy i want you to help me escape this fucken *drunk* town." , "Go to the park it's on the right handside,and kill the Dark Lords." , "The town mates will help you they are friendly,But take my gun outside incase they are drunk" , "Finally,i can leave..but you can't so listen" , "Find a real gun for boys near the park and go to the opposite side of the park", "Kill those bandits one with luncher, and come back to finish the level.") addQuestTarget(quest,13,44,21) end end if mouseOn == 1 then SetSpritePosition ( pointerSprite , g_MouseX , g_MouseY ) else SetSpritePosition ( pointerSprite , 200 , 200 ) end if currentQuest > 0 then checkQuest() end if currentQuest == 0 or quests[currentQuest]['mode'] == "returning" then for c = 1, questCounter do if quests[c]['mode'] == "inactive" or quests[c]['mode'] == "returning" then if GetPlayerDistance(quests[c]['giver']) < 125 then Prompt ( "Press E To talk") RotateToPlayer(quests[c]['giver']) if g_KeyPressE == 1 then if quests[c]['mode'] == "inactive" then quests[c]['mode'] = "offer" else quests[c]['mode'] = "handingIn" end currentQuest = 0 ActivateMouse() mouseOn = 1 end end elseif quests[c]['mode'] == "offer" then HideHuds() SetPlayerWeapons(0) Panel(25,40,75,60) TextCenterOnXColor(50,45,1,quests[c]['text1'],100,255,100) TextCenterOnXColor(50,50,1,quests[c]['text2'],100,255,100) TextCenterOnXColor(50,55,1,quests[c]['text3'],100,255,100) Panel(30,60,40,70) Panel(60,60,70,70) buttonOver = 0 if g_MouseX > 30 and g_MouseX < 40 and g_MouseY > 60 and g_MouseY < 70 then TextCenterOnXColor(35,65,1,"Accept",255,255,0) buttonOver = 1 else TextCenterOnXColor(35,65,1,"Accept",150,150,0) end if g_MouseX > 60 and g_MouseX < 70 and g_MouseY > 60 and g_MouseY < 70 then TextCenterOnXColor(65,65,1,"Decline",255,0,0) buttonOver = 2 else TextCenterOnXColor(65,65,1,"Decline",150,0,0) end if g_MouseClick == 1 then ShowHuds() SetPlayerWeapons(1) if buttonOver == 1 then quests[c]['mode'] = "active" DeactivateMouse() mouseOn = 0 currentQuest = c end if buttonOver == 2 then quests[c]['mode'] = "inactive" DeactivateMouse() mouseOn = 0 end end elseif quests[c]['mode'] == "handingIn" then HideHuds() SetPlayerWeapons(0) currentQuest = 0 Panel(25,40,75,60) TextCenterOnXColor(50,45,1,quests[c]['text4'],100,255,100) TextCenterOnXColor(50,50,1,quests[c]['text5'],100,255,100) TextCenterOnXColor(50,55,1,quests[c]['text6'],100,255,100) Panel(45,60,55,70) buttonOver = 0 if g_MouseX > 45 and g_MouseX < 55 and g_MouseY > 60 and g_MouseY < 70 then TextCenterOnXColor(50,65,1,"Complete",255,255,0) buttonOver = 1 else TextCenterOnXColor(50,65,1,"Complete",150,150,0) end if g_MouseClick == 1 then ShowHuds() SetPlayerWeapons(1) if buttonOver == 1 then quests[c]['mode'] = "complete" DeactivateMouse() mouseOn = 0 end end end end end end function checkQuest() count = 0 for c = 1, maxTargets do if questTargets[currentQuest][c] ~= nil then if g_Entity[questTargets[currentQuest][c]]['health'] > 0 then count = count + 1 end end end Panel ( 5 , 5 , 25 , 15) if count == 0 then TextCenterOnXColor(15,10,1,"Return to quest giver",255,255,0) if quests[currentQuest]['mode'] == "active" then quests[currentQuest]['mode'] = "returning" end else TextCenterOnXColor(15,10,1, count .. " targets remain",255,100,100) end end function newQuest( questGiver , text1, text2, text3, text4 , text5, text6) questCounter = questCounter + 1 quests[questCounter] = {} quests[questCounter]['mode'] = "inactive" quests[questCounter]['giver'] = questGiver quests[questCounter]['text1'] = text1 quests[questCounter]['text2'] = text2 quests[questCounter]['text3'] = text3 quests[questCounter]['text4'] = text4 quests[questCounter]['text5'] = text5 quests[questCounter]['text6'] = text6 return questCounter end function addQuestTarget(questID , targetID) if questTargets[questID] == nil then questTargets[questID] = {} end for c = 1, maxTargets do if questTargets[questID][c] == nil then questTargets[questID][c] = targetID return end end end function setActiveQuest(questID) end function setActiveQuestMode(questID) end