NB
dúvida

Item Q Da Vocaçao

Por nbb147, 09 de ago. de 2012 em Scripts

script
52
3.8k
NewtonnotwenN
09 de agosto de 2012 às 15:54

function onUse(cid, item, fromPosition, itemEx, toPosition)

if getPlayerStorageValue(cid,1992) == 1 then

doCreatureSay(cid, "Você ja recebeu a nova vocaçao", TALKTYPE_ORANGE_1)

else if getPlayerLevel(cid) >= 20 then

doCreatureSay(cid, "você recebeu uma nova vocaçao!", TALKTYPE_ORANGE_1)

if getPlayerVocation(cid) == 1

doPlayerSetVocation(cid, 2)

end

doSendMagicEffect(fromPosition, 2)

doRemoveItem(item.uid)

setPlayerStorageValue(cid,1992,1)

return TRUE

else

doCreatureSay(cid, "Você deve ter level 20 ou mais para usar o Item!",TALKTYPE_ORANGE_1)

end

end

end

Obs: Não esquece do:

if getPlayerStorageValue(cid, 1992) ~= -1 then

doPlayerSetVocation(cid, getPlayerStorageValue(cid, 1992))

end

Editado Agosto 9 por Newtonnotwen

nbb147N
09 de agosto de 2012 às 16:07

@newton

erro:

 

 

 

[09/08/2012 16:06:43] [Error - LuaScriptInterface::loadFile] data/actions/scripts/vocation.lua:7: 'then' expected near 'doPlayerSetVocation'

[09/08/2012 16:06:43] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/vocation.lua)

[09/08/2012 16:06:43] data/actions/scripts/vocation.lua:7: 'then' expected near 'doPlayerSetVocation'

jhon992J
09 de agosto de 2012 às 16:10

no meu script, a vocation que vai virar é a promotion da vocação atual em que o player esta.

Ou seja, a promotion da vocação que esta dentro da variavel:

vocationid = {2,3},

SkyLighS
09 de agosto de 2012 às 16:12

arrumei o do newton

 

function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid,1992) == 1 then
doCreatureSay(cid, "Você ja recebeu a nova vocaçao", TALKTYPE_ORANGE_1)
else if getPlayerLevel(cid) >= 20 then
doCreatureSay(cid, "você recebeu uma nova vocaçao!", TALKTYPE_ORANGE_1)
if getPlayerVocation(cid) == 1 then
doPlayerSetVocation(cid,2)
end
doSendMagicEffect(fromPosition, 2)
doRemoveItem(item.uid)
setPlayerStorageValue(cid,1992,1)
return TRUE
else
doCreatureSay(cid, "Você deve ter level 20 ou mais para usar o Item!",TALKTYPE_ORANGE_1)
end
end
end

nbb147N
09 de agosto de 2012 às 16:13

@jhon

 

isso msm eu sei mais eu queria que virace uma voc q eu escolhece plz ajuda ae seu script foi o q chegou mais perto

Editado Agosto 9 por nbb147

SkyLighS
09 de agosto de 2012 às 16:16

@nbb147

 

o meu eu testei aki funciono map alissow 8.60 tenta ai

nbb147N
09 de agosto de 2012 às 16:18

@skyligh

 

nao deu quando dou logout a voc acaba saindo

SkyLighS
09 de agosto de 2012 às 16:25

editei o do jhon ver agr

 

function onUse(cid, item, fromPosition, itemEx, toPosition)  
local configs = {
   vocationid = {2,3}, -- id da vocação que pode usar o item, que quiser deixar apenas a 2 põe {2}.
   level = 20, -- lvl minimo para usar o item.
   voc = 1 -- id da vocation que o player vai virar
}
if doPlayerSetVocation(cid,configs.voc) and getPlayerVocation(cid,vocationid) then
   if getPlayerLevel(cid) >= configs.level then
    if getPlayerPromotionLevel(cid) < 1 then
	    setPlayerPromotionLevel(cid, 1)
	    doRemoveItem(item.uid, 1)
	    doPlayerSendTextMessage(cid, 19, "Você foi promovido para "..getPlayerVocation(cid)..".")
	    doSendMagicEffect(getPlayerPosition(cid), 29)
    else
	    doPlayerSendCancel(cid, "Voce ja é promoted.")
    end
   else
    doPlayerSendCancel(cid, "Voce precisa ser level " .. configs.level .. " ou maior para adiquirir a promotion.")
   end
else
   doPlayerSendCancel(cid, "Sua vocação não pode usar isso!")
end
return true
end

NewtonnotwenN
09 de agosto de 2012 às 16:26

Manda seu login.lua pra eu adicionar

if getPlayerStorageValue(cid, 1992) ~= -1 then

