• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Is it hard to edit scripts from 0.4 to 1.2 or 1.3 without Lua scripting experience?

Marko999x

ArchezOt soon
Premium User
Joined
Dec 14, 2017
Messages
3,953
Solutions
103
Reaction score
3,082
Location
Germany
Hello guys
as the tittle says is it hard to edit scripts from 0.4 to 1.2 or 1.3 without any lua scripting experience?
Im talking about simple scripts like manarune script or spell scripts etc
 
Solution
I'll give you an example so you'll have an image of this situation. :) This is based on some code found on this forum. It's an item that gives some mana for players above level 700.

old version
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local level = getPlayerLevel(cid)
    local mlevel = getPlayerMagLevel(cid)
    local mp_minimum = (level * 2.9) + (mlevel * 1) - 50
    local mp_maximum = (level * 5.0) + (mlevel * 1)
    local mp_add = math.random(mp_minimum, mp_maximum)

    if getPlayerLevel(cid) > 700 then
        doPlayerAddMana(cid, mp_add)
        doRemoveItem(item.uid, 1)
        doSendMagicEffect(getThingPos(itemEx.uid), 5)
    else
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need 700...
Are u asking for such thing being here for nearly 3 years and having so many msgs? :D
It depends wheter were you programming previously or not. Its very easy to do such transpilation for such small scripts (whole script usually has a few lines of code) but without any lua experience you might be confused seeing anything.
 
Are u asking for such thing being here for nearly 3 years and having so many msgs? :D
It depends wheter were you programming previously or not. Its very easy to do such transpilation for such small scripts (whole script usually has a few lines of code) but without any lua experience you might be confused seeing anything.

Nice to know thanks thanks :D
 
I'll give you an example so you'll have an image of this situation. :) This is based on some code found on this forum. It's an item that gives some mana for players above level 700.

old version
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local level = getPlayerLevel(cid)
    local mlevel = getPlayerMagLevel(cid)
    local mp_minimum = (level * 2.9) + (mlevel * 1) - 50
    local mp_maximum = (level * 5.0) + (mlevel * 1)
    local mp_add = math.random(mp_minimum, mp_maximum)

    if getPlayerLevel(cid) > 700 then
        doPlayerAddMana(cid, mp_add)
        doRemoveItem(item.uid, 1)
        doSendMagicEffect(getThingPos(itemEx.uid), 5)
    else
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need 700 lvl to use this.")
    end
end

new version
LUA:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local level = player:getLevel()
    local mlevel = player:getMagicLevel()
    local mp_minimum = (level * 2.9) + (mlevel * 1) - 50
    local mp_maximum = (level * 5.0) + (mlevel * 1)
    local mp_add = math.random(mp_minimum, mp_maximum)

    if player:getLevel()> 700 then
        player:addMana(mp_add)
        item:remove(1)
        target:getPosition():sendMagicEffect(5)
    else
        player:sendTextMessage(MESSAGE_INFO_DESCR, "You need 700 lvl to use this.")
    end
end


As you could see it's kinda similiar.


#Edit
I decided to make it even more similiar to the original code (no tweaks :)).
 
Last edited:
Solution
Back
Top