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

I need help with this script-Hota quest

Eduardo170

Well-Known Member
Joined
Jan 7, 2014
Messages
422
Solutions
3
Reaction score
66
Location
Caracas, Venezuela
Hello community, the script does not work just throws the message "You can not go there right now"
Likewise in killing the boss, it dont work.
Server : OTX 2 Lord Zedd(tfs 0.3.7)
Lua:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)

local config = {
    --[UID OF TP] = {storage = STORAGE NUMBER, position = {x=x, y=y, z=z}},
        [9350] = {storage = 321631, position = {x=1590, y=1878, z=11}, msg = "You've reached mahrdis room"},
        [9351] = {storage = 321632, position = {x=1554, y=1884, z=11}, msg = "You've reached morguthis room]"},
        [9352] = {storage = 321633, position = {x=1518, y=1882, z=11}, msg = "You've reached omruc room"},
        [9353] = {storage = 321634, position = {x=1495, y=1880, z=11}, msg = "You've reached rahemos room"},
        [9354] = {storage = 321635, position = {x=1490, y=1862, z=11}, msg = "You've reached thalas room"},
        [9355] = {storage = 321636, position = {x=1570, y=1859, z=11}, msg = "You've reached vashresamun room"},
        [9356] = {storage = 321637, position = {x=1493, y=1819, z=11}, msg = "You've reached ashmunrah room"},
        [9357] = {storage = 321638, position = {x=1589, y=1842, z=11}, msg = "You've reached reward room"},
 
}

local tp = config[item.uid]
if isPlayer(cid) then
if getCreatureStorage(cid, tp.storage) >= 0 then
    doTeleportThing(cid, tp.position)
    doSendMagicEffect(getCreaturePosition(cid),CONST_ME_TELEPORT)
    doSendMagicEffect(tp.position, CONST_ME_TELEPORT)
    else
        doPlayerSendCancel(cid, "You can't go there right now")
    end
end
return true
end

