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

Quest x Frags

Monomalo00

http://leiends.ml/
Joined
Nov 13, 2010
Messages
120
Solutions
1
Reaction score
4
Its possible make some quest with frags limit?
Example: Pass a door with frags requeriment (ex: 200) if u dont have 200 unjust frags u can't pass.

Let me know if u dont understand.
thanks
 
Solution
Okay now it's updating more 6 values but dont count all frags. I'm going to look

UPDATE:
This have a big problem and its the values are getting doubles. Example: if you have 15 kills and me 12 kills, if i kill you and after i logout or die by you, im going to get your value from this storage.

Example 2: I create a new character without storage 1000 and value and you have 15 kills, if I kill you I get 15 values in storage 1000.

UPDATE :
Fixed

i added this in onKill
Code:
 setPlayerStorageValue(cid, 1000, getPlayerStorageValue(cid, 1000) +1)

Thanks for all
Its possible make some quest with frags limit?
Example: Pass a door with frags requeriment (ex: 200) if u dont have 200 unjust frags u can't pass.

Let me know if u dont understand.
thanks
I am sure it is possible, this type of script should be a movements script rather than an actionscript because of the issues other developers have encountered with 1 person holding a door open allowing other players to pass through bypassing the door requirements.
 
I am sure it is possible, this type of script should be a movements script rather than an actionscript because of the issues other developers have encountered with 1 person holding a door open allowing other players to pass through bypassing the door requirements.
Thanks for your response, you know some movement script with this? Becouse im trying to search and i can't see. I can edit some script but not create from 0.
 
First of all you need to store the frags somewhere. I suggest store them as storage.

Then you only check for the storage when they try to pass the door, if they meet the criteria.

What tfs version do you even use?
 
Then it's easy like 1, 2, 3 inside:
otland/forgottenserver

Just add:
Code:
killer:setStorageValue(1000, math.max(1, player:getStorageValue(1000)))

Make sure add it under byPlayer.

Then just make a Door and check for the Storage:
Code:
if player:getStorageValue(1000) < 200 then
.....
 
Edited: Fixed!
Thanks a lot guys!

Edited again:
I have problems if i change the number of frags for the door.

Works: if(getPlayerStorageValue(cid, 1000) < 1) then
Not: if(getPlayerStorageValue(cid, 1000) < 2) then
 
Last edited:
action/scripts/door.lua
Code:
local function doorEnter(cid, uid, id, position)
    doTransformItem(uid, id)
    doTeleportThing(cid, position, true)
    return true
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(getPlayerStorageValue(cid, 1000) < 20) then
        return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "This door seems to be sealed against unwanted intruders.")
    end

    return doorEnter(cid, item.uid, item.itemid + 1, toPosition)
end

creaturescripts/playerdeath.lua
add this under byplayer: killer:setStorageValue(1000, math.max(1, player:getStorageValue(1000)))
Code:
    local byPlayer = 0
    killer:setStorageValue(1000, math.max(1, player:getStorageValue(1000)))
    local killerName
    if killer ~= nil then
        if killer:isPlayer() then
            byPlayer = 1
            killer:setStorageValue(1000, math.max(1, player:getStorageValue(1000)))
        else
            local master = killer:getMaster()
            if master and master ~= killer and master:isPlayer() then
                killer = master
                byPlayer = 1
                killer:setStorageValue(1000, math.max(1, player:getStorageValue(1000)))
            end
        end
        killerName = killer:getName()
    else
        killerName = "field item"
    end
 
Last edited:
Jumps this error in console after kill somone or using the door i can't know 100% and if the max frags for use door it's 5, if u put more then 5 dont work.
Code:
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/playerdeath.lua:onDeath
data/creaturescripts/scripts/playerdeath.lua:16: attempt to call method 'setStorageValue' (a nil value)
stack traceback:
        [C]: in function 'setStorageValue'
        data/creaturescripts/scripts/playerdeath.lua:16: in function <data/creaturescripts/scripts/playerdeath.lua:4>

Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/playerdeath.lua:onDeath
data/creaturescripts/scripts/playerdeath.lua:16: attempt to call method 'setStorageValue' (a nil value)
stack traceback:
        [C]: in function 'setStorageValue'
        data/creaturescripts/scripts/playerdeath.lua:16: in function <data/creaturescripts/scripts/playerdeath.lua:4>[code]
 
Jumps this error in console after kill somone or using the door i can't know 100% and if the max frags for use door it's 5, if u put more then 5 dont work.
Code:
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/playerdeath.lua:onDeath
data/creaturescripts/scripts/playerdeath.lua:16: attempt to call method 'setStorageValue' (a nil value)
stack traceback:
        [C]: in function 'setStorageValue'
        data/creaturescripts/scripts/playerdeath.lua:16: in function <data/creaturescripts/scripts/playerdeath.lua:4>

Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/playerdeath.lua:onDeath
data/creaturescripts/scripts/playerdeath.lua:16: attempt to call method 'setStorageValue' (a nil value)
stack traceback:
        [C]: in function 'setStorageValue'
        data/creaturescripts/scripts/playerdeath.lua:16: in function <data/creaturescripts/scripts/playerdeath.lua:4>[code]
"Attempt to call method"
change setStorageValue to setPlayerStorageValue
 
Last edited:
You are setting the Storage value on wrong places. Only have it under byPlayer == 1.

Or else the killer could be anything and that's why you could get nil value.
 
Last edited:
i placed now okey, but still the same problem. only i can pass the door max with 5 frags, with +6 i can't (from door config)
like this dont work || if(getPlayerStorageValue(cid, 1000) < 6) then
like this works || if(getPlayerStorageValue(cid, 1000) < 5) then

codes are in the top
 
Make sure that the player has more than 5 frags. The Door script looks fine by me
 
Can you show me your door script? Im sure the player have more than 5 frags becouse i tested with a lot of frags.

I add action script + action in RME + playerdeath.lua
actions.xml
<action actionid="1000" script="test.lua"/>


playerdeath.lua
Code:
local byPlayer = 0
    local killerName
    if killer ~= nil then
        if killer:isPlayer() then
            byPlayer = 1
            killer:setStorageValue(1000, math.max(1, player:getStorageValue(1000)))
        else
            local master = killer:getMaster()
            if master and master ~= killer and master:isPlayer() then
                killer = master
                byPlayer = 1
            end
        end
        killerName = killer:getName()
    else
        killerName = "field item"
    end

Tell me what i'm doing wrong
 
You should add it under this line only. Since we want to count player summon aswell:
otland/forgottenserver

Then on the Door script just print the storage of the player and see if HE actually got more than 5
 
Okey, i see the problem now. I'm looking my database and its not updating the storage of frags, just get 1 and dont take more. Maybe it's becouse i have installed skull system idk exactly.
Sorry @Printer
I tested with a storage edited and works good, the problem its this ^

Maybe i can edit this in the source?

UPDATE:
It's possible just take the information from DB? example: in door script take better "frags" and continue, idk how to expalain.
data.png


UPDATE2:
I tryied with this
Code:
 db.query("UPDATE `player_storage` SET `value` = "100" WHERE `key` = "1000" AND `player_id` = "..guid)

But after get 1 point, dont get more...
 
Last edited:
Ah sorry my fault, you should change the line of Storage to this:
Code:
killer:setStorageValue(1000, math.max(1, killer:getStorageValue(1000)) + 1)

Forgott to increase the value, thats why it got stuck at 1.
 
Last edited:
Back
Top