Fabi Marzan
Well-Known Member
- Joined
- Aug 31, 2020
- Messages
- 135
- Solutions
- 6
- Reaction score
- 67
Hello friends, I was trying to create a spells where when you reach a certain level, change spells, that is, effect.
In this case it is a Buff that when reaching level 200 changes to another effect.
VERSION: OTX2
Images:
LEVEL 0-200
Upon reaching level 200, switch to this effect.
LEVEL 200
The idea is how it is, the spell has a storage that would be to use the level 200, and to obtain that storage you need to be 200 obvious, in which you would have to add it to creatuscripts.
That would be when you reach level 200 which gives you storage 5000...ok, but now to put it on the spell, you can't use the level 200 buff until you have that storage.
This is the Buff scripts:
Although I add these scripts, it continues to use the two effects at the same time, I don't know if that works
In the end it worked for me, but the problem is that I use both effects at the same time, I just want to use level 200.
In this case it is a Buff that when reaching level 200 changes to another effect.
VERSION: OTX2
Images:
LEVEL 0-200
Upon reaching level 200, switch to this effect.
LEVEL 200
The idea is how it is, the spell has a storage that would be to use the level 200, and to obtain that storage you need to be 200 obvious, in which you would have to add it to creatuscripts.
Lua:
function onAdvance(cid, skill, oldLevel, newLevel)
if skill == SKILL__LEVEL and newLevel == 200 then
doCreatureSetStorage(cid, 5000, 1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You got some storage.")
end
return true
end
That would be when you reach level 200 which gives you storage 5000...ok, but now to put it on the spell, you can't use the level 200 buff until you have that storage.
This is the Buff scripts:
Code:
local tempo = 30 -- tempo em segundos.
local effect = {200} -- effect no player, caso queira apenas 1, basta remover os outros numeros.
local ml = 10 -- quantos ira aumentar o skill de ML
local skillfist = 0 -- quantos ira aumentar o skill de Fist
local skillsword = 0 -- quantos ira aumentar o skill de Sword
local skillaxe = 10 -- quantos ira aumentar o skill de Axe
local skilldistance = 0 -- quantos ira aumentar o skill de Distance
local health = 0 -- A cada 1 segundo quantos aumentar de vida
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, tempo*1000)
setConditionParam(condition, CONDITION_PARAM_STAT_MAGICLEVEL, ml)
setConditionParam(condition, CONDITION_PARAM_SKILL_FIST, skillfist)
setConditionParam(condition, CONDITION_PARAM_SKILL_SWORD, skillsword)
setConditionParam(condition, CONDITION_PARAM_SKILL_AXE, skillaxe)
setConditionParam(condition, CONDITION_PARAM_SKILL_CLUB, skillclub)
setConditionParam(condition, CONDITION_PARAM_SKILL_DISTANCE, skilldistance)
setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, skillshield)
setConditionParam(condition, CONDITION_PARAM_OUTFIT, outfit)
setCombatCondition(combat, condition)
local condition = createConditionObject(CONDITION_REGENERATION)
setConditionParam(condition, CONDITION_PARAM_SUBID, 1)
setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)
setConditionParam(condition, CONDITION_PARAM_TICKS, tempo*1000)
setConditionParam(condition, CONDITION_PARAM_HEALTHGAIN, health)
setConditionParam(condition, CONDITION_PARAM_HEALTHTICKS, 1000)
setCombatCondition(combat, condition)
function magicEffect3(tempo2,tempo3,cid)
if (isCreature(cid)) then
if getPlayerStorageValue(cid, 1500) > 0 and getCreatureCondition(cid, CONDITION_REGENERATION, 1) then
for i=1, #effect do
local position = {x=getPlayerPosition(cid).x, y=getPlayerPosition(cid).y, z=getPlayerPosition(cid).z}
doSendMagicEffect(position, effect[i])
-- parte modificada
local summons = getCreatureSummons(cid)
if #summons > 0 then
for k = 1, #summons do
local pos = getCreaturePosition(summons[k])
local positions = {x = pos.x, y = pos.y, z = pos.z}
doSendMagicEffect(positions, effect[i])
end
end
-- fim da parte modificada
end
end
end
end
function onCastSpell(cid, var)
local position = {x=getPlayerPosition(cid).x, y=getPlayerPosition(cid).y, z=getPlayerPosition(cid).z}
if getPlayerStorageValue(cid, 1500) ~= 1 or getCreatureCondition(cid, CONDITION_REGENERATION, 1) == false then
doCombat(cid, combat, var)
tempo2 = 0
while (tempo2 ~= (tempo*1000)) do
addEvent(magicEffect3, tempo2, tempo2, tempo*1000, cid)
tempo2 = tempo2 + 1500
end
setPlayerStorageValue(cid, 1500,1) -- storage verifica transformado, quando = 1 player esta transformado.
doCreatureSay(cid, "Kekkei Genkai!", TALKTYPE_ORANGE_1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "( Buff ) activado por "..tempo.." segundos!")
doSendMagicEffect(position, 130)
local parameters = { cid = cid, var = var}
else
doSendMagicEffect(getCreaturePosition(cid), 4)
doCreatureSay(cid, "Kekkei Genkai!", TALKTYPE_ORANGE_1)
doPlayerSendCancel(cid, "Sorry, you are transformed.")
end
end
Although I add these scripts, it continues to use the two effects at the same time, I don't know if that works
Code:
if getCreatureStorage(cid, 5000) == 1 then
In the end it worked for me, but the problem is that I use both effects at the same time, I just want to use level 200.
Code:
local tempo = 30
local effect = {500} -- BUFF LEVEL 0-100
local effect2 = {200} -- BUFF LEVEL 200
local ml = 10 -- quantos ira aumentar o skill de ML
local skillfist = 0 -- quantos ira aumentar o skill de Fist
local skillsword = 0 -- quantos ira aumentar o skill de Sword
local skillaxe = 10 -- quantos ira aumentar o skill de Axe
local skilldistance = 0 -- quantos ira aumentar o skill de Distance
local health = 0 -- A cada 1 segundo quantos aumentar de vida
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, tempo*1000)
setConditionParam(condition, CONDITION_PARAM_STAT_MAGICLEVEL, ml)
setConditionParam(condition, CONDITION_PARAM_SKILL_FIST, skillfist)
setConditionParam(condition, CONDITION_PARAM_SKILL_SWORD, skillsword)
setConditionParam(condition, CONDITION_PARAM_SKILL_AXE, skillaxe)
setConditionParam(condition, CONDITION_PARAM_SKILL_CLUB, skillclub)
setConditionParam(condition, CONDITION_PARAM_SKILL_DISTANCE, skilldistance)
setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, skillshield)
setConditionParam(condition, CONDITION_PARAM_OUTFIT, outfit)
setCombatCondition(combat, condition)
local condition = createConditionObject(CONDITION_REGENERATION)
setConditionParam(condition, CONDITION_PARAM_SUBID, 1)
setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)
setConditionParam(condition, CONDITION_PARAM_TICKS, tempo*1000)
setConditionParam(condition, CONDITION_PARAM_HEALTHGAIN, health)
setConditionParam(condition, CONDITION_PARAM_HEALTHTICKS, 1000)
setCombatCondition(combat, condition)
function magicEffect3(tempo2,tempo3,cid)
if (isCreature(cid)) then
if getPlayerStorageValue(cid, 1500) > 0 and getCreatureCondition(cid, CONDITION_REGENERATION, 1) then
for i=1, #effect do
local position = {x=getPlayerPosition(cid).x, y=getPlayerPosition(cid).y, z=getPlayerPosition(cid).z}
doSendMagicEffect(position, effect[i])
-- parte modificada
local summons = getCreatureSummons(cid)
if #summons > 0 then
for k = 1, #summons do
local pos = getCreaturePosition(summons[k])
local positions = {x = pos.x, y = pos.y, z = pos.z}
doSendMagicEffect(positions, effect[i])
end
end
-- fim da parte modificada
end
end
end
end
function magicEffect4(tempo2,tempo3,cid)
if (isCreature(cid)) then
if getPlayerStorageValue(cid, 5000) > 0 and getCreatureCondition(cid, CONDITION_REGENERATION, 1) then
for i=1, #effect2 do
local position = {x=getPlayerPosition(cid).x, y=getPlayerPosition(cid).y, z=getPlayerPosition(cid).z}
doSendMagicEffect(position, effect2[i])
-- parte modificada
local summons = getCreatureSummons(cid)
if #summons > 0 then
for k = 1, #summons do
local pos = getCreaturePosition(summons[k])
local positions = {x = pos.x, y = pos.y, z = pos.z}
doSendMagicEffect(positions, effect2[i])
end
end
-- fim da parte modificada
end
end
end
end
function onCastSpell(cid, var)
local position = {x=getPlayerPosition(cid).x, y=getPlayerPosition(cid).y, z=getPlayerPosition(cid).z}
if getPlayerStorageValue(cid, 1500) ~= 1 or getCreatureCondition(cid, CONDITION_REGENERATION, 1) == false then
doCombat(cid, combat, var)
tempo2 = 0
while (tempo2 ~= (tempo*1000)) do
addEvent(magicEffect3, tempo2, tempo2, tempo*1000, cid)
tempo2 = tempo2 + 1500
end
if getPlayerStorageValue(cid, 5000) ~= 1 or getCreatureCondition(cid, CONDITION_REGENERATION, 1) == false then
doCombat(cid, combat, var)
tempo2 = 0
while (tempo2 ~= (tempo*1000)) do
addEvent(magicEffect4, tempo2, tempo2, tempo*1000, cid)
tempo2 = tempo2 + 1500
end
end
setPlayerStorageValue(cid, 1500,1) -- storage verifica transformado, quando = 1 player esta transformado.
setPlayerStorageValue(cid, 5000,1) -- STORAGE LEVEL 200
doCreatureSay(cid, "Kekkei Genkai!", TALKTYPE_ORANGE_1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "( Buff ) activado por "..tempo.." segundos!")
doSendMagicEffect(position, 130)
local parameters = { cid = cid, var = var}
else
doSendMagicEffect(getCreaturePosition(cid), 4)
doCreatureSay(cid, "Kekkei Genkai!", TALKTYPE_ORANGE_1)
doPlayerSendCancel(cid, "Sorry, you are transformed.")
end
end