Hi all as I wrote days ago i wanted to redo the script that i found here:
http://otland.net/threads/tfs-1-0-marriage-system.206206/ coz it was lacking some stuff, so basically i added the following stuff:
1) Wedding Outfits when u give the wedding outfit box
2) Instead of a common priest, I used Lynda (priest of thais)
3) I used the common rite words for the celebration, they can be heard by all the attendant to the marriage, to make it more roleplay (u can adjust the delay of the sentences)
4) When both of the players accepted to be married, u can celebrate when all ur friends (or ur soulmate) is online and in the 'church'.
I give the script to the admin of server where I play (i'm just a player, but also a programmer ) but i decided to share with u, also to have feedback, coz since it's my first script might be buggy, I tested in local and also in the main server, but u know...the more we are...
Installation:
DB Side - SQL Query:
Server Side - global.lua:
Server Side - compat.lua:
Server Side - On events/scripts/player.lua, add the following piece of code after the local description variable is initialized in the method Player: onLook.
end of part 1.
http://otland.net/threads/tfs-1-0-marriage-system.206206/ coz it was lacking some stuff, so basically i added the following stuff:
1) Wedding Outfits when u give the wedding outfit box
2) Instead of a common priest, I used Lynda (priest of thais)
3) I used the common rite words for the celebration, they can be heard by all the attendant to the marriage, to make it more roleplay (u can adjust the delay of the sentences)
4) When both of the players accepted to be married, u can celebrate when all ur friends (or ur soulmate) is online and in the 'church'.
I give the script to the admin of server where I play (i'm just a player, but also a programmer ) but i decided to share with u, also to have feedback, coz since it's my first script might be buggy, I tested in local and also in the main server, but u know...the more we are...
Installation:
DB Side - SQL Query:
Code:
ALTER TABLE `players` ADD `marriage_status` tinyint(1) NOT NULL DEFAULT 0, ADD `marriage_spouse` int(11) NOT NULL DEFAULT -1
Server Side - global.lua:
Code:
PROPOSED_STATUS = 1
MARRIED_STATUS = 2
PROPACCEPT_STATUS = 3
LOOK_MARRIAGE_DESCR = TRUE
ITEM_WEDDING_RING = 2121
ITEM_ENGRAVED_WEDDING_RING = 10502
function getPlayerSpouse(id)
local resultQuery = db.storeQuery("SELECT `marriage_spouse` FROM `players` WHERE `id` = " .. db.escapeString(id))
if resultQuery ~= false then
local ret = result.getDataInt(resultQuery, "marriage_spouse")
result.free(resultQuery)
return ret
end
return -1
end
function setPlayerSpouse(id, val)
db.query("UPDATE `players` SET `marriage_spouse` = " .. val .. " WHERE `id` = " .. id)
end
function getPlayerMarriageStatus(id)
local resultQuery = db.storeQuery("SELECT `marriage_status` FROM `players` WHERE `id` = " .. db.escapeString(id))
if resultQuery ~= false then
local ret = result.getDataInt(resultQuery, "marriage_status")
result.free(resultQuery)
return ret
end
return -1
end
function setPlayerMarriageStatus(id, val)
db.query("UPDATE `players` SET `marriage_status` = " .. val .. " WHERE `id` = " .. id)
end
function Player:getMarriageDescription(thing)
local descr = ""
if getPlayerMarriageStatus(thing:getGuid()) == MARRIED_STATUS then
playerSpouse = getPlayerSpouse(thing:getGuid())
if self == thing then
descr = descr .. " You are "
elseif thing:getSex() == PLAYERSEX_FEMALE then
descr = descr .. " She is "
else
descr = descr .. " He is "
end
descr = descr .. "married to " .. getPlayerNameById(playerSpouse) .. '.'
end
return descr
end
-- The following 2 functions can be used for delayed shouted text
function say(param)
selfSay(text)
doCreatureSay(param.cid, param.text, 1)
end
function delayedSay(text, delay)
local delay = delay or 0
local cid = getNpcCid()
addEvent(say, delay, {cid = cid, text = text})
end
Server Side - compat.lua:
Code:
function getPlayerNameById(id)
local resultName = db.storeQuery("SELECT `name` FROM `players` WHERE `id` = " .. db.escapeString(id))
if resultName ~= false then
local name = result.getDataString(resultName, "name")
result.free(resultName)
return name
end
return 0
end
Server Side - On events/scripts/player.lua, add the following piece of code after the local description variable is initialized in the method Player: onLook.
Code:
if LOOK_MARRIAGE_DESCR and thing:isCreature() then
if thing:isPlayer() then
description = description .. self:getMarriageDescription(thing)
end
end
end of part 1.