Forsaken13126
Scripter
All credits go to Godely i just fixed it up and make it workable for 0.3.6
First, Go to data/npc and make a new xml file called priest.xml and add this in there:
Second open up data/npc/scripts and make a new lua file and name it wedding.lua and add this into that:
Add this into your MySQL database :
how it works?
You now have a working NPC Marriage script for TFS 0.3.6 i have not tested it on any other TFS or releases so test at your own risk if u have any questions post back and ill help the best i can!! REP+++++ if i helped
All Credits Go To Godely
First, Go to data/npc and make a new xml file called priest.xml and add this in there:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Priest" script="wedding.lua" walkinterval="2000" floorchange="0">
<health now="800" max="800"/>
<look type="57" head="20" body="30" legs="40" feet="50"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|, Would you like to get married?"/>
</parameters>
</npc>
Second open up data/npc/scripts and make a new lua file and name it wedding.lua and add this into that:
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if msgcontains(msg, 'marry') or msgcontains(msg, 'marriage') then
if getPlayerStorageValue(cid,3066) == -1 then
selfSay('Would you like to marry?', cid)
talkState[talkUser] = 1
elseif getPlayerStorageValue(cid,3066) == 1 then
local fid = getPlayerGUID(cid)
local marrystatus = getOwnMarryStatus(fid)
if marrystatus ~= 0 then
local newpartner = getPlayerNameByGUID(marrystatus)
selfSay('Have you ever set a wedding date with{' .. newpartner .. '}, now I need to talk to your partner. you want{cancel}?', cid)
talkState[talkUser] = 5
else
setPlayerStorageValue(cid,3066,-1)
selfSay('Would you like to marry?', cid)
talkState[talkUser] = 1
end
elseif getPlayerStorageValue(cid,3066) == 2 then
selfSay('You are already married. If you want{divorce}, suffice it to say.', cid)
talkState[talkUser] = 0
end
elseif msgcontains(msg, 'divorce') then
if getPlayerStorageValue(cid,3066) == 2 then
selfSay('Are you sure you want to divorce your partner?', cid)
talkState[talkUser] = 6
else
selfSay('You are not married. Would you like to{marry}?', cid)
talkState[talkUser] = 0
end
end
if talkState[talkUser] == 1 then
if msgcontains(msg, 'yes') then
local fid = getPlayerGUID(cid)
local marrystatus = getMarryStatus(fid)
if marrystatus == FALSE then
selfSay('And what is the name of your future partner?', cid)
talkState[talkUser] = 2
else
local marryname = getPlayerNameByGUID(marrystatus)
selfSay('{' .. marryname .. '} marks the wedding date with you. Do you want to {continue} or {cancel the wedding?}', cid)
talkState[talkUser] = 4
end
end
elseif talkState[talkUser] == 2 then
local p = msg
local player = getPlayerName(cid)
local fid = getPlayerGUID(cid)
local sid = getPlayerGUIDByName(p)
if not sid or sid == 0 then
selfSay('There is no player with this name.', cid)
talkState[talkUser] = 0
elseif sid == fid then
selfSay('Do not worry, you will always be married to yourself, boy.', cid)
talkState[talkUser] = 0
else
local marrystatus = getMarryStatus(fid)
local pmarriage = getPlayerMarriage(sid)
local ownstatus = getOwnMarryStatus(cid)
if pmarriage == FALSE then
if marrystatus == FALSE then
if ownstatus == FALSE then
setPlayerStorageValue(cid,3066,1)
addMarryStatus(fid,sid)
selfSay('You just dial a marriage {' .. p .. '}.', cid)
talkState[talkUser] = 0
else
local partnername = getPlayerNameByGUID(ownstatus)
selfSay('{' .. p .. '} already marked the date of marriage {' .. partnername .. '}.', cid)
talkState[talkUser] = 0
end
else
local marryname = getPlayerNameByGUID(marrystatus)
selfSay('{' .. marryname .. '} marks the wedding date with you. You want to {continue} or {cancel the wedding?}', cid)
talkState[talkUser] = 4
end
else
local pname = getPlayerNameByGUID(pmarriage)
selfSay('Sorry, but {' .. p .. '} is married {' .. pname .. '}.', cid)
talkState[talkUser] = 0
end
end
elseif talkState[talkUser] == 4 then
if msgcontains(msg, 'continue') then
local fid = getPlayerGUID(cid)
local sid = getMarryStatus(fid)
local marryname = getPlayerNameByGUID(sid)
local pid = getPlayerByNameWildcard(marryname)
local tmf = getCreaturePosition(cid)
local tms = getCreaturePosition(pid)
local text = {'I love you ',' My love! "," My passion!'}
local chance1 = math.random(1,table.getn(text))
local chance2 = math.random(1,table.getn(text))
local dateFormat = "%A %d"..getMonthDayEnding(os.date("%d")).." %B %Y"
local ring = doPlayerAddItem(cid,10502,1)
local ring2 = doPlayerAddItem(pid,10502,1)
if isOnline(fid) == TRUE and isOnline(sid) == TRUE then
if getDistanceBetween(tmf, tms) <= 3 then
setPlayerStorageValue(cid,3066,2)
setPlayerStorageValue(pid,3066,2)
doCancelMarryStatus(fid)
doCancelMarryStatus(sid)
setPlayerPartner(cid,sid)
setPlayerPartner(pid,fid)
doPlayerAddOutfitId(cid,23,0)
doPlayerAddOutfitId(pid,23,0)
doItemSetAttribute(ring, "description", "" .. getCreatureName(cid) .. " & " .. getCreatureName(pid) .. " forever - married on " ..os.date(dateFormat).. ".")
doItemSetAttribute(ring2, "description", "" .. getCreatureName(cid) .. " & " .. getCreatureName(pid) .. " forever - married on " ..os.date(dateFormat).. ".")
doCreatureSay(cid, text[chance1], TALKTYPE_ORANGE_1)
doCreatureSay(pid, text[chance2], TALKTYPE_ORANGE_1)
doSendMagicEffect(tmf, 35)
doSendMagicEffect(tms, 35)
selfSay('Congratulations! By now, you can kiss it! Whenever you want this effect, just say {love}. You need to be close to your partner.', cid)
talkState[talkUser] = 0
else
selfSay('Your partner should be close to you so you can get married!', cid)
talkState[talkUser] = 0
end
else
selfSay('You and your new partner should be online at the same time.', cid)
talkState[talkUser] = 0
end
elseif msgcontains(msg, 'cancel') then
local fid = getPlayerGUID(cid)
local sid = getMarryStatus(fid)
local marryname = getPlayerNameByGUID(sid)
local pid = getPlayerByNameWildcard(marryname)
if isOnline(sid) == TRUE then
setPlayerStorageValue(pid,3066,-1)
end
doCancelMarryStatus(sid)
selfSay('You cancel your wedding date with {' .. marryname .. '}.', cid)
talkState[talkUser] = 0
end
elseif talkState[talkUser] == 5 then
if msgcontains(msg, 'cancel') or msgcontains(msg, 'yes') then
local fid = getPlayerGUID(cid)
setPlayerStorageValue(cid,3066,-1)
doCancelMarryStatus(fid)
talkState[talkUser] = 0
end
elseif talkState[talkUser] == 6 then
if msgcontains(msg, 'yes') then
local fid = getPlayerGUID(cid)
local sid = getPlayerPartner(cid)
local marryname = getPlayerNameByGUID(sid)
local pid = getPlayerByNameWildcard(marryname)
if (isOnline(fid) == TRUE and isOnline(sid) == TRUE) then
setPlayerStorageValue(cid,3066,-1)
setPlayerStorageValue(pid,3066,-1)
setPlayerPartner(cid,0)
setPlayerPartner(pid,0)
doPlayerAddOutfitId(cid,23,-1)
doPlayerAddOutfitId(pid,23,-1)
selfSay('You just divorcing your former partner.', cid)
talkState[talkUser] = 0
else
selfSay('You and your partner must be online at the same time.', cid)
talkState[talkUser] = 0
end
end
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Add this into your MySQL database :
Code:
ALTER TABLE `players` ADD `marrystatus` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `marriage` ;
how it works?
PLAYER1 goes to the NPC and start a conversation.
PLAYER1: Hi
PLAYER1: marry or he can say marriage
PLAYER1: yes
PLAYER1: NAME_OF_PLAYER2
Now, a "marry status" will be set to PLAYER1 with the ID of the PLAYER2. Now, the PLAYER2 go to the NPC and start a conversation:
PLAYER2: Hi
PLAYER2: marry
PLAYER2: yes
PLAYER2: proceed
FEATURES:
-You can get a wedding with another player
-You need 2 wedding rings to get a wedding
-After a wedding you get a wedding outfit, special description when onLook, information about your partner in acc maker and a wedding ring like in Rl tibia (playername & playername forever - married on date)
-You can get a divorce
-When you get a divorce you'll lose your wedding outfit (you must relog to loose it), you loose your special description on onLook and information in acc maker that you are a single.
You now have a working NPC Marriage script for TFS 0.3.6 i have not tested it on any other TFS or releases so test at your own risk if u have any questions post back and ill help the best i can!! REP+++++ if i helped
All Credits Go To Godely
Last edited: