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

Solved Why isnt my item id : 425 pressed tile?

Imfreezing

Krossa Kapitalismen
Joined
Jun 7, 2012
Messages
1,009
Solutions
1
Reaction score
88
Location
Edron
as the title says when i spawn a 425 witch is a pressed tile,its not pressed its just like the normal 426 :p
please help
thanks
 
If you change that, then the tile won't be unpressed anymore at all.
What is the reason you want that it stays inpressed? If you add an other stepout script with just return true to it (with actionid/uniqueid instead of itemid), then it will stay unpressed.
 
If you change that, then the tile won't be unpressed anymore at all.
What is the reason you want that it stays inpressed? If you add an other stepout script with just return true to it (with actionid/uniqueid instead of itemid), then it will stay unpressed.
there is a event called pacman where u have to press down 84 tiles idk if ure familiar with it tough
 
You can add this.
Code:
function onStepOut(cid, item, position, fromPosition)
   return true
end
Then add it with the actionid the tiles have in movements.xml.
 
In \data\movements\movements-xml you'll find something like this:
<movevent event="StepOut" itemid="425" script="tiles.lua"/>

It tells the server than whenever a player leaves tile 425, it should run \data\movements\scripts\tiles.lua, and call function onStepOut() as shown in Limos' example.

My tiles.lua has this code in it:
Code:
function onStepOut(cid, item, position, fromPosition)
   if isInArray(decreasingItemID, item.itemid) then doTransformItem(item.uid, item.itemid - 1)
   elseif item.itemid == 425 then  doTransformItem(item.uid, item.itemid + 1)
   end
   return true
end

You can change that, but it would probably be better to connect the tile to a new script (change the xml) and use the code Limos provided.

Each tile in-game also has a unique item id - you could use those to limit your special processing to the exact tiles used by the PacMan event, but TBH I doubt it's worth the trouble.

Limos also mentioned actionids. Here's a line from movements.xml that uses them:
<movevent event="StepIn" actionid="15111" script="Enchanting/Ice.lua" />

I've ever used these. If I had to guess, I'd assume each tile type has a default actionid, and you can change it with the map editor.
If so, that would let you create a group of tiles (which could include different type of tile) all with the same actionid, and hence the same script - which, if that's how it works, would be a good way to implement the behavior you want.
 
where should i put that scipt?
Pacman uses actionids on these tiles if I remember correctly, so you can add it with that actionid in movements.xml, it would be the same as the stepin line for pacman, but then with stepout.
You can add it to the pacman movement script or add it in a new script, it doesn't really matter.
 
Solved , Thanks everyone! , :D s
maybe some day another guy might need help,basicly what i did was i made a new file called tiless and reinstalled the id 425/426 to that file,the script i used in it was the limos script
Code:
function onStepOut(cid, item, position, fromPosition)
  return true
end
:D
Thanks again guuyz
 
You have to add it in movements.xml with the actionid, not with the itemid.
The reason for adding this script is that tiles with that actionid will ignore the other script that transforms it, but it will still work for the tiles then without the actionid.
 
You have to add it in movements.xml with the actionid, not with the itemid.
The reason for adding this script is that tiles with that actionid will ignore the other script that transforms it, but it will still work for the tiles then without the actionid.

how do i add it, in movements.xml
Code:
function onStepOut(cid, item, position, fromPosition)
  return true
end
or should i add it in this?
Code:
-- Pacman script: Controller [TGY]
pressedTiles = {}
gameStarted = false
dif = 1

local function pacmanCounter(text, start, col, dif)
    if start then
        gameStarted = true
        doCreateMonster("Pacman Ghost", {x = 1246, y = 1537, z = 7})
        if dif > 1 then
            doCreateMonster("Pacman Ghost", {x = 1251, y = 1537, z = 7})
        end
        if dif > 2 then
            doCreateMonster("Pacman Ghost", {x = 1256, y = 1537, z = 7})
        end
    end
    doSendAnimatedText({x = 1251, y = 1542, z = 7}, text, col)
end

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
    if false == isPlayer(cid) then
        return
    end
   
    if item.actionid == 5301 and item.itemid == 426 then
        -- HANDLE TILE
        if not gameStarted then
            --doPlayerPopupFYI(cid, "x")
            doTeleportThing(cid, fromPosition, true)
            return true
        end
        doTransformItem(item.uid, 425)
        table.insert(pressedTiles, position)
        local cnt = #pressedTiles
        doSendAnimatedText(position, (cnt).."/84", TEXTCOLOR_GREEN)
        if cnt > 83 then
            doTeleportThing(cid, {x = 1003, y = 1000, z = 7}, true)
            doSendAnimatedText(position, ":D", TEXTCOLOR_GREEN)
            local prize = 5
            if dif == 2 then prize = 10 end
            if dif == 3 then prize = 20 end
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "[PACMAN] You won ".. prize .." Game Tokens!")
            doPlayerAddItem(cid,6527,prize)
        end
    elseif item.actionid == 7392 then
        -- HANDLE JOINING PERSON
        local c = isCreatureInArea({x = 1246, y = 1537, z = 7},{x = 1256, y = 1547, z = 7}) -- Getting crss inside
        for _,v in pairs(c) do
            if isPlayer(v) then
                doTeleportThing(cid, fromPosition, true)
                return true
            end
        end
        -- Nobody is inside, check ticket/pick it - check exhaust first
        --doPlayerPopupFYI(cid, "You must wait " .. (math.floor((getPlayerStorageValue(cid, 7948)-os.time())/60)+1) .. " more minutes till you can play again.")
        if getPlayerStorageValue(cid, 7948) > 0 and (os.time() < getPlayerStorageValue(cid, 7948)) then
            doTeleportThing(cid, fromPosition, true)
            doPlayerPopupFYI(cid, "You must wait " .. (math.floor((getPlayerStorageValue(cid, 7948)-os.time())/60)+1) .. " more minute(s) till you can play again.")
            return true
        end
        if getPlayerItemCount(cid, 6527) < 1 then
            doTeleportThing(cid, fromPosition, true)
            doPlayerPopupFYI(cid, "You need 1 Game Token to play.")
            return true
        end
        doPlayerRemoveItem(cid, 6527, 1)
        setPlayerStorageValue(cid, 7948, os.time() + 900)
        -- Set difficulity variabele
        dif = 1
        if item.uid == 7396 then
            dif = 2
        elseif item.uid == 7397 then
            dif = 3
        end
        -- Clean the area and reset the tiles now
        for _,v in pairs(c) do
            doRemoveCreature(v)
        end
        for _,v in pairs(pressedTiles) do
            doItemSetAttribute(doCreateItem(426, v),"aid", 5301)
        end
        pressedTiles = {}
        gameStarted = false
        doTeleportThing(cid, {x = 1251, y = 1542, z = 7}, true)
        pacmanCounter("3", false, TEXTCOLOR_RED, dif)
        addEvent(pacmanCounter,1000,"2", false, TEXTCOLOR_ORANGE, dif)
        addEvent(pacmanCounter,2000,"1", false, TEXTCOLOR_YELLOW, dif)
        addEvent(pacmanCounter,3000,"GO!", true, TEXTCOLOR_GREEN, dif)
    end
   
  return true
end
thanks
 
Add it to a Lua file, it doesn't matter which one, you can also add it to that Lua file at the bottom for example.
Add it in movements.xml with the actionid, same actionid as the tile has.
 
Back
Top