• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

{Spells} Learn a spell when using a spell.

Alaa Adel

Basic Mapper
Joined
Mar 2, 2014
Messages
231
Reaction score
8
HI :)
I want to be able to cast a spell if you are under an effect of another spell...
for an example:
I transformed to Hulk using a spell that lasts for 2 minutes, I want when I get transformed I can use a spell like a super punch or something that I cannot use in normal and when the 2 minutes pass... can't use the spell until I transform to hulk again...
Hope you understand :D
Thanks.
 
This is a really good idea, for druids when they transform to other animals or something! im sorry i can't help you but i would love to get my hands on a spell script like this!! :)
 
First spell.
Not tested. It's just an example, you have to edited yourself to get it as you want it.

Code:
local cfg = {
    time = 1, -- Seconds
    storage = 1000,
},

function onCastSpell(cid, var)
    local player = Player(cid)

    if player:getStorageValue(cfg.storage) < os.time() then
        setStorageValue(cfg.storage, os.time() + cfg.time * 60)
    else
        player:sendTextMessage(MESSAGE_STATUS_DEFAULT, "This spell is already activated.")
        return false
    end   
    return true
end

Second Spell.
I just copied "Flame Strike" and edited it. As stated before it's not tested and you have to edit it as you want it.

Code:
local cfg = {
    storage = 1000,
},

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_FIREATTACK)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)

function onGetFormulaValues(cid, level, maglevel)
    min = -((level / 5) + (maglevel * 1.4) + 8)
    max = -((level / 5) + (maglevel * 2.2) + 14)
    return min, max
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(cid, var)
    local player = Player(cid)

    if player:getStorageValue(config.storage) > os.time() then
        return doCombat(cid, combat, var)
    else
        player:sendTextMessage(MESSAGE_STATUS_DEFAULT, "You need to be in hulk mode in order to use this spell.")       
        return false
    end       
end

Hope this works Regards Alw
 
[22/05/2015 21:03:48] [Error - LuaScriptInterface::loadFile] data/spells/scripts/my spells/second spell.lua:5: unexpected symbol near 'local'
[22/05/2015 21:03:48] [Warning - Event::loadScript] Cannot load script (data/spells/scripts/my spells/second spell.lua)
[22/05/2015 21:03:48] data/spells/scripts/my spells/second spell.lua:5: unexpected symbol near 'local'
[22/05/2015 21:03:48] [Error - LuaScriptInterface::loadFile] data/spells/scripts/my spells/first spell.lua:6: '(' expected near 'onCastSpell'
[22/05/2015 21:03:48] [Warning - Event::loadScript] Cannot load script (data/spells/scripts/my spells/first spell.lua)
[22/05/2015 21:03:48] data/spells/scripts/my spells/first spell.lua:6: '(' expected near 'onCastSpell
 
Code:
local cfg = {
  time = 1, -- Seconds
  storage = 1000
}

function onCastSpell(cid, var)
  local player = Player(cid)

  if player:getStorageValue(cfg.storage) < os.time() then
  setStorageValue(cfg.storage, os.time() + cfg.time * 60)
  else
  player:sendTextMessage(MESSAGE_STATUS_DEFAULT, "This spell is already activated.")
  return false
  end   
  return true
end

Code:
local cfg = {
  storage = 1000
}

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_FIREATTACK)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)

function onGetFormulaValues(cid, level, maglevel)
  min = -((level / 5) + (maglevel * 1.4) + 8)
  max = -((level / 5) + (maglevel * 2.2) + 14)
  return min, max
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(cid, var)
  local player = Player(cid)

  if player:getStorageValue(config.storage) > os.time() then
  return doCombat(cid, combat, var)
  else
  player:sendTextMessage(MESSAGE_STATUS_DEFAULT, "You need to be in hulk mode in order to use this spell.")   
  return false
  end   
end
 
[22/05/2015 21:18:43] data/spells/scripts/my spells/second spell.lua:eek:nCastSpell
[22/05/2015 21:18:43] Description:
[22/05/2015 21:18:43] ...a/spells/scripts/my spells/second spell.lua:19: attempt to call global 'Player' (a nil value)
[22/05/2015 21:18:43] stack traceback:
[22/05/2015 21:18:43] ...a/spells/scripts/my spells/second spell.lua:19: in function <...a/spells/scripts/my spells/second spell.lua:18>

[22/05/2015 21:18:45] [Error - Spell Interface]
[22/05/2015 21:18:45] data/spells/scripts/my spells/second spell.lua:eek:nCastSpell
[22/05/2015 21:18:45] Description:
[22/05/2015 21:18:45] ...a/spells/scripts/my spells/second spell.lua:19: attempt to call global 'Player' (a nil value)
[22/05/2015 21:18:45] stack traceback:
[22/05/2015 21:18:45] ...a/spells/scripts/my spells/second spell.lua:19: in function <...a/spells/scripts/my spells/second spell.lua:18>
 
Become Hulk:
Code:
local hulkBuff = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(hulkBuff, CONDITION_PARAM_TICKS, 120000)
setConditionParam(hulkBuff, CONDITION_PARAM_SUBID, 1234)
setConditionParam(hulkBuff, CONDITION_PARAM_BUFF, true)


function onCastSpell(cid, var)
    if(getCreatureCondition(cid, CONDITION_ATTRIBUTES, 1234)) then
        doPlayerSendCancel(cid, "This spell is already active.")
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
        return false
    end
   
    doAddCondition(cid, hulkBuff)
    doCreatureSay(cid, "Built hulk tough!", TALKTYPE_ORANGE_1)
    return true
end

Hulk punch things:
Code:
function onCastSpell(cid, var)
    if(not getCreatureCondition(cid, CONDITION_ATTRIBUTES, 1234)) then
        doPlayerSendCancel(cid, "You must be hulk tough to use this spell.")
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
        return false
    end
   
    doCreatureSay(cid, "I'm the juggernaut bitch!", TALKTYPE_ORANGE_1) -- replace this with your spell shit
    return true
end
 
Is it possible like... when I use this awakening spell, my weapon gets replaced with another weapon until the spell is off?
Thanks.
 
Oh didn't notice that before... you can do the normal spells and I don't want that.
Final Request:
when I use this awakening spell, I can use a powerful attack spell and cant use the normal ones ... my outfit changes, also my shielding and attacking increases and my weapon gets changed when I use it..
the spell lasts for 20 seconds.
Sorry for all the trouble.. really appreciate it.
(tfs 0.3.6)
Thaaaanks! :)
 
Back
Top