Simple Spell I made

Discussion in 'Programming & Scripting' started by mikebadeaux, Feb 10, 2012.

  1. mikebadeaux

    mikebadeaux Mapper

    Joined:
    May 16, 2010
    Messages:
    112
    make a .LUA called
    and put this in




    .XML




    Edit vocs if u like
    REP++
    Last edited: Feb 10, 2012
  2. Mooosie

    Mooosie - Lua Scripter -

    Joined:
    Aug 2, 2008
    Messages:
    702
    These days is it very simple to create a basic action/creaturescript/movement/weapon. You just have to copy and paste the file you can do anything with. For example, shovel.lua:
    [LUA]local holes = {468, 481, 483, 7932, 8579}
    local sand = {231, 9059}

    function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(isInArray(holes, itemEx.itemid)) then
    local newId = itemEx.itemid + 1
    if(itemEx.itemid == 8579) then
    newId = 8585
    end

    doTransformItem(itemEx.uid, newId)
    doDecayItem(itemEx.uid)
    elseif(isInArray(sand, itemEx.itemid)) then
    local rand = math.random(1, 100)
    if(itemEx.actionid == 100 and rand <= 20) then
    doTransformItem(itemEx.uid, 489)
    doDecayItem(itemEx.uid)
    elseif(rand >= 1 and rand <= 5) then
    doCreateItem(2159, 1, toPosition)
    elseif(rand > 85) then
    doCreateMonster("Scarab", toPosition, false)
    end

    doSendMagicEffect(toPosition, CONST_ME_POFF)
    end

    return true
    end[/LUA]

    Just remove the content:
    [LUA]function onUse(cid, item, fromPosition, itemEx, toPosition)


    return true
    end
    [/LUA]
    And just start your own basic script. If you want help just go to "YOURSERVERFOLDER/doc/LUAFUNCTIONS" there are all functions you can use.

    That was a quick tutorial, but topic:

    Thanks for sharing and this was my first step too. To create my own spell using one spell template.

Share This Page