doPlayerSetVocation(cid, getPlayerStorageValue(cid, 1992))

end

jhon992J
09 de agosto de 2012 às 16:28

@nbb147, se a vocation não for promotion de nenhuma acho que vai funcionar, mais se for quando o player deslogar vai retroceder a vocação.

 

function onUse(cid, item, fromPosition, itemEx, toPosition)   
local configs = {
   vocationid = 5, -- id da vocação que vai virar.
   vocationNeed = {2,3}, -- id's das vocações que podem usar este item.
   level = 20 -- lvl minimo para usar o item.
}
if isInArray(vocationNeed, getPlayerVocation(cid)) then
   if getPlayerLevel(cid) >= configs.level then
    doPlayerSetVocation(cid, configs.vocationid)
    doRemoveItem(item.uid, 1)
       doPlayerSendTextMessage(cid, 19, "Você recebeu a vocação "..getPlayerVocation(cid)..".")
       doSendMagicEffect(getPlayerPosition(cid), 29)
   else
    doPlayerSendCancel(cid, "Você precisa ser level " .. configs.level .. " ou maior para adiquirir a vocação.")
   end
else
   doPlayerSendCancel(cid, "Sua vocação não pode usar isto!")
end
return true
end

nbb147N
09 de agosto de 2012 às 16:41

@jhon

cara nenhuma das voc estao transformando

NewtonnotwenN
09 de agosto de 2012 às 16:44

Usa o meu e me manda seu script do login.lua pra mim adicionar:

if getPlayerStorageValue(cid, 1992) ~= -1 then

doPlayerSetVocation(cid, getPlayerStorageValue(cid, 1992))

end

nbb147N
09 de agosto de 2012 às 16:49

ae o script:

 

 

 

local config = {

loginMessage = getConfigValue('loginMessage')

}

 

function onLogin(cid)

local loss = getConfigValue('deathLostPercent')

if(loss ~= nil) then

doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)

end

 

local accountManager = getPlayerAccountManager(cid)

if(accountManager == MANAGER_NONE) then

local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage

if(lastLogin > 0) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)

str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."

else

str = str .. " Please choose your outfit."

doPlayerSendOutfitWindow(cid)

end

 

doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)

elseif(accountManager == MANAGER_NAMELOCK) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")

elseif(accountManager == MANAGER_ACCOUNT) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")

else

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")

end

 

if(not isPlayerGhost(cid)) then

doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)

end

 

registerCreatureEvent(cid, "Mail")

registerCreatureEvent(cid, "GuildMotd")

 

registerCreatureEvent(cid, "killer")

registerCreatureEvent(cid, "Idle")

 

registerCreatureEvent(cid, "attackguild")

registerCreatureEvent(cid, "advance")

registerCreatureEvent(cid, "FimVip")

registerCreatureEvent(cid, "SkullCheck")

registerCreatureEvent(cid, "ReportBug")

 

registerCreatureEvent(cid, VipReceive)

registerCreatureEvent(cid, "PlayerKill")

registerCreatureEvent(cid, "LookTypes")

if (InitArenaScript ~= 0) then

InitArenaScript = 1

-- make arena rooms free

for i = 42300, 42309 do

setGlobalStorageValue(i, 0)

setGlobalStorageValue(i+100, 0)

end

end

-- if he did not make full arena 1 he must start from zero

if getPlayerStorageValue(cid, 42309) < 1 then

for i = 42300, 42309 do

setPlayerStorageValue(cid, i, 0)

setPlayerStorageValue(cid, 14755, -1)

end

end

-- if he did not make full arena 2 he must start from zero

if getPlayerStorageValue(cid, 42319) < 1 then

for i = 42310, 42319 do

setPlayerStorageValue(cid, i, 0)

end

end

-- if he did not make full arena 3 he must start from zero

if getPlayerStorageValue(cid, 42329) < 1 then

for i = 42320, 42329 do

setPlayerStorageValue(cid, i, 0)

end

end

if getPlayerStorageValue(cid, 42355) == -1 then

setPlayerStorageValue(cid, 42355, 0) -- did not arena level

end

setPlayerStorageValue(cid, 42350, 0) -- time to kick 0

setPlayerStorageValue(cid, 42352, 0) -- is not in arena

if getPlayerStorageValue(cid, 1992) ~= -1 then

doPlayerSetVocation(cid, getPlayerStorageValue(cid, 1992))

end

return true

end

NewtonnotwenN
10 de agosto de 2012 às 15:15

Eu quero o do login.lua que fica em data/creaturescripts/scripts/login.lua

jhon992J
10 de agosto de 2012 às 15:30

Eu quero o do login.lua que fica em data/creaturescripts/scripts/login.lua

 

Esse que o @nbb147 postou é o login.lua...