• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TFS 1.X+ CONVERT SCRIPT TFS-1.3

jel

Member
Joined
Mar 22, 2014
Messages
302
Reaction score
12
help me convert these gem system to tfs 1.3?

below the codes:

function onUse(cid, item, frompos, item2, topos)

if (isInArray({4, 8, 12}, getPlayerVocation(cid))) then
AtiveGem(cid, item)
elseif getPlayerStorageValue(cid, 45783) > 0 then
doPlayerSendCancel(cid, "You are already under the influence of a magic gem.")
end
return true
end

creaturescripts
function onThink(cid)
if not isCreature(cid) then return LUA_ERROR end
local gemid = getPlayerStorageValue(cid, 71473)
if (getPlayerStorageValue(cid, 45783) > 0) and (checkGemTimeFinish(cid, gemid)) then
deAtiveGem(cid, gemid)
doRemoveCondition(cid, CONDITION_ATTRIBUTES)
end
return true
end

function onLogin(cid)
local gemid = getPlayerStorageValue(cid, 71473)

if (getPlayerStorageValue(cid, 45783) > 0) and (checkGemTimeFinish(cid, gemid)) then
deAtiveGem(cid, gemid)
end

if (gemid > 0) and (not checkGemTimeFinish(cid, gemid)) then
local pedra = pedras_add[gemid]

if not (pedra) then
return true
end

local skills = pedra.skills
doAddCondition(cid, pedras_add_c[gemid])
doPlayerSendTextMessage(cid, 27, "The effect of the magic gem was resumed.")

doPlayerSetExperienceRate(cid, pedra.xp)

registerCreatureEvent(cid, "EffectCheck")
sendGemEffect(cid, gemid)
end

registerCreatureEvent(cid, "EffectDeath")
return true
end
function getPrefixGEMs(val) -- By MaXwEllDeN
return (val > 1) and "s" or ""
end

pedras_add = {

[8299] = { -- Pedra Preta
skills = {
[0] = 10, -- Fist Fighting
[1] = 10, -- Club Fighting
[2] = 10, -- Sword Fighting
[3] = 10, -- Axe Fighting
[4] = 0, -- Distance Fighting
[5] = 10, -- Shielding
[6] = 0, -- Magic Level
},
xp = 1, -- Ex, 2 x o Xp do serv
time = 30,
color = {50, 50, 50, 50},
},
[8303] = { -- Pedra Rosa
skills = {
[0] = 0, -- Fist Fighting
[1] = 0, -- Club Fighting
[2] = 0, -- Sword Fighting
[3] = 0, -- Axe Fighting
[4] = 10, -- Distance Fighting
[5] = 10, -- Shielding
[6] = 0, -- Magic Level
},
xp = 1, -- Ex, 2 x o Xp do serv
time = 30,
color = {180, 180, 180},
},
[8301] = { -- Pedra Amarela
skills = {
[0] = 0, -- Fist Fighting
[1] = 0, -- Club Fighting
[2] = 0, -- Sword Fighting
[3] = 0, -- Axe Fighting
[4] = 0, -- Distance Fighting
[5] = 10, -- Shielding
[6] = 10, -- Magic Level
},
xp = 1, -- Ex, 2 x o Xp do serv
time = 30,
color = {210, 210, 210},
},
[8302] = { -- Pedra Azul
skills = {
[0] = 0, -- Fist Fighting
[1] = 0, -- Club Fighting
[2] = 0, -- Sword Fighting
[3] = 0, -- Axe Fighting
[4] = 0, -- Distance Fighting
[5] = 10, -- Shielding
[6] = 10, -- Magic Level
},
xp = 1, -- Ex, 2 x o Xp do serv
time = 30,
color = {35, 35, 35, 35},
},

}

pedras_add_c = {
[8299] = createConditionObject(CONDITION_ATTRIBUTES),
[8303] = createConditionObject(CONDITION_ATTRIBUTES),
[8301] = createConditionObject(CONDITION_ATTRIBUTES),
[8302] = createConditionObject(CONDITION_ATTRIBUTES)

}

local conditions = {CONDITION_PARAM_SKILL_FIST, CONDITION_PARAM_SKILL_CLUB, CONDITION_PARAM_SKILL_SWORD,CONDITION_PARAM_SKILL_AXE, CONDITION_PARAM_SKILL_DISTANCE, CONDITION_PARAM_SKILL_SHIELD, CONDITION_PARAM_STAT_MAGICPOINTS}

for a, b in pairs(pedras_add_c) do
setConditionParam(pedras_add_c[a], CONDITION_PARAM_TICKS, pedras_add[a].time*60*1000)
for c = 0, 6 do
setConditionParam(pedras_add_c[a], conditions[c + 1], pedras_add[a].skills[c])
end
end

function sendGemEffect(uid, itemid)
if (isCreature(uid)) then
local pedra = pedras_add[itemid]
local msgs = {"´ . ,", ". ´ ,", " . ,", ", ."}
if (getPlayerStorageValue(uid, 45783) > 0) then
addEvent(sendGemEffect, 575, uid, itemid)
doSendAnimatedText(getThingPos(uid), msgs[math.random(#msgs)], pedra.color[math.random(#pedra.color)])
end
end
return true
end


function isGemActivated(cid)
return (getPlayerStorageValue(cid, gems.storage[getPlayerVocation(cid)]) > 0) and true or false
end

function checkGemTimeFinish(uid, gemid)
local timpo = (getPlayerStorageValue(uid, 45783)-os.time())*(-1)
return (timpo >= pedras_add[gemid].time*60) and true or false
end

function deAtiveGem(uid, gemid)
local pedra = pedras_add[gemid]
local skills = pedra.skills

for a = 0, #skills-1 do
doPlayerAddSkill(uid, a, -skills[a])
end

doRemoveCondition(uid, pedras_add_c[gemid])
doPlayerSetExperienceRate(uid, 1)
setPlayerStorageValue(uid, 45783, -1)
setPlayerStorageValue(uid, 71473, -1)
doPlayerSendTextMessage(uid, 27, "The effect of his gem is over.")
return true
end

function AtiveGem(uid, item)
local pedra = pedras_add[item.itemid]

if not (pedra) then
return false
end

local skills = pedra.skills
doAddCondition(uid, pedras_add_c[item.itemid])
doPlayerSendTextMessage(uid, 27, "You are under the effect of the magic gem, and the effect of it will last for ".. pedra.time .. " minute".. getPrefixGEMs(pedra.time) .. ".")
setPlayerStorageValue(uid, 71473, item.itemid)
setPlayerStorageValue(uid, 45783, os.time())

sendGemEffect(uid, item.itemid)
doPlayerSetExperienceRate(uid, pedra.xp)

registerCreatureEvent(uid, "EffectCheck")
doRemoveItem(item.uid, 1)
return true
end
 
tested, does not work
tell us what errors you got, at a first glance there are only two functions in your script that tfs 1.3 doesn't have: doPlayerSetExperienceRate and doSendAnimatedText, but first one you can achieve by editing the player onGainExperience event, and the second one you can display a orange text instead
 
tell us what errors you got, at a first glance there are only two functions in your script that tfs 1.3 doesn't have: doPlayerSetExperienceRate and doSendAnimatedText, but first one you can achieve by editing the player onGainExperience event, and the second one you can display a orange text instead
I will check this
 
Back
Top