• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

SuperCharge!!

jona21

Member
Joined
Jan 19, 2010
Messages
38
Reaction score
5
Well a long time last time i posted a sript so here is one.

first what it does??
You need first to charge before you can make a spell.

lets start first create a document .lua named charge and put this

PHP:
function onCastSpell(cid, var)

   if(getPlayerStorageValue(cid, 9999) == 0) then
   doPlayerSetStorageValue(cid, 9999, 1)
   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Charge +1.")
   
   elseif(getPlayerStorageValue(cid, 9999) == 1) then
     doPlayerSetStorageValue(cid, 9999, 2)
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Charge +2.")
    
        elseif(getPlayerStorageValue(cid, 9999) == 2) then
         doPlayerSetStorageValue(cid, 9999, 3)
         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Charge +3.")
        
                 elseif(getPlayerStorageValue(cid, 9999) == 3) then
                 doPlayerSetStorageValue(cid, 9999, 4)
                 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Charge +4.")
                
                         elseif(getPlayerStorageValue(cid, 9999) == 4) then
                         doPlayerSetStorageValue(cid, 9999, 5)
                         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Charge +5.")
                        
                         else
                         doPlayerSendCancel(cid, "You cant do this.")
         
        end
        return TRUE
        end

and in spells.xml put

PHP:
   <instant name="Charging" words="exutura" lvl="1" mana="40" aggressive="0" selftarget="1" exhaustion="1000" groups="2,1000" icon="123" needlearn="0" event="script" value="charge/charge.lua">
      <vocation id="4"/>
      <vocation id="8"/>
   </instant>

an example of the uses

PHP:
    function onGetFormulaValues(cid, level, skill, attack, factor)
       local skillTotal, levelTotal = skill + attack * 4, level / 5 * 4
       return -(skillTotal / 2 + levelTotal), -(skillTotal + levelTotal)
    end

    setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

    function onCastSpell(cid, var)
            if (getPlayerStorageValue(cid, 9999) >= 1) then
              return doCombat(cid, combat, var) and
            (doPlayerSetStorageValue(cid, 9999, (getPlayerStorageValue(cid, 9999)-1))) and
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Charge -1.")
          else
            doPlayerSendCancel(cid, "You need to charge.")
    end
    end

add this before the end line:

Code:
function onCastSpell(cid, var)
        if (getPlayerStorageValue(cid, 9999) >= [COLOR="#00FFFF"]1[/COLOR]) then
          return doCombat(cid, combat, var) and
        (doPlayerSetStorageValue(cid, 9999, (getPlayerStorageValue(cid, 9999)-[COLOR="#00FFFF"]1[/COLOR]))) and
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Charge -1.")
      else
        doPlayerSendCancel(cid, "You need to charge.")
end

you can change the 1 to the numer of charges it consume.

hope you like it.

Tested on CrystalServer V9.10.
 
nice, but the charging can be made much easier:
Lua:
local config = {
    chargeLimit = 4,
    storage = 9999
}


function onCastSpell(cid, var) 
    local storageValue = getPlayerStorageValue(cid, config.storage)
    if(storageValue > config.chargeLimit)
         doPlayerSendCancel(cid, "You cannot charge more.")
         doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
         return FALSE --Using return false so that incase the player can't charge it doesn't reduce the player's mana
    end
    doPlayerSetStorageValue(cid, config.storage, storageValue + 1) 
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Charge +" + (storageValue + 1))
    return TRUE
end
 
Last edited:
No problem, at least your trying :)
You can update your code on the first post with my version if you want :p
 
Back
Top