• 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:
This is strange 'cause it's the same that player have item in backpack or in any slot :(
 
Last edited:
3415, is not crystal coin.. 3415 is a wall >.<

anyway, heres the script. :) fixed.

but insted of outlaws i took rat =)
Code:
local t = {
    storage = 32002,
    monster = {"rat", {x=90, y=120, z=7}},
    msg = "Oh no! A Rat appeared, you have to kill it to get out of here.."
}

function onStepIn(cid, item, position, fromPosition)
	if doPlayerRemoveItem(cid, 2160, 10) then    
	doCreatureSay(cid, t.msg, TALKTYPE_ORANGE_1)
        doSummonCreature(t.monster[1], t.monster[2])

		else 

	doPlayerSendCancel(cid, "Sorry but you need to have 10 crystal coins to enter.")
    return TRUE
end
end
 
Last edited:
I think that he want that:
If player have item with id == 3415 (or something else) then remove 10 crystal coins and then summon creature also he want:
"I want it to only work if i have that item in my bag."
 
Why you add storage? if is not are in use o_O?

script:

Lua:
local t = {
    monster = "rat",
    pos = {x=90, y=120, z=7},
    msg = "Oh no! A Rat appeared, you have to kill it to get out of here.."
}

function onStepIn(cid, item, position, fromPosition)
	if getPlayerItemCount(cid,2160,10) == 1 then
           doPlayerRemoveItem(cid, 2160, 10) 
              doSummonCreature(t.monster,t.pos)
                 doCreatureSay(cid, t.msg, TALKTYPE_ORANGE_1)
	     else 
                   doPlayerSendCancel(cid, "Sorry but you need to have 10 crystal coins to enter.")
            return TRUE
        end
end
 
Last edited:
Why you add storage? if is not are in use o_O?

script:

Lua:
local t = {
    monster = "rat",
    pos = {x=90, y=120, z=7},
    msg = "Oh no! A Rat appeared, you have to kill it to get out of here.."
}

function onStepIn(cid, item, position, fromPosition)
	if getPlayerItemCount(cid,2160,10) == 1 then
           doPlayerRemoveItem(cid, 2160, 10) 
              doSummonCreature(t.monster)
                 doCreatureSay(cid, t.msg, TALKTYPE_ORANGE_1)
	     else 
                   doPlayerSendCancel(cid, "Sorry but you need to have 10 crystal coins to enter.")
            return TRUE
        end
end

buged, add after t.monster

Lua:
,t.pos
 
ok the script doesnt work, but i accually meant that if i have the item 9693 in my bag, then it will take the 10 cc and spawn a monster. It will only spawn a monster if i have the item 9693. i still repped aveo and wibben and tayron. but can someone make the script like that ill rep you too =D btw VirrageS was right, thats what i meant
 
Code:
  local t =  {
    monster = "rat",
    pos = {x=90, y=120, z=7},
    msg = "Oh no! A Rat appeared, you have to kill it to get out of here.."
}

function onStepIn(cid, item, position, fromPosition)
        if getPlayerItemCount(cid, 2160, 10, 9693, 1) == 1 then
           doPlayerRemoveItem(cid, 2160, 10)
              doSummonCreature(t.monster,t.pos)
                 doCreatureSay(cid, t.msg, TALKTYPE_ORANGE_1)
             else
                   doPlayerSendCancel(cid, "Sorry but you need to have money and special item to enter.")
            return TRUE
        end
end
 
Last edited:
i dont want the puppet to be removed lmao, ill take tht part out and test it. cause the script didnt work before, even when i had 10 coins.
 
script doesnt work, regardless, it have all the items, it still says the message that im missing items. It states this:
Code:
[04/07/2010 20:40:41] Lua Script Error: [MoveEvents Interface] 
[04/07/2010 20:40:41] data/movements/scripts/monster1.lua:onStepIn

[04/07/2010 20:40:41] luaGetPlayerItemCount(). Player not found
 
Code:
local t = {
  monster = "rat",
  pos = {x = 90, y = 120, z = 7}
}

function onUse (cid, item, fromPosition, itemEx, toPosition)
    if doPlayerRemoveMoney(cid, 100000) then
      doSummonCreature(t.monster,t.pos)
      doCreatureSay(cid, "Oh no! A Rat appeared, you have to kill it to get out of here..",TALKTYPE_ORANGE_1)
    else
      doPlayerSendCancel(cid, "Sorry, you do not have enough money.")
    end
    return true
  end
 
Oh wow my bad i meant it you have the item 9693. sorry i was messed up yesterday =D ill try aveos and if it works ill rep :]

Lua:
local pos = {x=90, y=120, z=7},
function onStepIn(cid, item, position, fromPosition)
	if getPlayerItemCount(cid,2160,10) == 1 then
           doPlayerRemoveItem(cid, 2160, 10)
              doSummonCreature(rat, pos)
               return doCreatureSay(cid, Oh no! A Rat appeared, you have to kill it to get out of here.., TALKTYPE_ORANGE_1)
	     else
                  return doPlayerSendCancel(cid, "Sorry but you need to have 10 crystal coins to enter.")
        end

Thanks & np.
 
Back
Top