Hello there! I can't fix this... Someone I just simply can't. I am trying to make so pacman TGY script is working. I have placed the tgyfunctions in data/lib, and pacman.lua in movements folder also registered them in the movements.xml. Same as creaturescripts... pacmanhandle.lua , registered it also in the login.lua and creaturescripts.xml.
Still does not work... I have fixed all locations, i've even double-checked!
Please help me solve this problem, kind regards. Denziz
Still does not work... I have fixed all locations, i've even double-checked!
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 = 989, y = 1629, z = 7})
if dif > 1 then
doCreateMonster("Pacman Ghost", {x = 989, y = 1629, z = 7})
end
if dif > 2 then
doCreateMonster("Pacman Ghost", {x = 989, y = 1629, z = 7})
end
end
doSendAnimatedText({x = 989, y = 1629, 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).."/89", TEXTCOLOR_GREEN)
if cnt >= 89 then
doTeleportThing(cid, {x = 994, y = 1627, 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,2157, 5)
end
elseif item.actionid == 7392 then
-- HANDLE JOINING PERSON
local c = isCreatureInArea({x = 989, y = 1629, z = 7},{x = 999, y = 1639, 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, 2157) < 1 then
doTeleportThing(cid, fromPosition, true)
doPlayerPopupFYI(cid, "You need 1 Gold Nugget to play.")
return true
end
if doPlayerRemoveItem(cid, 2157, 1) then
setPlayerStorageValue(cid, 7948, os.time() + 360)
end
-- 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 i = 1, #pressedTiles do
doCreateItem(425, i)
end
pressedTiles = {}
gameStarted = false
doTeleportThing(cid, {x = 994, y = 1634, 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
Please help me solve this problem, kind regards. Denziz
Last edited by a moderator: