DukeeH
Active Member
- Joined
- Dec 6, 2010
- Messages
- 550
- Solutions
- 3
- Reaction score
- 39
Hello guys, I'd like your help to fix two scripts...
A doll that adds skills/magic with !skill name (should add x skills)
Problem: it's adding too much skill (some ppl got 200+) and less than it should (8) for others.
Function: (cyko helped me a few years ago).
050-function.lua
Second script:
A ring that doubles your exp when equiped that has duration.
Problem: It's not going down (duration) or expiring.
items.xml
movements.xml
expring.lua
Thanks.
A doll that adds skills/magic with !skill name (should add x skills)
Problem: it's adding too much skill (some ppl got 200+) and less than it should (8) for others.
Code:
function onSay(cid, words, param)
local Skillsy = { ["fist"]={SKILL_FIST}, ["club"]={SKILL_CLUB}, ["sword"]={SKILL_SWORD}, ["axe"]={SKILL_AXE}, ["distance"]={SKILL_DISTANCE}, ["shield"]={SKILL_SHIELD}, ["fishing"]={SKILL_FISHING}, ["magic"]={SKILL__MAGLEVEL} }
local msg = {"Escolha um skill (!skill nome), Opções de skill: fist, club, sword, axe, distance, shield, fishing, magic!", "Seus skills foram adicionados!", "Precisa de uma skill doll, visite nosso shop!", "Você só pode usar 3 skill dolls por character!"}
local param = string.lower(param)
local storage = 490289 -- storageID to use.
if(param ~= "" and Skillsy[param]) then
if(getPlayerItemCount(cid, 165) > 0) then
if getPlayerStorageValue(cid, storage) < 2 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg[2])
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS)
doPlayerAddSkill(cid, Skillsy[param][1], 8)
doPlayerRemoveItem(cid, 165, 1)
setPlayerStorageValue(cid, storage, (getPlayerStorageValue(cid, storage)+1))
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg[4])
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg[3])
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg[1])
end
return true
end
Function: (cyko helped me a few years ago).
050-function.lua
Code:
function doPlayerAddMagLevel(cid, amount)
for i = 1, amount do
doPlayerAddSpentMana(cid, math.ceil((getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true) + 1) - getPlayerSpentMana(cid)) / getConfigInfo('rateMagic')))
end
return true
end
function doPlayerAddSkill(cid, skill, amount, round)
if(skill == SKILL__LEVEL) then
return doPlayerAddLevel(cid, amount, round)
elseif(skill == SKILL__MAGLEVEL) then
return doPlayerAddMagLevel(cid, amount)
end
return doPlayerAddSkillTry(cid, skill, math.ceil((getPlayerRequiredSkillTries(cid, skill, getPlayerSkillLevel(cid, skill) + 1) - getPlayerSkillTries(cid, skill)) / getConfigInfo('rateSkill')))
end
Second script:
A ring that doubles your exp when equiped that has duration.
Problem: It's not going down (duration) or expiring.
items.xml
Code:
<item id="164" article="a" name="experience ring">
<attribute key="weight" value="80" />
<attribute key="slotType" value="ring" />
<attribute key="duration" value="3600" />
<attribute key="showduration" value="1" />
<attribute key="description" value="Doubles your experience when equiped." />
</item>
<item id="166" article="a" name="experience ring">
<attribute key="weight" value="80" />
<attribute key="slotType" value="ring" />
<attribute key="stopduration" value="1" />
<attribute key="showduration" value="1" />
<attribute key="description" value="Doubles your experience when equiped." />
</item>
movements.xml
Code:
<movevent type="Equip" itemid="164" slot="ring" event="function" value="onEquipItem"/>
<movevent type="Equip" itemid="166" slot="ring" event="script" value="expring.lua"/>
<movevent type="DeEquip" itemid="164" slot="ring" event="script" value="expring.lua"/>
expring.lua
Code:
local config = {
rate = 2.0, -- 2.0 = 2x faster than normal.
un_equip = 166, -- Item ID of the UN-Equipped ring.
equip = 164 -- Item ID of the Equipped ring.
}
function onDeEquip(cid, item, slot)
doPlayerSetExperienceRate(cid, 1.0)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your extra experience rate has ended.")
doTransformItem(item.uid, config.un_equip)
return true
end
function onEquip(cid, item, slot)
if getConfigValue("experienceStages") == "yes" then
doPlayerSetExperienceRate(cid, getExperienceStage(getPlayerLevel(cid))*2)
else
doPlayerSetExperienceRate(cid, getConfigValue("rateExperience")*2)
end
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your extra experience rate has been activated! It is now: " .. config.rate .. "x doubled your former experience rate.")
doTransformItem(item.uid, config.equip)
doDecayItem(item.uid)
return true
end
Thanks.
Last edited: