• 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!

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

Marko999x

I love highexp
Staff member
Board Moderator
Premium User
Joined
Dec 14, 2017
Messages
4,005
Solutions
107
Reaction score
3,177
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
i see i see thanks for the example
thought would be way harder to be honest
 
Back
Top