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

Lua Floor Skilling

Black123

New Member
Joined
Nov 17, 2011
Messages
32
Reaction score
0
Hello, can someone write simple script for skilling floor.
When i'm walking on water it's skilling me fishing, i dont know how to write it ;/
TFS 0.3.6pl1 (8.54)
 
You can add a stepin script in movements, add it with water itemids in movements.xml and add this to the Lua script.
Code:
doPlayerAddSkillTry(cid, SKILL_FISHING, 1)
 
Create a new Lua script in movements with this.
Code:
function onStepIn(cid, item, position, fromPosition)
     doPlayerAddSkillTry(cid, SKILL_FISHING, 1)
     return true
end
In movements.xml you can just copy/paste other stepin lines and change the itemids and lua script name.
 
You could do it with a globalevent.
Code:
function onThink(interval, lastExecution)
     for _, cid in ipairs(getPlayersOnline()) do 
         doCreatureAddMana(cid, getPlayerSkillLevel(cid, SKILL_FISHING) * 2, false)
     end
     return true
end
 
Last edited:
Code:
<globalevent name="manaregen" interval="1" event="script" value="manaregen.lua"/>
Is it Good?
@Limos
i have this error in console
Code:
[30/12/2014 01:42:55] [Error - LuaScriptInterface::loadFile] data/globalevents/scripts/manaregen.lua:4: ')' expected (to close '(' at line 3) near 'end'
[30/12/2014 01:42:55] [Warning - Event::loadScript] Cannot load script (data/globalevents/scripts/manaregen.lua)
[30/12/2014 01:42:55] data/globalevents/scripts/manaregen.lua:4: ')' expected (to close '(' at line 3) near 'end'

Error solved. But it isnt regenarating mana ;/
 
So if we are here. I will ask for last thing. And i let u go ;> U are my God. how to set max skill. For example: max 100 fishing?
 
Last edited:
In food.lua in actions (add it at doPlayerFeed).
Code:
doPlayerAddSkillTry(cid, SKILL_CLUB, 1)
For the max skill, add this in login.lua.
Code:
if getPlayerSkillLevel(cid, SKILL_FISHING) >= 100 then
     doPlayerSetRate(cid, SKILL_FISHING, 0)
end
Also add it in an advance creaturescript.
 
Everytime when im trying do something by myself it doesnt work :'(
Code:
function onThink(interval, lastExecution)
     for _, cid in ipairs(getPlayersOnline()) do  
         doPlayerAddMana(cid, getPlayerSkillLevel(cid, SKILL_FISHING) * 2, false)
        doPlayerAddHealth(cid, getPlayerSkillLevel(cid, SKILL_CLUB) * 0.5, false)
end
     return true
end
Code:
[30/12/2014 02:44:27] data/globalevents/scripts/manaregen.lua:4: attempt to call global 'doPlayerAddHealth' (a nil value)
[30/12/2014 02:44:27] stack traceback:
[30/12/2014 02:44:27]     data/globalevents/scripts/manaregen.lua:4: in function <data/globalevents/scripts/manaregen.lua:1>
[30/12/2014 02:44:27] [Error - GlobalEvents::think] Couldn't execute event: manaregen
 
It's doCreatureAddHealth, you can find Lua functions in the folder doc in the file LUA_FUNCTIONS and in luascript.cpp (source file).
The false parameter is btw for the addmana function.
 
Then now is it good?
Code:
function onThink(interval, lastExecution)
     for _, cid in ipairs(getPlayersOnline()) do  
         doPlayerAddMana(cid, getPlayerSkillLevel(cid, SKILL_FISHING) * 2, false)
         doCreatureAddHealth(cid, getPlayerSkillLevel(cid, SKILL_CLUB) * 0.5)
end
     return true
end
 
@Limos
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local food = FOODS[item.itemid]
    if(not food) then
        return false
    end

    if((getPlayerFood(cid) + food[1]) >= 400) then
        doPlayerSendCancel(cid, "You are full.")
        return true
    end

    doPlayerFeed(cid, food[1] * 4)
    doCreatureSay(cid, food[2], TALKTYPE_ORANGE_1)
    doPlayerAddSkillTry(cid, SKILL_CLUB, 2)
    doRemoveItem(item.uid, 1)
    return true
end
It isnt skilling club for normal player, just for god ;/
 
Back
Top