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

Remove a stone when you kill a monster

Imfreezing

Krossa Kapitalismen
Joined
Jun 7, 2012
Messages
1,009
Solutions
1
Reaction score
88
Location
Edron
Hey otland I got this script, it is suppose to remove a stone when i kill a boss, well it doesn't
here is the script
Code:
local function moveStone(p)
    if isPlayer(getThingfromPos(p.stonePosition).uid) == TRUE then
        doMoveCreature(cid, 2)
    end
    doSendMagicEffect(p.stonePosition, 13)
    doCreateItem(p.stoneid, 1, p.stonePosition)
end

function onKill(cid, target)
    local timeLimit = 1000 * 60 * 2 -- Minutes
    local stonePosition = {x=1384, y=1806, z=9, stackpos=1}
    local stoneid = 7825
    local stone = getTileItemById(stonepos, stoneid)

    if stone.uid ~= 0 then
        doRemoveItem(stone.uid, 1)
        doSendMagicEffect(stonePosition, 13)
        addEvent(moveStone, timeLimit, {stonePosition = stonePosition, stoneid = stoneid})
    end

    return TRUE
end
and yep, i have it registred in the monster and in the creatureevent.xml
Error
:
qS-NLzfex.png

and
OEPPrb9dw.png

0.4 3777
thank you :D
 
Data>creaturescripts>scripts>stonefile.lua
Code:
    local timeLimit = 1000 * 60 * 2 -- Minutes
    local stonePosition = {x=1384, y=1806, z=9, stackpos=1}
    local stoneid = 7825
    local stone = getThingFromPos(stonePosition)
    local player_check = {x=1384, y=1806, z=9, stackpos=255}
    local monster = "monster name"

function onKill(cid, target)
if(not isMonster(target).uid) then
return true
end

if getCreatureName(target) == monster then
    if stone.uid ~= 0 then
        doRemoveItem(stone.uid)
        doSendMagicEffect(stonePosition, 13)
        addEvent(moveStone, timeLimit)
    end
end

    return TRUE
end 

local function moveStone()
    if isPlayer(getThingfromPos(player_check).uid) == TRUE then
        doMoveCreature(cid, 2)
    end
    doSendMagicEffect(stonePosition, 13)
    doCreateItem(stoneid, 1, stonePosition)
end

data>creaturescripts.xml

Code:
<event type="kill" name="removeStone" event="script" value="stonefile.lua"/>

Then in monster file after </flags> put:
Code:
<script>
<event name="removeStone"/>
</script>

If that script doesn't work try changing: stackpos = 1 to stackpos = 0
 
Last edited by a moderator:
Data>creaturescripts>scripts>stonefile.lua
Code:
    local timeLimit = 1000 * 60 * 2 -- Minutes
    local stonePosition = {x=1384, y=1806, z=9, stackpos=1}
    local stoneid = 7825
    local stone = getThingFromPos(stonePosition)
    local player_check = {x=1384, y=1806, z=9, stackpos=255}
    local monster = "monster name"

function onKill(cid, target)
if(not isMonster(target).uid) then
return true
end

if getCreatureName(target) == monster then
    if stone.uid ~= 0 then
        doRemoveItem(stone.uid)
        doSendMagicEffect(stonePosition, 13)
        addEvent(moveStone, timeLimit)
    end
end

    return TRUE
end

local function moveStone()
    if isPlayer(getThingfromPos(stonePosition).uid) == TRUE then
        doMoveCreature(cid, 2)
    end
    doSendMagicEffect(stonePosition, 13)
    doCreateItem(stoneid, 1, stonePosition)
end

data>creaturescripts.xml

Code:
<event type="kill" name="removeStone" event="script" value="stonefile.lua"/>

Then in monster file after </flags> put:
Code:
<script>
<event name="removeStone"/>
</script>


player_check thing not being used. :)
 
@Itutorial will be trying this immedietly when I get home, will post result here! thank you

@Itutorial Hmmm my ot cant start with that script, it just "has stopped working" in loading scripts Z:

BumP
 
Last edited by a moderator:
Back
Top