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

Lua key inside monster

popitox

Member
Joined
Jul 8, 2008
Messages
63
Reaction score
8
when a monster die's i would like it drops for example a golden key (2091) with a action id
 
already try that and its not working xD, at the moment i dont know how to do that, but by the moment im using a script when the boss die it would open a teleport from where i want it, and then the teleport closes after 30 secs
 
already try that and its not working xD, at the moment i dont know how to do that, but by the moment im using a script when the boss die it would open a teleport from where i want it, and then the teleport closes after 30 secs
It can't not work. It's been like Vulcan_ said for years and years.
There no reason it should not work unless you've done something incorrectly.
 
Can confirm it doesn't work in a fresh TFS 1.3 installation.
I'm assuming you are using 1.x~:
You can always go with Creature script way:

Creature scripts/scripts/customLoot.lua
Lua:
local items = {
    [1] = {itemId = 2365, actionID = 9000},
    [2] = {itemId = 2651, actionID = 9001}
}
local chance = 90

function onDeath(player, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)
    local container = Container(corpse.uid)
    local rand = math.random(1, 100)
        if container and rand <= chance then
            local item = items[math.random(#items)]
            container:addItem(item.itemId, 1):setActionId(item.actionID)
            return true
        end
    return true
end

Where items is random items to insert in monster loot and actionID is the AID you want in that item and chance is 90% chance to get it.

creaturescripts/creaturescripts.xml
XML:
<event type="death" name="Otland" script="customLoot.lua" />

And insert in your monster .xml

XML:
   <script>
        <event name="Otland"/>
    </script>

As so:
XML:
<?xml version="1.0" encoding="ISO-8859-1"?>
<monster name="Test" nameDescription="an test" race="blood" experience="1" speed="0" manacost="390">
    <health now="100" max="100" />
    <look type="137" head="113" body="120" legs="114" feet="132" corpse="20323" />
    <targetchange interval="4000" chance="10" />
    <flags>
        <flag summonable="1" />
        <flag attackable="1" />
        <flag hostile="1" />
        <flag illusionable="1" />
        <flag convinceable="1" />
        <flag pushable="0" />
        <flag canpushitems="1" />
        <flag canpushcreatures="0" />
        <flag targetdistance="4" />
        <flag staticattack="90" />
        <flag runonhealth="10" />
        <flag canwalkonenergy="0" />
        <flag canwalkonfire="0" />
        <flag canwalkonpoison="0" />
    </flags>
    <attacks>
        <attack name="melee" interval="2000" min="0" max="-45" />
        <attack name="physical" interval="2000" chance="1" range="7" min="0" max="0">
            <attribute key="shootEffect" value="throwingknife" />
        </attack>
    </attacks>
    <defenses armor="0" defense="0" />
    <elements>
        <element physicalPercent="0" />
        <element deathPercent="0" />
    </elements>
    <script>
        <event name="Otland"/>
    </script>
    <voices interval="5000" chance="10">
        <voice sentence="Yeeee ha!" />
        <voice sentence="Your head shall be mine!" />
        <voice sentence="Your head will be mine!" />
    </voices>
    <loot>
        <item id="2050" actionid="1001" chance="100000" /><!-- torch -->
    </loot>
</monster>

Edit: Forgot the ActionID
 
Last edited:
Ignore my pass answer, found the error:
XML:
 <loot>
    <item id="2091" actionId="xxxx" chance="100000"/>
</loot>

With capital I
 
Solution
Back
Top