Creaturescript
Lua:
local Config = {
    -- ['name] = {Storage Key}
    ['dipthrah'] = {321631},
    ['mahrdis'] = {321632},
    ['morguthis'] = {321633},
    ['omruc'] = {321634},
    ['rahemos'] = {321635},
    ['thalas'] = {321636},
    ['vashresamun'] = {321637},
    ['ashmunrah'] = {321638},
  }

function onDeath(cid, corpse, deathList)

  local v = Config[getCreatureName(cid):lower()]
    if isMonster(cid) and v then

        for _, killer in ipairs(deathList) do
            if isPlayer(killer) then

                if getPlayerStorageValue(killer, v[1]) ~= 1 then
                    setPlayerStorageValue(killer, v[1], 1)
                    addEvent(doPlayerSendTextMessage, 0.1, killer, MESSAGE_INFO_DESCR, 'Go to next room.')
                end

            end
        end
    end

  return true
end
 
Last edited by a moderator:
Solution
I'm giving up, I've tried everything until I've tried my doubts. It does not print anything, it does not show errors in the console, I have it in onlogin, creaturescript.xml in the correct folder I have reviewed everything, the script dont working.
I try my own methods, but as I do not know much about the .lua.

Download teamviewer and PM me the id and pin

Problem fixed via teamviewer, had to change the function to onDeath insted of onKill, made sure the variable names were correct in all the scripts and some minor things to the script itself.
Works fine now.

Lua:
local config = {
    ['dipthrah'] = 321631,
    ['mahrdis'] = 321632,
    ['morguthis'] = 321633,
    ['omruc'] = 321634,
    ['rahemos'] = 321635,
    ['thalas'] =...
Lua:
if getCreatureStorage(cid, tp.storage) >= 0 then

What is the storage value set to on the character?
The start value is -1, not 0.
If they need to have a value set (ex 0) then make sure that it's set in the database.
 
Lua:
if getCreatureStorage(cid, tp.storage) >= 0 then

What is the storage value set to on the character?
The start value is -1, not 0.
If they need to have a value set (ex 0) then make sure that it's set in the database.
Okay, I solved that thank you, but now you can pass the teleport without having obtained the storage by killing the boss
 
Okay, I solved that thank you, but now you can pass the teleport without having obtained the storage by killing the boss

Still what is the storage id now?
I would just set the value to ex 1, then check if it's -1 or not
Lua:
if getCreatureStorage(cid, x) == -1 then
     -- hasn't killd the boss
else
     -- has killd the boss
end
 
eRXurhD.jpg
 
how fix this?.

Well the problem is in here;
Lua:
    local v = Config[getCreatureName(cid):lower()]
    if isMonster(cid) and v then

        for _, killer in ipairs(deathList) do
            if isPlayer(killer) then

                if getPlayerStorageValue(killer, v[1]) ~= 1 then
                    setPlayerStorageValue(killer, v[1], 1)
                    addEvent(doPlayerSendTextMessage, 0.1, killer, MESSAGE_INFO_DESCR, 'Go to next room.')
                end

            end
        end
    end

The storage id isn't set as I said, so one of the if statment is not getting a true value, ex the storage value check, if player(killer), if isMonster(cid) and v etc etc
Add print("number") after each statment, then you will see if ex number 3 is loaded or not, also add one right after onDeath to see if the script is even loaded.
 
I dont understand much :/

Lua:
local config = {
    ['dipthrah'] = 321631,
    ['mahrdis'] = 321632,
    ['morguthis'] = 321633,
    ['omruc'] = 321634,
    ['rahemos'] = 321635,
    ['thalas'] = 321636,
    ['vashresamun'] = 321637,
    ['ashmunrah'] = 321638,
}

function onDeath(cid, corpse, deathList)
    print("1")

    local v = config[getCreatureName(cid):lower()]
    if isMonster(cid) and v then
        print("2")
        for _, killer in ipairs(deathList) do
            if isPlayer(killer) then
                print("3")
                if getPlayerStorageValue(killer, v) ~= 1 then
                    print("4")
                    setPlayerStorageValue(killer, v, 1)
                    addEvent(doPlayerSendTextMessage, 0.1, killer, MESSAGE_INFO_DESCR, 'Go to next room.')
                end
            end
        end
    end

    return true
end
 
Lua:
local config = {
    ['dipthrah'] = 321631,
    ['mahrdis'] = 321632,
    ['morguthis'] = 321633,
    ['omruc'] = 321634,
    ['rahemos'] = 321635,
    ['thalas'] = 321636,
    ['vashresamun'] = 321637,
    ['ashmunrah'] = 321638,
}

function onDeath(cid, corpse, deathList)
    print("1")

    local v = config[getCreatureName(cid):lower()]
    if isMonster(cid) and v then
        print("2")
        for _, killer in ipairs(deathList) do
            if isPlayer(killer) then
                print("3")
                if getPlayerStorageValue(killer, v) ~= 1 then
                    print("4")
                    setPlayerStorageValue(killer, v, 1)
                    addEvent(doPlayerSendTextMessage, 0.1, killer, MESSAGE_INFO_DESCR, 'Go to next room.')
                end
            end
        end
    end

    return true
end
Does nothing
Edit: Should print some of them and dont Print none.
 
Does it print some of them or none of them?

If not even 1 is printed the script isn't loaded, do you have the code in creaturescripts.xml?
yes i have this
Code:
<event type="death" name="ReqMonsterDeath" script="hota/reqMonsterDeath.lua"/>
and register on login.lua
Code:
registerCreatureEvent(cid, "reqMonsterDeath")
 
onDeath only works for players.
use onKill for creatures.
 
onDeath only works for players.
use onKill for creatures.

onDeath works for all creatures, or is it diffrent with the older TFS? Can't remember any changes like that to onDeath.
ex; server/whitedeer.lua at master · orts/server · GitHub

yes i have this
Code:
<event type="death" name="ReqMonsterDeath" script="hota/reqMonsterDeath.lua"/>
and register on login.lua
Code:
registerCreatureEvent(cid, "reqMonsterDeath")

Is it registerd to the monster aswell?
 
ReqMonsterDeath
reqMonsterDeath

See the diffrence?

Use re* or Re* don't mix them up.

Also read the rules; Rules for the Support board
#2



Code:
[24/7/2017 15:24:17] [Warning - Monster::Monster] Unknown event name - ReqMonsterDeath
[24/7/2017 15:24:17] [Warning - Monster::Monster] Unknown event name - ReqMonsterDeath
[24/7/2017 15:24:17] [Warning - Monster::Monster] Unknown event name - ReqMonsterDeath
[24/7/2017 15:24:17] [Warning - Monster::Monster] Unknown event name - ReqMonsterDeath
[24/7/2017 15:24:17] [Warning - Monster::Monster] Unknown event name - ReqMonsterDeath
[24/7/2017 15:24:17] [Warning - Monster::Monster] Unknown event name - ReqMonsterDeath
[24/7/2017 15:24:17] [Warning - Monster::Monster] Unknown event name - ReqMonsterDeath
[24/7/2017 15:24:17] [Warning - Monster::Monster] Unknown event name - ReqMonsterDeath
 
Last edited:
now i add
Code:
<script>
        <event name="reqMonsterDeath"/>
</script>
and get this error in console

Code:
[24/7/2017 15:14:41] [Warning - Monster::Monster] Unknown event name - reqMonsterDeath
[24/7/2017 15:14:41] [Warning - Monster::Monster] Unknown event name - reqMonsterDeath
[24/7/2017 15:14:41] [Warning - Monster::Monster] Unknown event name - reqMonsterDeath
[24/7/2017 15:14:41] [Warning - Monster::Monster] Unknown event name - reqMonsterDeath
[24/7/2017 15:14:41] [Warning - Monster::Monster] Unknown event name - reqMonsterDeath
[24/7/2017 15:14:41] [Warning - Monster::Monster] Unknown event name - reqMonsterDeath
[24/7/2017 15:14:41] [Warning - Monster::Monster] Unknown event name - reqMonsterDeath
[24/7/2017 15:14:41] [Warning - Monster::Monster] Unknown event name - reqMonsterDeath

ReqMonsterDeath
reqMonsterDeath

See the diffrence?

Use re* or Re* don't mix them up.

Also read the rules; Rules for the Support board
#2
 
Back
Top