Postado Janeiro 17, 2015 10 anos Eu estou utilizando o sistema de reset do Whitewolf, mas eu modifiquei um pouco. Nada de mais. --[[script made 100% by Nogard and Night Wolf. You can feel free to edit anything you want, but don't remove the credits]] local config = { minlevel = 700000, --- level inical para prestigear price = 0, --- preço inicial para prestigear newlevel = 8, --- level após prestige priceByprestige = 0, --- preço acrescentado por prestige percent = 100, ---- porcentagem da vida/mana que você terá ao prestigear (em relação à sua antiga vida total) maxprestiges = 10000000, levelbyprestige = 0 --- quanto de level vai precisar a mais no próximo prestige } --- end config function getprestiges(uid) prestiges = getPlayerStorageValue(uid, 378378) if prestiges < 0 then prestiges = 0 end return prestiges end 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 function addprestige(cid) if(npcHandler:isFocused(cid)) then npcHandler:releaseFocus(cid) end talkState[talkUser] = 0 prestiges = getprestiges(cid) setPlayerStorageValue(cid, 378378, prestiges+1) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) local hp = getCreatureMaxHealth(cid) local prestigehp = hp*(config.percent/100) setCreatureMaxHealth(cid, prestigehp) local differencehp = (hp - prestigehp) doCreatureAddHealth(cid, -differencehp) local mana = getCreatureMaxMana(cid) local prestigemana = mana*(config.percent/100) setCreatureMaxMana(cid, prestigemana) local differencemana = (mana - prestigemana) doCreatureAddMana(cid, -differencemana) doRemoveCreature(cid) local description = prestiges+1 db.executeQuery("UPDATE `players` SET `description` = ' [prestige: "..description.."]' WHERE `players`.`id`= ".. playerid .."") db.executeQuery("UPDATE `players` SET `level`="..config.newlevel..",`experience`= 0 WHERE `players`.`id`= ".. playerid .."") return true end local newPrice = config.price + (getprestiges(cid) * config.priceByprestige) local newminlevel = config.minlevel + (getprestiges(cid) * config.levelbyprestige) if msgcontains(msg, 'prestige') then if getprestiges(cid) < config.maxprestiges then selfSay('You want to prestige your character? ', cid) talkState[talkUser] = 1 else selfSay('You already reached the maximum prestige level!', cid) end elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if getPlayerMoney(cid) < newPrice then selfSay('Its necessary to have at least '..newPrice..' gp\'s for prestigeing!', cid) elseif getPlayerLevel(cid) < newminlevel then selfSay('The minimum level for prestigeing is '..newminlevel..'!', cid) else doPlayerRemoveMoney(cid,newPrice) playerid = getPlayerGUID(cid) addEvent(function() if isPlayer(cid) then addprestige(cid) end end, 1000) local number = getprestiges(cid)+1 local msg ="---[prestige: "..number.."]-- You have prestigeed! You'll be disconnected in 1 seconds." doPlayerPopupFYI(cid, msg) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end talkState[talkUser] = 0 elseif(msgcontains(msg, 'no')) and isInArray({1}, talkState[talkUser]) == TRUE then talkState[talkUser] = 0 npcHandler:releaseFocus(cid) selfSay('Ok.', cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) O que eu queria é o seguinte. Quando o player der look em uma pessoa com Prestiges aparecer: [Prestiges: X] Exemplo: You see yourself. You are a elite knight. [Prestiges: 0] You see GoTheHell (Level 20). He is a elite knight. [Prestiges: 0] Além disso queria que dependendo da quantidade de prestiges eu possa colocar um efeito que fique saindo do player. Por exemplo: Player tem 1 prestige. Vai sair um efeito X escrito Prestiged. Player tem 10 prestiges. Vai sair um efeito X escito Master. E assim vai.. Editado Janeiro 17, 2015 10 anos por GoTheHell (veja o histórico de edições) Quer aprender a mapear? Discord: Natan#6301
Postado Janeiro 17, 2015 10 anos Quando o player der look em uma pessoa com Prestiges aparecer: [Prestiges: X] E você já não adicionou a descrição ao player? db.executeQuery("UPDATE `players` SET `description` = ' [prestige: "..description.."]' WHERE `players`.`id`= ".. playerid .."") Enquanto ao efeito e o texto, tente: checkprestige.lua (data\creaturescripts\scripts): local t = { [1] = {text = 'Prestiged', effect = 11}, -- [prestiges] = {text = 'textToSend', effect = magicEffectNumber} [10] = {text = 'Master', effect = 12}, [15] = {text = 'King', effect = 13} } function checkPrestige(cid) local interval = 2 -- seconds local p = t[getPlayerStorageValue(cid, 378378)] if p then doSendAnimatedText(getThingPos(cid), p.text, math.random(0, 255)) doSendMagicEffect(getThingPos(cid), p.effect) addEvent(function() if isPlayer(cid) then checkPrestige(cid) end end, interval * 1000) end return true end function onLogin(cid) return checkPrestige(cid) and true end Tag - creaturescripts.xml (data\creaturescripts): <event type="login" name="checkPrestige" event="script" value="checkprestige.lua"/> PS: com esse callback, não se registra creature event. The corrupt fear us. The honest support us. The heroic join us.
Postado Janeiro 18, 2015 10 anos Autor Em relação ao look no player. Quando o player da look em si mesmo: You see yourself. You are a elite knight Quando outro player da look: You see GoTheHell [Reset: 2] (Level 20). He is a elite knight. Quero que fique depois do level e vocação, além de aparecer para o próprio player. You see yourself. You are a elite knight. [Prestiges: 2] You see GoTheHell (Level 20). He is a elite knight. [Prestiges: 2] ---- O script de effect no player não funcionou. Não aparece nenhum erro. Editado Janeiro 18, 2015 10 anos por GoTheHell (veja o histórico de edições) Quer aprender a mapear? Discord: Natan#6301
Postado Janeiro 18, 2015 10 anos O script de effect no player não funcionou. Não aparece nenhum erro. Testei agora e executou perfeitamente. Fez tudo correto e NÃO registrou o creature event em login.lua? Em relação ao look no player. onlook.lua (data\creaturescripts\scripts): function onLook(cid, thing, position, lookDistance) if isPlayer(thing.uid) and thing.uid ~= cid then doPlayerSetSpecialDescription(thing.uid,'[Prestiges: '..getPlayerStorageValue(thing.uid, 378378)..']') return true elseif thing.uid == cid then doPlayerSetSpecialDescription(cid,'[Prestiges: '..getPlayerStorageValue(cid, 378378)..']') local string = 'You see yourself.' if getPlayerFlagValue(cid, PLAYERFLAG_SHOWGROUPINSTEADOFVOCATION) then string = string..' You are '.. getPlayerGroupName(cid) ..'.' elseif getPlayerVocation(cid) ~= 0 then string = string..' You are '.. getPlayerVocationName(cid) ..'.' else string = string..' You have no vocation.' end string = string..getPlayerSpecialDescription(cid)..'' if getPlayerNameByGUID(getPlayerPartner(cid), false, false) ~= nil then string = string..' You are '.. (getPlayerSex(cid) == 0 and 'wife' or 'husband') ..' of '.. getPlayerNameByGUID(getPlayerPartner(cid)) ..'.' end if getPlayerGuildId(cid) > 0 then string = string..' You are ' .. (getPlayerGuildRank(cid) == '' and 'a member' or getPlayerGuildRank(cid)) ..' of the '.. getPlayerGuildName(cid) string = getPlayerGuildNick(cid) ~= '' and string..' ('.. getPlayerGuildNick(cid) ..').' or string..'.' end if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEECREATUREDETAILS) then string = string..'nHealth: ['.. getCreatureHealth(cid) ..' / '.. getCreatureMaxHealth(cid) ..'], Mana: ['.. getCreatureMana(cid) ..' / '.. getCreatureMaxMana(cid) ..'].' string = string..'nIP: '.. doConvertIntegerToIp(getPlayerIp(cid)) ..'.' end if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEEPOSITION) then string = string..'nPosition: [X:'.. position.x..'] [Y:'.. position.y..'] [Z:'.. position.z..'].' end doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, string) return false end return true end Tag - creaturescripts.xml (data\creaturescripts): <event type="look" name="onLook" event="script" value="onlook.lua"/> Esse creature event você registra, em login.lua: registerCreatureEvent(cid, "onLook") The corrupt fear us. The honest support us. The heroic join us.
Postado Janeiro 18, 2015 10 anos Autor Testei agora e executou perfeitamente. Fez tudo correto e NÃO registrou o creature event em login.lua? Eu coloquei tudo certo e não registrei no login.lua. -- O look ficou perfeito. Quer aprender a mapear? Discord: Natan#6301
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.