• 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 Correct this please rep +

Silentsniper

New Member
Joined
Sep 20, 2009
Messages
81
Reaction score
0
Code:
local t = {
    storage = 32001,
    monster = {"Outlaw", {x=996, y=999, z=7}},
    msg = "Oh no! outlaw appeared, you have to kill him to get out of here.."
}
function onStepIn(cid, item, position, fromPosition)
        if item.id == 3415 then       
        doPlayerRemoveItem(cid,2160,10)
        doSummonCreature(t.monster[1], t.monster[2])
    end
    return TRUE
end
Im new to this, i want it so when i step on the tile, if i have the item 3415, it ill take 10 crystal coins and spawn a monster. I want it to only work if i have that item in my bag. Thanx :D
btw ill rep you dont worry xD please correct me.
 
Last edited:
LMAO EPIC FAILURE EVERYONE
nobody thought to check if the creature is player xDDD i saw Silentsniper posting an error log of that
and other failture in other scripts

well anyways try mine, tell if works :D

Set tile uid to 2909 in the map
Lua:
<movevent type="StepIn" uniqueid="2909" event="script" value="script.lua" />

Lua:
local t = {
    storage = 32001,
    monster = {'Outlaw', {x=996, y=999, z=7}},
    msg = 'Oh no! '..t.monster[1]..' appeared, you have to kill him to get out of here!',
    reqItem = 2974, --here the itemID that the player must have
    money = 100000, --10 Crystal Coins
}

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
    if not isPlayer(cid) then
        return true
    end
    
    if getPlayerItemCount(cid,t.reqItem) < 1 then
        doPlayerSendCancel(cid, 'You do not have the required item.')
        return true
    end
        
    if doPlayerRemoveMoney(cid, t.money) then 
        doCreateMonster(string.lower(t.monster[1]), t.monster[2])
        doCreatureSay(cid, t.msg, TALKTYPE_ORANGE_1)
    else
        doPlayerSendCancel(cid, 'You do not have enough money to summon the creature.')
        return true
    end
    
    return true
end
 
Last edited:
Code:
[08/07/2010 18:21:31] Lua Script Error: [MoveEvents Interface] 
[08/07/2010 18:21:31] data/movements/scripts/script.lua

[08/07/2010 18:21:31] data/movements/scripts/script.lua:4: attempt to index global 't' (a nil value)
[08/07/2010 18:21:31] [Warning - Event::loadScript] Cannot load script (data/movements/scripts/script.lua)
.____.
 
k i get it, i saw that working before
Lua:
  local t =  {
    storage = 32001,
    monster = {'Outlaw', {x=996, y=999, z=7}},
    msg = 'Oh no! Outlaw appeared, you have to kill him to get out of here!',
    reqItem = 2974, --here the itemID that the player must have
    money = 100000, --10 Crystal Coins
}

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
    if not isPlayer(cid) then
        return true
    end
   
    if getPlayerItemCount(cid,t.reqItem) < 1 then
        doPlayerSendCancel(cid, 'You do not have the required item.')
        return true
    end
       
    if doPlayerRemoveMoney(cid, t.money) then
        doCreateMonster(string.lower(t.monster[1]), t.monster[2])
        doCreatureSay(cid, t.msg, TALKTYPE_ORANGE_1)
    else
        doPlayerSendCancel(cid, 'You do not have enough money to summon the creature.')
        return true
    end
   
    return true
end
 
Back
Top