data\actions\scripts
add a script with the name you choose granico.lua
then add this to it.local spell = "gran ico"
function onUse(cid, item, fromPosition, itemEx, toPosition)
if not getPlayerLearnedInstantSpell(cid, spell) then
doPlayerLearnInstantSpell(cid, spell)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have learned spell " .. spell .. "!")
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
doRemoveItem(item.uid, 1)
else
doCreatureSay(cid, "You already know this spell!", TALKTYPE_ORANGE_1, nil, cid, getThingPos(cid))
end
return true
end
data\actions\actions.xml
add<action itemid="5957" event="script" value="granico.lua"/>
local SpellStorage = 6667
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getCreatureStorage(cid, SpellStorage) < 1 then
doCreatureSetStorage(cid, SpellStorage, 1)
doRemoveItem(item.uid, 1)
doCreatureSay(cid, "You have learnt a new spell.", TALKTYPE_ORANGE_1)
end
end
local SpellStorage = 6667
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_PLANTATTACK)
setAttackFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 5, 5, 5, 10)
local area = createCombatArea(AREA_CROSS6X6)
setCombatArea(combat, area)
function onCastSpell(cid, var)
if getCreatureStorage(cid, SpellStorage) >= 1 then
return doCombat(cid, combat, var)
end
end
What about spells.xmlJust add a scroll which gives player a storage on your actions.
Then on the spell add a storage check like this oneLua:local SpellStorage = 6667 function onUse(cid, item, fromPosition, itemEx, toPosition) if getCreatureStorage(cid, SpellStorage) < 1 then doCreatureSetStorage(cid, SpellStorage, 1) doRemoveItem(item.uid, 1) doCreatureSay(cid, "You have learnt a new spell.", TALKTYPE_ORANGE_1) end end
Lua:local SpellStorage = 6667 local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE) setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_PLANTATTACK) setAttackFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 5, 5, 5, 10) local area = createCombatArea(AREA_CROSS6X6) setCombatArea(combat, area) function onCastSpell(cid, var) if getCreatureStorage(cid, SpellStorage) >= 1 then return doCombat(cid, combat, var) end end
You don't have to add anything special there, Just like any normal spell.What about spells.xml
I changedYou don't have to add anything special there, Just like any normal spell.
needlearn="0"
to needlearn="1"
in spells.xml
But there wrong you cannot use this objectactions.xml
, Second one is just a spell example because I don't have your exevo gran ico
spell.Spells.xmlShow me how you added the scripts above, First one should be added to actions folder andactions.xml
, Second one is just a spell example because I don't have yourexevo gran ico
spell.
<instant name="gran ico" words="exevo gran ico" lvl="150000" mana="3000" aggressive="0" selftarget="1" exhaustion="800" needlearn="1" event="script" value="healing/gran ico.lua">
<vocation id="8"/>
</instant>
<action itemid="5957" event="script" value="granico.lua"/>
local SpellStorage = 6667
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getCreatureStorage(cid, SpellStorage) < 1 then
doCreatureSetStorage(cid, SpellStorage, 1)
doRemoveItem(item.uid, 1)
doCreatureSay(cid, "You have learnt a new spell.", TALKTYPE_ORANGE_1)
end
end
local SpellStorage = 6667
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_RED)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)
function onCastSpell(cid, var)
if getPlayerStorageValue(cid, 41902) > 0 then
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
doPlayerSendCancel(cid, "You cannot use healing spells/runes during the event.")
return false
end
local formule = (getCreatureMaxHealth(cid) / 100) * math.random(67, 85)
doCreatureAddHealth(cid, formule)
return doCombat(cid, combat, var)
end
local SpellStorage = 6667
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getCreatureStorage(cid, SpellStorage) < 1 then
doCreatureSetStorage(cid, SpellStorage, 1)
doRemoveItem(item.uid, 1)
doCreatureSay(cid, "You have learnt a new spell.", TALKTYPE_ORANGE_1)
end
end
local SpellStorage = 6667
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_RED)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)
function onCastSpell(cid, var)
if getPlayerStorageValue(cid, 41902) > 0 then
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
doPlayerSendCancel(cid, "You cannot use healing spells/runes during the event.")
return false
end
if getCreatureStorage(cid, SpellStorage) >= 1 then
local formule = (getCreatureMaxHealth(cid) / 100) * math.random(67, 85)
doCreatureAddHealth(cid, formule)
return doCombat(cid, combat, var)
end
return true
end
Still wrong "you cannot use this object" This means that there is something wrong with me Action,xml in thisLua:local SpellStorage = 6667 local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_RED) setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1) setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0) setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) function onCastSpell(cid, var) if getPlayerStorageValue(cid, 41902) > 0 then doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) doPlayerSendCancel(cid, "You cannot use healing spells/runes during the event.") return false end if getCreatureStorage(cid, SpellStorage) >= 1 then local formule = (getCreatureMaxHealth(cid) / 100) * math.random(67, 85) doCreatureAddHealth(cid, formule) return doCombat(cid, combat, var) end return true end
local SpellStorage = 6667
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getCreatureStorage(cid, SpellStorage) < 1 then
doCreatureSetStorage(cid, SpellStorage, 1)
doRemoveItem(item.uid, 1)
doCreatureSay(cid, "You have learnt a new spell.", TALKTYPE_ORANGE_1)
end
end
local SpellStorage = 6667
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getCreatureStorage(cid, SpellStorage) < 1 then
doCreatureSetStorage(cid, SpellStorage, 1)
doRemoveItem(item.uid, 1)
doSendMagicEffect(fromPosition, CONST_ME_MAGIC_RED)
doCreatureSay(cid, "You have learnt a new spell.", TALKTYPE_ORANGE_1)
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You have already used this item.")
end
return true
end
I will try againI think it happens because you already used the scroll or the item
I tested it and it works.Lua:local SpellStorage = 6667 function onUse(cid, item, fromPosition, itemEx, toPosition) if getCreatureStorage(cid, SpellStorage) < 1 then doCreatureSetStorage(cid, SpellStorage, 1) doRemoveItem(item.uid, 1) doSendMagicEffect(fromPosition, CONST_ME_MAGIC_RED) doCreatureSay(cid, "You have learnt a new spell.", TALKTYPE_ORANGE_1) else doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You have already used this item.") end return true end
View attachment 52252
I was working a little with spells and adding/testing some storages last few days so this is the fastest idea I got in mind but yeah learn spells would be better, Feel free to post a script for it or if you didn't then I will do it later tonight.Why using Storage instead of learn spell?
ok bro solve but it need beI think it happens because you already used the scroll or the item
I tested it and it works.Lua:local SpellStorage = 6667 function onUse(cid, item, fromPosition, itemEx, toPosition) if getCreatureStorage(cid, SpellStorage) < 1 then doCreatureSetStorage(cid, SpellStorage, 1) doRemoveItem(item.uid, 1) doSendMagicEffect(fromPosition, CONST_ME_MAGIC_RED) doCreatureSay(cid, "You have learnt a new spell.", TALKTYPE_ORANGE_1) else doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You have already used this item.") end return true end
View attachment 52252
needlearn="0"
no needlearn="1"
in spells.xml
data\actions\scripts
add a script with the name you choose granico.lua
then add this to it.local spell = "gran ico"
function onUse(cid, item, fromPosition, itemEx, toPosition)
if not getPlayerLearnedInstantSpell(cid, spell) then
doPlayerLearnInstantSpell(cid, spell)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have learned spell " .. spell .. "!")
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
doRemoveItem(item.uid, 1)
else
doCreatureSay(cid, "You already know this spell!", TALKTYPE_ORANGE_1, nil, cid, getThingPos(cid))
end
return true
end
data\actions\actions.xml
add<action itemid="5957" event="script" value="granico.lua"/>
data\spells\spells.xml
add this <instant name="gran ico" words="exevo gran ico" lvl="150000" mana="3000" aggressive="0" selftarget="1" exhaustion="800" needlearn="1" event="script" value="healing/gran ico.lua">
<vocation id="8"/>
</instant>
data\spells\scripts\healing
add the script with name gran ico.lua
and paste this to itlocal combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_RED)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)
function onCastSpell(cid, var)
if getPlayerStorageValue(cid, 41902) > 0 then
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
doPlayerSendCancel(cid, "You cannot use healing spells/runes during the event.")
return false
end
local formule = (getCreatureMaxHealth(cid) / 100) * math.random(67, 85)
doCreatureAddHealth(cid, formule)
return doCombat(cid, combat, var)
end
Solvedata\actions\scripts
add a script with the name you choosegranico.lua
then add this to it.
and inLua:local spell = "gran ico" function onUse(cid, item, fromPosition, itemEx, toPosition) if not getPlayerLearnedInstantSpell(cid, spell) then doPlayerLearnInstantSpell(cid, spell) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have learned spell " .. spell .. "!") doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE) doRemoveItem(item.uid, 1) else doCreatureSay(cid, "You already know this spell!", TALKTYPE_ORANGE_1, nil, cid, getThingPos(cid)) end return true end
data\actions\actions.xml
add
and inXML:<action itemid="5957" event="script" value="granico.lua"/>
data\spells\spells.xml
add this
then inXML:<instant name="gran ico" words="exevo gran ico" lvl="150000" mana="3000" aggressive="0" selftarget="1" exhaustion="800" needlearn="1" event="script" value="healing/gran ico.lua"> <vocation id="8"/> </instant>
data\spells\scripts\healing
add the script with namegran ico.lua
and paste this to it
Lua:local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_RED) setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1) setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0) setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) function onCastSpell(cid, var) if getPlayerStorageValue(cid, 41902) > 0 then doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) doPlayerSendCancel(cid, "You cannot use healing spells/runes during the event.") return false end local formule = (getCreatureMaxHealth(cid) / 100) * math.random(67, 85) doCreatureAddHealth(cid, formule) return doCombat(cid, combat, var) end
TySame script just remove this.
Lua:doRemoveItem(item.uid, 1)