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

Ondeath remove stone (monster freeze)

Massen

Masserv RPG
Joined
Jul 23, 2007
Messages
324
Reaction score
1
Location
Sweden
So I'm having a quite annoying bug with this creaturescript. The script is suppose to remove a stone when a creature called Murrivel dies. One minute later the stone should be added again.

When I kill murrivel however the stone aint removed. And I get no error...

Here is the script

data/creaturescripts/creaturescripts.xml
Code:
    <event type="kill" name="MurrivelStorage" script="murrivel.lua"/>

data/creaturescripts/scripts/murrivel.lua

Lua:
function onKill(cid, target)
    local monster = getCreatureName(target)
    local timeLimit = 1000 * 60 * 2 -- 2 minutes for the stone to move back.
    local stonePosition = {x=1030, y=1133, z=4, stackpos=1}
    local stone = getThingfromPos(stonePosition)
	
	
	
    if (monster == "Murrivel") then
        itemId = stone.itemid
        doRemoveItem(stone.uid, 1)
        doSendMagicEffect(stonePosition, 13)
        addEvent(moveStone, timeLimit, {stone.uid == stone.uid})
    end
return TRUE
end

function moveStone(timeLimit)
    if getPlayerPosition(cid) == stonePosition then
        doMoveCreature(cid, 2)
    end
    doSendMagicEffect(stonePosition, 13)
    doCreateItem(itemId, 1, stonePosition)
return TRUE
end

Inside login.lua I added this line
Code:
    registerCreatureEvent(cid, "MurrivelStorage")
and finally inside murrivel.xml (the monster file) i added this

Code:
<script>
    <event name="MurrivelStorage"/>
</script>
If anyone got a solution I deeply appreciate it!

thank you

//Massen
 
Last edited:
first of all, remove this:
PHP:
registerCreatureEvent(cid, "MurrivelStorage")

Change
PHP:
function onKill(cid, target)
to
PHP:
function onDeath(cid, corpse, killer)

Change
PHP:
<event type="kill" name="MurrivelStorage" script="murrivel.lua"/>
to
PHP:
<event type="death" name="Murrivel" event="script" value="murrivel.lua"/>
(assuming u use 03,3 or 03,4)

Then ill make an easy stone remove script for you, because the one you had is just bullshit and will never work. For instance, your event should be above the function so you can use local. And the guy who made it definetly dont know how to use events, cuz he tried to use uid (lol) in the event, and didnt use the param.

PHP:
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=1030, y=1133, z=4, stackpos=1}
	local stoneid = PUT YOUR STOOOOOONEID
    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 no, you dont need to the the monster name check, because the only monster that has this creaturescript registrer, is the murrivel.. what ur scripter was thinking ive no idea but he sucks for sure.

PLZZ REP MI
 
Last edited:
Back
Top