• 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'] =...
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



Is it registerd to the monster aswell?
I'm 90% sure that onDeath does not work for creatures in 0.3.7/0.4
Be as that may, I haven't reattempted this at any time recently and I may be wrong.

If it were to work it'd be a combination of
creaturescript.xml (for obvious reasons)
the_script.lua (for obvious reasons)
login.lua (to register the creatureevent for players? If it's only for bosses, I don't think this one is needed.)
the_monsters_xml_file.xml (tag the monster script so it registers for the creature when it's created)

but, and how would you do if they go in a group and kill the boss, give the storage to team?.
onKill is registered for every person who was actively helping with the target's death.
By default, this would register for every creature attacking that target, so the entire group, by default, would activate your script.
 
I'm out of the loop, could you post your latest version of scripts, and error messages you encounter?
 
creaturescript.xml

Code:
<event type="kill" name="reqMonsterDeath" script="hota/reqMonsterDeath.lua"/>
Code:
local Config = {
    -- ['Name'] = Storage,
    ['Dipthrah'] = 321631,
    ['Mahrdis'] = 321632,
    ['Morguthis'] = 321633,
    ['Omruc'] = 321634,
    ['Rahemos'] = 321635,
    ['Thalas'] = 321636,
    ['Vashresamun'] = 321637,
    ['Ashmunrah'] = 321638,
  }

function onKill(cid, target, lastHit)
    local v = config[getCreatureName(cid):lower()]
    if isMonster(cid) and v then
        for _, killer in ipairs(deathList) do
                if getPlayerStorageValue(killer, v) ~= 1 then
                    setPlayerStorageValue(killer, v, 1)
                    addEvent(doPlayerSendTextMessage, 0.1, killer, MESSAGE_INFO_DESCR, 'Go to next room.')
                end
            end
        end
    return true
end




movements.xml


Code:
<movevent type="StepIn" uniqueid="9350; 9351; 9352; 9353; 9354; 9355; 9356; 9357" event="script" value="hota/hota.lua"/>

Code:
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
        doTeleportThing(cid, fromPosition, FALSE)
        doSendMagicEffect(getCreaturePosition(cid),CONST_ME_TELEPORT)
        doPlayerSendCancel(cid, "You cant go there right now")
    end
end
return true
end
 
Last edited:
creaturescript.xml

Code:
<event type="kill" name="reqMonsterDeath" script="hota/reqMonsterDeath.lua"/>
Code:
local Config = {
    -- ['Name'] = Storage,
    ['Dipthrah'] = 321631,
    ['Mahrdis'] = 321632,
    ['Morguthis'] = 321633,
    ['Omruc'] = 321634,
    ['Rahemos'] = 321635,
    ['Thalas'] = 321636,
    ['Vashresamun'] = 321637,
    ['Ashmunrah'] = 321638,
  }

function onKill(cid, target, lastHit)
    local v = config[getCreatureName(cid):lower()]
    if isMonster(cid) and v then
        for _, killer in ipairs(deathList) do
                if getPlayerStorageValue(killer, v) ~= 1 then
                    setPlayerStorageValue(killer, v, 1)
                    addEvent(doPlayerSendTextMessage, 0.1, killer, MESSAGE_INFO_DESCR, 'Go to next room.')
                end
            end
        end
    end
    return true
end




movements.xml


Code:
<movevent type="StepIn" uniqueid="9350; 9351; 9352; 9353; 9354; 9355; 9356; 9357" event="script" value="hota/hota.lua"/>

Code:
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
        doTeleportThing(cid, fromPosition, FALSE)
        doSendMagicEffect(getCreaturePosition(cid),CONST_ME_TELEPORT)
        doPlayerSendCancel(cid, "You cant go there right now")
    end
end
return true
end

Did you read my last post?
You didn't write it correctly, so change the code in your monster xml file.
XML:
<script>
        <event name="reqMonsterDeath"/>
</script>

Go over all your scripts and make sure you use this: reqMonsterDeath
Not capital R, ReqMonsterDeath
 
Did you read my last post?
You didn't write it correctly, so change the code in your monster xml file.
XML:
<script>
        <event name="reqMonsterDeath"/>
</script>

Go over all your scripts and make sure you use this: reqMonsterDeath
Not capital R, ReqMonsterDeath
Code:
<?xml version="1.0" encoding="UTF-8"?>
<monster name="Ashmunrah" nameDescription="an ashmunrah" race="undead" experience="3100" speed="320" manacost="0">
    <health now="5000" max="5000"/>
    <look type="87" corpse="6031"/>
    <targetchange interval="5000" chance="8"/>
    <strategy attack="100" defense="0"/>
    <flags>
        <flag summonable="0"/>
        <flag attackable="1"/>
        <flag hostile="1"/>
        <flag illusionable="0"/>
        <flag convinceable="0"/>
        <flag pushable="0"/>
        <flag canpushitems="1"/>
        <flag canpushcreatures="1"/>
        <flag targetdistance="1"/>
        <flag staticattack="90"/>
        <flag runonhealth="0"/>
    </flags>
    <attacks>
        <attack name="melee" interval="2000" skill="90" attack="200" poison="55"/>
        <attack name="lifedrain" interval="3000" chance="7" range="1" min="-100" max="-700"/>
        <attack name="poison" interval="2000" chance="12" range="7" min="-100" max="-500">
            <attribute key="shootEffect" value="poison"/>
            <attribute key="areaEffect" value="poison"/>
        </attack>
        <attack name="physical" interval="3000" chance="12" range="7" min="-120" max="-750">
            <attribute key="shootEffect" value="energy"/>
            <attribute key="areaEffect" value="mortarea"/>
        </attack>
        <attack name="speed" interval="3000" chance="25" range="7" speedchange="-650" duration="50000">
            <attribute key="areaEffect" value="redshimmer"/>
        </attack>
        <attack name="lifedrain" interval="2000" chance="18" length="8" spread="3" min="-50" max="-550">
            <attribute key="areaEffect" value="yellowbubble"/>
        </attack>
    </attacks>
    <defenses armor="25" defense="30">
        <defense name="healing" interval="1000" chance="20" min="200" max="400">
            <attribute key="areaEffect" value="blueshimmer"/>
        </defense>
        <defense name="invisible" interval="1000" chance="7" duration="2000">
            <attribute key="areaEffect" value="blueshimmer"/>
        </defense>
        <defense name="outfit" interval="1000" chance="3" monster="ancient scarab" duration="6000">
            <attribute key="areaEffect" value="blueshimmer"/>
        </defense>
    </defenses>
    <elements>
        <element earthPercent="100"/>
        <element deathPercent="100"/>
        <element holyPercent="-17"/>
    </elements>
    <immunities>
        <immunity lifedrain="1"/>
        <immunity paralyze="1"/>
        <immunity invisible="1"/>
    </immunities>
    <summons maxSummons="4">
        <summon name="Ancient Scarab" interval="1000" chance="2000" max="2"/>
        <summon name="Green Djinn" interval="1000" chance="1000" max="2"/>
    </summons>
    <voices interval="5000" chance="10">
        <voice sentence="No mortal or undead will steal my secrets!"/>
        <voice sentence="Ahhhh all those long years."/>
    </voices>
    <loot>
        <item id="2148" countmax="80" chance="50000"/><!-- gold coin -->
        <item id="2148" countmax="60" chance="50000"/><!-- gold coin -->
        <item id="2134" chance="7000"/><!-- silver brooch -->
        <item id="7590" chance="1500"/><!-- great mana potion -->
        <item id="2164" chance="1000"/><!-- might ring -->
        <item id="2487" chance="80000"/><!-- crown armor-->
        <item id="2140" chance="400"/><!-- holy scarab -->
    </loot>
    <script>
        <event name="reqMonsterDeath"/>
    </script>
</monster>
And get this error.
Code:
 [Warning - Monster::Monster] Unknown event name - reqMonsterDeath
 
Code:
<?xml version="1.0" encoding="UTF-8"?>
<monster name="Ashmunrah" nameDescription="an ashmunrah" race="undead" experience="3100" speed="320" manacost="0">
    <health now="5000" max="5000"/>
    <look type="87" corpse="6031"/>
    <targetchange interval="5000" chance="8"/>
    <strategy attack="100" defense="0"/>
    <flags>
        <flag summonable="0"/>
        <flag attackable="1"/>
        <flag hostile="1"/>
        <flag illusionable="0"/>
        <flag convinceable="0"/>
        <flag pushable="0"/>
        <flag canpushitems="1"/>
        <flag canpushcreatures="1"/>
        <flag targetdistance="1"/>
        <flag staticattack="90"/>
        <flag runonhealth="0"/>
    </flags>
    <attacks>
        <attack name="melee" interval="2000" skill="90" attack="200" poison="55"/>
        <attack name="lifedrain" interval="3000" chance="7" range="1" min="-100" max="-700"/>
        <attack name="poison" interval="2000" chance="12" range="7" min="-100" max="-500">
            <attribute key="shootEffect" value="poison"/>
            <attribute key="areaEffect" value="poison"/>
        </attack>
        <attack name="physical" interval="3000" chance="12" range="7" min="-120" max="-750">
            <attribute key="shootEffect" value="energy"/>
            <attribute key="areaEffect" value="mortarea"/>
        </attack>
        <attack name="speed" interval="3000" chance="25" range="7" speedchange="-650" duration="50000">
            <attribute key="areaEffect" value="redshimmer"/>
        </attack>
        <attack name="lifedrain" interval="2000" chance="18" length="8" spread="3" min="-50" max="-550">
            <attribute key="areaEffect" value="yellowbubble"/>
        </attack>
    </attacks>
    <defenses armor="25" defense="30">
        <defense name="healing" interval="1000" chance="20" min="200" max="400">
            <attribute key="areaEffect" value="blueshimmer"/>
        </defense>
        <defense name="invisible" interval="1000" chance="7" duration="2000">
            <attribute key="areaEffect" value="blueshimmer"/>
        </defense>
        <defense name="outfit" interval="1000" chance="3" monster="ancient scarab" duration="6000">
            <attribute key="areaEffect" value="blueshimmer"/>
        </defense>
    </defenses>
    <elements>
        <element earthPercent="100"/>
        <element deathPercent="100"/>
        <element holyPercent="-17"/>
    </elements>
    <immunities>
        <immunity lifedrain="1"/>
        <immunity paralyze="1"/>
        <immunity invisible="1"/>
    </immunities>
    <summons maxSummons="4">
        <summon name="Ancient Scarab" interval="1000" chance="2000" max="2"/>
        <summon name="Green Djinn" interval="1000" chance="1000" max="2"/>
    </summons>
    <voices interval="5000" chance="10">
        <voice sentence="No mortal or undead will steal my secrets!"/>
        <voice sentence="Ahhhh all those long years."/>
    </voices>
    <loot>
        <item id="2148" countmax="80" chance="50000"/><!-- gold coin -->
        <item id="2148" countmax="60" chance="50000"/><!-- gold coin -->
        <item id="2134" chance="7000"/><!-- silver brooch -->
        <item id="7590" chance="1500"/><!-- great mana potion -->
        <item id="2164" chance="1000"/><!-- might ring -->
        <item id="2487" chance="80000"/><!-- crown armor-->
        <item id="2140" chance="400"/><!-- holy scarab -->
    </loot>
    <script>
        <event name="reqMonsterDeath"/>
    </script>
</monster>
And get this error.
Code:
 [Warning - Monster::Monster] Unknown event name - reqMonsterDeath

And the rest of the scripts uses "reqMonsterDeath" not "ReqMonsterDeath"?
Just copy paste reqMonsterDeath everywhere that should fix the bug, never write out things like that even if it's 1 letter tbh
 
Please use code syntax highlighting.

You say you use OTX version 2?
Lets try a different XML syntax?
XML:
<event type="kill" name="reqMonsterDeath" event="script" value="hota/reqMonsterDeath.lua"/>

So it matches existing samples in the OTX 2 creaturescripts:
otxserver/creaturescripts.xml at otxserv2 · mattyx14/otxserver · GitHub

XML:
<?xml version="1.0" encoding="UTF-8"?>
<monster name="Ashmunrah" nameDescription="an ashmunrah" race="undead" experience="3100" speed="320" manacost="0">
    <health now="5000" max="5000"/>
    <look type="87" corpse="6031"/>
    <targetchange interval="5000" chance="8"/>
    <strategy attack="100" defense="0"/>
    <flags>
        <flag summonable="0"/>
        <flag attackable="1"/>
        <flag hostile="1"/>
        <flag illusionable="0"/>
        <flag convinceable="0"/>
        <flag pushable="0"/>
        <flag canpushitems="1"/>
        <flag canpushcreatures="1"/>
        <flag targetdistance="1"/>
        <flag staticattack="90"/>
        <flag runonhealth="0"/>
    </flags>
    <attacks>
        <attack name="melee" interval="2000" skill="90" attack="200" poison="55"/>
        <attack name="lifedrain" interval="3000" chance="7" range="1" min="-100" max="-700"/>
        <attack name="poison" interval="2000" chance="12" range="7" min="-100" max="-500">
            <attribute key="shootEffect" value="poison"/>
            <attribute key="areaEffect" value="poison"/>
        </attack>
        <attack name="physical" interval="3000" chance="12" range="7" min="-120" max="-750">
            <attribute key="shootEffect" value="energy"/>
            <attribute key="areaEffect" value="mortarea"/>
        </attack>
        <attack name="speed" interval="3000" chance="25" range="7" speedchange="-650" duration="50000">
            <attribute key="areaEffect" value="redshimmer"/>
        </attack>
        <attack name="lifedrain" interval="2000" chance="18" length="8" spread="3" min="-50" max="-550">
            <attribute key="areaEffect" value="yellowbubble"/>
        </attack>
    </attacks>
    <script>
        <event name="reqMonsterDeath"/>
    </script>
    <defenses armor="25" defense="30">
        <defense name="healing" interval="1000" chance="20" min="200" max="400">
            <attribute key="areaEffect" value="blueshimmer"/>
        </defense>
        <defense name="invisible" interval="1000" chance="7" duration="2000">
            <attribute key="areaEffect" value="blueshimmer"/>
        </defense>
        <defense name="outfit" interval="1000" chance="3" monster="ancient scarab" duration="6000">
            <attribute key="areaEffect" value="blueshimmer"/>
        </defense>
    </defenses>
    <elements>
        <element earthPercent="100"/>
        <element deathPercent="100"/>
        <element holyPercent="-17"/>
    </elements>
    <immunities>
        <immunity lifedrain="1"/>
        <immunity paralyze="1"/>
        <immunity invisible="1"/>
    </immunities>
    <summons maxSummons="4">
        <summon name="Ancient Scarab" interval="1000" chance="2000" max="2"/>
        <summon name="Green Djinn" interval="1000" chance="1000" max="2"/>
    </summons>
    <voices interval="5000" chance="10">
        <voice sentence="No mortal or undead will steal my secrets!"/>
        <voice sentence="Ahhhh all those long years."/>
    </voices>
    <loot>
        <item id="2148" countmax="80" chance="50000"/><!-- gold coin -->
        <item id="2148" countmax="60" chance="50000"/><!-- gold coin -->
        <item id="2134" chance="7000"/><!-- silver brooch -->
        <item id="7590" chance="1500"/><!-- great mana potion -->
        <item id="2164" chance="1000"/><!-- might ring -->
        <item id="2487" chance="80000"/><!-- crown armor-->
        <item id="2140" chance="400"/><!-- holy scarab -->
    </loot>
</monster>
 
Please use code syntax highlighting.

You say you use OTX version 2?
Lets try a different XML syntax?
XML:
<event type="kill" name="reqMonsterDeath" event="script" value="hota/reqMonsterDeath.lua"/>

So it matches existing samples in the OTX 2 creaturescripts:
otxserver/creaturescripts.xml at otxserv2 · mattyx14/otxserver · GitHub

XML:
<?xml version="1.0" encoding="UTF-8"?>
<monster name="Ashmunrah" nameDescription="an ashmunrah" race="undead" experience="3100" speed="320" manacost="0">
    <health now="5000" max="5000"/>
    <look type="87" corpse="6031"/>
    <targetchange interval="5000" chance="8"/>
    <strategy attack="100" defense="0"/>
    <flags>
        <flag summonable="0"/>
        <flag attackable="1"/>
        <flag hostile="1"/>
        <flag illusionable="0"/>
        <flag convinceable="0"/>
        <flag pushable="0"/>
        <flag canpushitems="1"/>
        <flag canpushcreatures="1"/>
        <flag targetdistance="1"/>
        <flag staticattack="90"/>
        <flag runonhealth="0"/>
    </flags>
    <attacks>
        <attack name="melee" interval="2000" skill="90" attack="200" poison="55"/>
        <attack name="lifedrain" interval="3000" chance="7" range="1" min="-100" max="-700"/>
        <attack name="poison" interval="2000" chance="12" range="7" min="-100" max="-500">
            <attribute key="shootEffect" value="poison"/>
            <attribute key="areaEffect" value="poison"/>
        </attack>
        <attack name="physical" interval="3000" chance="12" range="7" min="-120" max="-750">
            <attribute key="shootEffect" value="energy"/>
            <attribute key="areaEffect" value="mortarea"/>
        </attack>
        <attack name="speed" interval="3000" chance="25" range="7" speedchange="-650" duration="50000">
            <attribute key="areaEffect" value="redshimmer"/>
        </attack>
        <attack name="lifedrain" interval="2000" chance="18" length="8" spread="3" min="-50" max="-550">
            <attribute key="areaEffect" value="yellowbubble"/>
        </attack>
    </attacks>
    <script>
        <event name="reqMonsterDeath"/>
    </script>
    <defenses armor="25" defense="30">
        <defense name="healing" interval="1000" chance="20" min="200" max="400">
            <attribute key="areaEffect" value="blueshimmer"/>
        </defense>
        <defense name="invisible" interval="1000" chance="7" duration="2000">
            <attribute key="areaEffect" value="blueshimmer"/>
        </defense>
        <defense name="outfit" interval="1000" chance="3" monster="ancient scarab" duration="6000">
            <attribute key="areaEffect" value="blueshimmer"/>
        </defense>
    </defenses>
    <elements>
        <element earthPercent="100"/>
        <element deathPercent="100"/>
        <element holyPercent="-17"/>
    </elements>
    <immunities>
        <immunity lifedrain="1"/>
        <immunity paralyze="1"/>
        <immunity invisible="1"/>
    </immunities>
    <summons maxSummons="4">
        <summon name="Ancient Scarab" interval="1000" chance="2000" max="2"/>
        <summon name="Green Djinn" interval="1000" chance="1000" max="2"/>
    </summons>
    <voices interval="5000" chance="10">
        <voice sentence="No mortal or undead will steal my secrets!"/>
        <voice sentence="Ahhhh all those long years."/>
    </voices>
    <loot>
        <item id="2148" countmax="80" chance="50000"/><!-- gold coin -->
        <item id="2148" countmax="60" chance="50000"/><!-- gold coin -->
        <item id="2134" chance="7000"/><!-- silver brooch -->
        <item id="7590" chance="1500"/><!-- great mana potion -->
        <item id="2164" chance="1000"/><!-- might ring -->
        <item id="2487" chance="80000"/><!-- crown armor-->
        <item id="2140" chance="400"/><!-- holy scarab -->
    </loot>
</monster>
Done now the error does not appear in console, but it still does not work I'm sure it's the creaturescript script
 
Done now the error does not appear in console, but it still does not work I'm sure it's the creaturescript script

Do you get any prints on the console? If the script is loaded it should print out 1 and then continue till the script returns something.
 
If we have a look at the creatureevents.cpp file from OTX 2:
otxserver/creatureevent.cpp at otxserv2 · mattyx14/otxserver · GitHub
C++:
std::string CreatureEvent::getScriptEventName() const
{
    switch(m_type)
    {
        case CREATURE_EVENT_LOGIN:
            return "onLogin";
        case CREATURE_EVENT_LOGOUT:
            return "onLogout";
        case CREATURE_EVENT_SPAWN_SINGLE:
        case CREATURE_EVENT_SPAWN_GLOBAL:
            return "onSpawn";
        case CREATURE_EVENT_CHANNEL_JOIN:
            return "onChannelJoin";
        case CREATURE_EVENT_CHANNEL_LEAVE:
            return "onChannelLeave";
        case CREATURE_EVENT_CHANNEL_REQUEST:
            return "onChannelRequest";
        case CREATURE_EVENT_THINK:
            return "onThink";
        case CREATURE_EVENT_ADVANCE:
            return "onAdvance";
        case CREATURE_EVENT_LOOK:
            return "onLook";
        case CREATURE_EVENT_DIRECTION:
            return "onDirection";
        case CREATURE_EVENT_OUTFIT:
            return "onOutfit";
        case CREATURE_EVENT_MAIL_SEND:
            return "onMailSend";
        case CREATURE_EVENT_MAIL_RECEIVE:
            return "onMailReceive";
        case CREATURE_EVENT_TRADE_REQUEST:
            return "onTradeRequest";
        case CREATURE_EVENT_TRADE_ACCEPT:
            return "onTradeAccept";
        case CREATURE_EVENT_TEXTEDIT:
            return "onTextEdit";
        case CREATURE_EVENT_HOUSEEDIT:
            return "onHouseEdit";
        case CREATURE_EVENT_REPORTBUG:
            return "onReportBug";
        case CREATURE_EVENT_REPORTVIOLATION:
            return "onReportViolation";
        case CREATURE_EVENT_STATSCHANGE:
            return "onStatsChange";
        case CREATURE_EVENT_COMBAT_AREA:
            return "onAreaCombat";
        case CREATURE_EVENT_THROW:
            return "onThrow";
        case CREATURE_EVENT_PUSH:
            return "onPush";
        case CREATURE_EVENT_TARGET:
            return "onTarget";
        case CREATURE_EVENT_FOLLOW:
            return "onFollow";
        case CREATURE_EVENT_COMBAT:
            return "onCombat";
        case CREATURE_EVENT_ATTACK:
            return "onAttack";
        case CREATURE_EVENT_CAST:
            return "onCast";
        case CREATURE_EVENT_KILL:
            return "onKill";
        case CREATURE_EVENT_DEATH:
            return "onDeath";
        case CREATURE_EVENT_PREPAREDEATH:
            return "onPrepareDeath";
        case CREATURE_EVENT_EXTENDED_OPCODE:
            return "onExtendedOpcode";
        case CREATURE_EVENT_MOVEITEM:
            return "onMoveItem";
        case CREATURE_EVENT_NONE:
        default:
            break;
    }

    return "";
}
C++:
std::string CreatureEvent::getScriptEventParams() const
{
    switch(m_type)
    {
        case CREATURE_EVENT_LOGIN:
        case CREATURE_EVENT_SPAWN_SINGLE:
        case CREATURE_EVENT_SPAWN_GLOBAL:
            return "cid";
        case CREATURE_EVENT_LOGOUT:
            return "cid, forceLogout";
        case CREATURE_EVENT_CHANNEL_JOIN:
        case CREATURE_EVENT_CHANNEL_LEAVE:
            return "cid, channel, users";
        case CREATURE_EVENT_CHANNEL_REQUEST:
            return "cid, channel, custom";
        case CREATURE_EVENT_ADVANCE:
            return "cid, skill, oldLevel, newLevel";
        case CREATURE_EVENT_LOOK:
            return "cid, thing, position, lookDistance";
        case CREATURE_EVENT_MAIL_SEND:
            return "cid, target, item, openBox";
        case CREATURE_EVENT_MAIL_RECEIVE:
            return "cid, target, item, openBox";
        case CREATURE_EVENT_TRADE_REQUEST:
            return "cid, target, item";
        case CREATURE_EVENT_TRADE_ACCEPT:
            return "cid, target, item, targetItem";
        case CREATURE_EVENT_TEXTEDIT:
            return "cid, item, newText";
        case CREATURE_EVENT_HOUSEEDIT:
            return "cid, house, list, text";
        case CREATURE_EVENT_REPORTBUG:
            return "cid, comment";
        case CREATURE_EVENT_REPORTVIOLATION:
            return "cid, type, reason, name, comment, translation, statementId";
        case CREATURE_EVENT_THINK:
            return "cid, interval";
        case CREATURE_EVENT_DIRECTION:
        case CREATURE_EVENT_OUTFIT:
            return "cid, old, current";
        case CREATURE_EVENT_STATSCHANGE:
            return "cid, attacker, type, combat, value";
        case CREATURE_EVENT_COMBAT_AREA:
            return "cid, ground, position, aggressive";
        case CREATURE_EVENT_THROW:
            return "cid, item, fromPosition, toPosition";
        case CREATURE_EVENT_PUSH:
            return "cid, target, ground, position";
        case CREATURE_EVENT_COMBAT:
            return "cid, target, aggressive";
        case CREATURE_EVENT_TARGET:
        case CREATURE_EVENT_FOLLOW:
        case CREATURE_EVENT_ATTACK:
        case CREATURE_EVENT_CAST:
            return "cid, target";
        case CREATURE_EVENT_KILL:
            return "cid, target, damage, flags, war";
        case CREATURE_EVENT_DEATH:
            return "cid, corpse, deathList";
        case CREATURE_EVENT_PREPAREDEATH:
            return "cid, deathList";
        case CREATURE_EVENT_EXTENDED_OPCODE:
            return "cid, opcode, buffer";
        case CREATURE_EVENT_MOVEITEM:
            return "moveItem, frompos, topos, cid";
        case CREATURE_EVENT_NONE:
        default:
            break;
    }

    return "";
}

The onKill creature event takes these params:
cid, target, damage, flags, war

And
Lua:
local v = config[getCreatureName(cid):lower()]
seems like it takes the whole monster name and look for it it as lowercase in the config. Your monster config starts with capital letter on every monster.
Same issue with the config var name, you have written local Config =, and reference it using config.
Try this:
Lua:
local config = {
    -- ['Name'] = Storage,
    ['dipthrah'] = 321631,
    ['mahrdis'] = 321632,
    ['morguthis'] = 321633,
    ['omruc'] = 321634,
    ['rahemos'] = 321635,
    ['thalas'] = 321636,
    ['vashresamun'] = 321637,
    ['ashmunrah'] = 321638,
  }

function onKill(cid, target, damage, flags, war)
    local v = config[getCreatureName(cid):lower()]
    if isMonster(cid) and v then
        for _, killer in ipairs(deathList) do
                if getPlayerStorageValue(killer, v) ~= 1 then
                    setPlayerStorageValue(killer, v, 1)
                    addEvent(doPlayerSendTextMessage, 0.1, killer, MESSAGE_INFO_DESCR, 'Go to next room.')
                end
            end
        end
    return true
end

No idea how that "deathList" var is working tho... You don't have access to it since this is onKill, not onDeath.
Edit: Forgot to actually rename Config to config.
 
Last edited:
If we have a look at the creatureevents.cpp file from OTX 2:
otxserver/creatureevent.cpp at otxserv2 · mattyx14/otxserver · GitHub
C++:
std::string CreatureEvent::getScriptEventName() const
{
    switch(m_type)
    {
        case CREATURE_EVENT_LOGIN:
            return "onLogin";
        case CREATURE_EVENT_LOGOUT:
            return "onLogout";
        case CREATURE_EVENT_SPAWN_SINGLE:
        case CREATURE_EVENT_SPAWN_GLOBAL:
            return "onSpawn";
        case CREATURE_EVENT_CHANNEL_JOIN:
            return "onChannelJoin";
        case CREATURE_EVENT_CHANNEL_LEAVE:
            return "onChannelLeave";
        case CREATURE_EVENT_CHANNEL_REQUEST:
            return "onChannelRequest";
        case CREATURE_EVENT_THINK:
            return "onThink";
        case CREATURE_EVENT_ADVANCE:
            return "onAdvance";
        case CREATURE_EVENT_LOOK:
            return "onLook";
        case CREATURE_EVENT_DIRECTION:
            return "onDirection";
        case CREATURE_EVENT_OUTFIT:
            return "onOutfit";
        case CREATURE_EVENT_MAIL_SEND:
            return "onMailSend";
        case CREATURE_EVENT_MAIL_RECEIVE:
            return "onMailReceive";
        case CREATURE_EVENT_TRADE_REQUEST:
            return "onTradeRequest";
        case CREATURE_EVENT_TRADE_ACCEPT:
            return "onTradeAccept";
        case CREATURE_EVENT_TEXTEDIT:
            return "onTextEdit";
        case CREATURE_EVENT_HOUSEEDIT:
            return "onHouseEdit";
        case CREATURE_EVENT_REPORTBUG:
            return "onReportBug";
        case CREATURE_EVENT_REPORTVIOLATION:
            return "onReportViolation";
        case CREATURE_EVENT_STATSCHANGE:
            return "onStatsChange";
        case CREATURE_EVENT_COMBAT_AREA:
            return "onAreaCombat";
        case CREATURE_EVENT_THROW:
            return "onThrow";
        case CREATURE_EVENT_PUSH:
            return "onPush";
        case CREATURE_EVENT_TARGET:
            return "onTarget";
        case CREATURE_EVENT_FOLLOW:
            return "onFollow";
        case CREATURE_EVENT_COMBAT:
            return "onCombat";
        case CREATURE_EVENT_ATTACK:
            return "onAttack";
        case CREATURE_EVENT_CAST:
            return "onCast";
        case CREATURE_EVENT_KILL:
            return "onKill";
        case CREATURE_EVENT_DEATH:
            return "onDeath";
        case CREATURE_EVENT_PREPAREDEATH:
            return "onPrepareDeath";
        case CREATURE_EVENT_EXTENDED_OPCODE:
            return "onExtendedOpcode";
        case CREATURE_EVENT_MOVEITEM:
            return "onMoveItem";
        case CREATURE_EVENT_NONE:
        default:
            break;
    }

    return "";
}
C++:
std::string CreatureEvent::getScriptEventParams() const
{
    switch(m_type)
    {
        case CREATURE_EVENT_LOGIN:
        case CREATURE_EVENT_SPAWN_SINGLE:
        case CREATURE_EVENT_SPAWN_GLOBAL:
            return "cid";
        case CREATURE_EVENT_LOGOUT:
            return "cid, forceLogout";
        case CREATURE_EVENT_CHANNEL_JOIN:
        case CREATURE_EVENT_CHANNEL_LEAVE:
            return "cid, channel, users";
        case CREATURE_EVENT_CHANNEL_REQUEST:
            return "cid, channel, custom";
        case CREATURE_EVENT_ADVANCE:
            return "cid, skill, oldLevel, newLevel";
        case CREATURE_EVENT_LOOK:
            return "cid, thing, position, lookDistance";
        case CREATURE_EVENT_MAIL_SEND:
            return "cid, target, item, openBox";
        case CREATURE_EVENT_MAIL_RECEIVE:
            return "cid, target, item, openBox";
        case CREATURE_EVENT_TRADE_REQUEST:
            return "cid, target, item";
        case CREATURE_EVENT_TRADE_ACCEPT:
            return "cid, target, item, targetItem";
        case CREATURE_EVENT_TEXTEDIT:
            return "cid, item, newText";
        case CREATURE_EVENT_HOUSEEDIT:
            return "cid, house, list, text";
        case CREATURE_EVENT_REPORTBUG:
            return "cid, comment";
        case CREATURE_EVENT_REPORTVIOLATION:
            return "cid, type, reason, name, comment, translation, statementId";
        case CREATURE_EVENT_THINK:
            return "cid, interval";
        case CREATURE_EVENT_DIRECTION:
        case CREATURE_EVENT_OUTFIT:
            return "cid, old, current";
        case CREATURE_EVENT_STATSCHANGE:
            return "cid, attacker, type, combat, value";
        case CREATURE_EVENT_COMBAT_AREA:
            return "cid, ground, position, aggressive";
        case CREATURE_EVENT_THROW:
            return "cid, item, fromPosition, toPosition";
        case CREATURE_EVENT_PUSH:
            return "cid, target, ground, position";
        case CREATURE_EVENT_COMBAT:
            return "cid, target, aggressive";
        case CREATURE_EVENT_TARGET:
        case CREATURE_EVENT_FOLLOW:
        case CREATURE_EVENT_ATTACK:
        case CREATURE_EVENT_CAST:
            return "cid, target";
        case CREATURE_EVENT_KILL:
            return "cid, target, damage, flags, war";
        case CREATURE_EVENT_DEATH:
            return "cid, corpse, deathList";
        case CREATURE_EVENT_PREPAREDEATH:
            return "cid, deathList";
        case CREATURE_EVENT_EXTENDED_OPCODE:
            return "cid, opcode, buffer";
        case CREATURE_EVENT_MOVEITEM:
            return "moveItem, frompos, topos, cid";
        case CREATURE_EVENT_NONE:
        default:
            break;
    }

    return "";
}

The onKill creature event takes these params:
cid, target, damage, flags, war

And
Lua:
local v = config[getCreatureName(cid):lower()]
seems like it takes the whole monster name and look for it it as lowercase in the config. Your monster config starts with capital letter on every monster.
Same issue with the config var name, you have written local Config =, and reference it using config.
Try this:
Lua:
local config = {
    -- ['Name'] = Storage,
    ['dipthrah'] = 321631,
    ['mahrdis'] = 321632,
    ['morguthis'] = 321633,
    ['omruc'] = 321634,
    ['rahemos'] = 321635,
    ['thalas'] = 321636,
    ['vashresamun'] = 321637,
    ['ashmunrah'] = 321638,
  }

function onKill(cid, target, damage, flags, war)
    local v = config[getCreatureName(cid):lower()]
    if isMonster(cid) and v then
        for _, killer in ipairs(deathList) do
                if getPlayerStorageValue(killer, v) ~= 1 then
                    setPlayerStorageValue(killer, v, 1)
                    addEvent(doPlayerSendTextMessage, 0.1, killer, MESSAGE_INFO_DESCR, 'Go to next room.')
                end
            end
        end
    return true
end

No idea how that "deathList" var is working tho... You don't have access to it since this is onKill, not onDeath.
Edit: Forgot to actually rename Config to config.

Do you get any prints on the console? If the script is loaded it should print out 1 and then continue till the script returns something.
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.
 
Last edited:
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'] = 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 then
                    setPlayerStorageValue(killer, v, 1)
                    addEvent(doPlayerSendTextMessage, 0.1, killer, MESSAGE_INFO_DESCR, 'Go to next room.')
                end
            end
        end
    end

    return true
end
 
Last edited:
Solution
Back
Top