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

Destroy item by stepping on it

darcioantonio

www.adventurerpg.com.br
Joined
Jul 30, 2013
Messages
165
Solutions
1
Reaction score
4
Location
Brasil
Twitch
darcio_
YouTube
UCEXCOEw_dYchojHNz
I need a simple script When I go over an item in case a tree to step on it I want it to be removed I'm doing a plantation system and I want it when the player steps on the tree he kills her and removes her But I need it in a lamb because the trees will be planted randomly in the game.
 
XML:
<movevent type="StepIn" itemid="1111" event="script" value="plants.lua" />

Lua:
function onStepIn(cid, item, position, fromPosition)
   local config = {
       plants = {1111, 1112, 1113},
       broken_plant = 2222
   }
    if isInArray(config.plants, item.itemid) then
       doTransformItem(item.uid, config.broken_plant)
       doPlayerSendCancel(cid, "You step into plant and you broke it.")
       doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
       return true
   end
    return true
end
 
XML:
<movevent type="StepIn" itemid="1111" event="script" value="plants.lua" />

Lua:
function onStepIn(cid, item, position, fromPosition)
   local config = {
       plants = {1111, 1112, 1113},
       broken_plant = 2222
   }
    if isInArray(config.plants, item.itemid) then
       doTransformItem(item.uid, config.broken_plant)
       doPlayerSendCancel(cid, "You step into plant and you broke it.")
       doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
       return true
   end
    return true
end

Lua:
local config = {
    plants = {1111, 1112, 1113},
    broken_plant = 2222
}

function onStepIn(cid, item, position, fromPosition)
    if isInArray(config.plants, item.itemid) then
       doTransformItem(item.uid, config.broken_plant)
       doPlayerSendCancel(cid, "You step into plant and you broke it.")
       doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
   end
 
    return true
end
 
Last edited by a moderator:
Back
Top