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

Denziz

New Member
Joined
May 2, 2013
Messages
81
Reaction score
4
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!

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:
@Up I am terribly sorry for that, Must've missed that.

Well when I enter the tile with the aid 7392 the client (tibia client) just simply crashes... And when I log back on, everything is normal... But when I step on the tiles I get like (error: movement, stack overflow).

@tetra20

Think you are able to help me?
 
Last edited by a moderator:
@Denziz
ah yea i have got that error before.
Change the Starting Tile to a already stepped on tile like this:
A8yno7.png

Like In This Photo
the white tile is different.you need to make the starting tile different.You SHOULDN"T BE ABLE TO PRESS ON IT.IT IS ALREADY PRESSED TILE
 
@tetra20

m8, I got another problem. House is not working.

"
[Warning - Houses::loadFromXml] House entry not set for: Forgotten headquarter (Flat 1, Area 42) (351)
[Warning - Houses::loadFromXml] House entry not set for: Forgotten headquarter (Flat 1, Area 42) (352)
"

What should I do? I cant buy houses.
 
  • Open yourservername/data/world/yourmapname-house.xml
  • Look For Id 351,352 and set them in the house.xml
  • OR
  • just delete them and recreate them through map editor
 
@tetra20

Code:
<house name="" houseid="351" entryx="0" entryy="0" entryz="0" rent="0" townid="0" size="25"/>
  <house name="" houseid="352" entryx="0" entryy="0" entryz="0" rent="0" townid="0" size="17"/>

Should I delete them and how do I recreate them using the map editor?
 
Last edited by a moderator:
@tetra20

PHP:
<house name="" houseid="351" entryx="0" entryy="0" entryz="0" rent="0" townid="0" size="25"/>
  <house name="" houseid="352" entryx="0" entryy="0" entryz="0" rent="0" townid="0" size="17"/>

Should I delete them and how do I recreate them using the map editor?
After You Have Found Them.Look in game which house isn't working and set its entryx-y-z-rent
For The Map Editor way i ain't really a mapper i just spam the tiles on the ground and Run :p
 
@tetra20

Cheers m8, I really do appreciate you'r time to help me out :p

Im an kind of newb. Anyways I got an scripts that I found in a downloaded datapack called bosskill.lua
It seems pretty interesting so I placed it in every specific scripting files that was needed for it to work. But the boss is not spawning! I have setted it all up, every posistion etc. As I said, I have registered everything in the xml files, also the login.lua for the creaturescript event. Well actually the boss have spawned BEFORE. But I guess then that the problem really is that the next boss is not spawning, as when I killed the boss it does not broadcast anything...

Script is from masiyah.se datapack, all credits goes to them I guess :D.

bosskill in creaturescripts
Code:
local config = {
    respawnSecs = 20, -- how many seconds until next boss spawns
    storage = 70320,
    bosspos = {x=1065,y=1634,z=7},
    bossspawnstorage = 70322
}

local t = {'morgaroth','ghazbaran','ferumbras','madareth','annihilon','ferumbras','devovorga','orshabaal','hellgorak','latrivan','massacre','ushuriel','zugurosh'}

local function f()
    doCreateMonster(t[math.random(#t)], config.bosspos, false, true, true)
    doBroadcastMessage('A new boss has spawned in the boss arena!', MESSAGE_STATUS_CONSOLE_ORANGE)
    doSetStorage(config.bossspawnstorage, 0)
end

function onKill(cid, target, damage, flags)
    if bit.band(flags, 1) == 1 and isMonster(target) and getCreatureMaster(target) == target and getPlayerStorageValue(cid,config.storage) == 1 then
        local s = getCreatureName(target)
        if isInArray(t, s:lower()) and getStorage(config.bossspawnstorage) == 0 then
            doBroadcastMessage(getCreatureName(cid)..' has just killed the boss "'..s..'", a new boss will spawn in '..config.respawnSecs..' seconds!', MESSAGE_STATUS_CONSOLE_ORANGE)
            doSetStorage(config.bossspawnstorage,1)
            addEvent(f, config.respawnSecs*1000)
        end
    end
    return true
end

Bossarenatp.lua
Code:
local config = {
tppos = {x=1064,y=1626,z=7}, -- WHERE TO TELEPORT TO.
monsterpos = {x=1065,y=1634,z=7}, -- WHERE MONSTER TELEPORTS.
maxplayers = 10, -- HOW MANY PLAYERS CAN ENTER.
globalstorage = 70290,
monsterstorage = 70310,
enteredArea = 70300, -- EMPTY PLAYER STORAGE.
exhauststorage = 70340 -- EMPTY PLAYER STORAGE.
}

local monsters = {'morgaroth','ghazbaran','ferumbras','madareth','annihilon','ferumbras','devovorga','orshabaal','hellgorak','latrivan','massacre','ushuriel','zugurosh'}
function onStepIn(cid,item,pos,fromPos)
    if isPlayer(cid) then
        if getPlayerLevel(cid) < 100 then
            doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,'You need to be of Level 100 or higher to enter.')
        else
            local g = math.max(0, getStorage(config.globalstorage)) + 1
            if g > config.maxplayers then
                doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,'Too many players are participating already.')
            elseif exhaustion.check(cid,config.exhauststorage) then
                doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,'You can\'t enter yet, you\'ll have to wait '..exhaustion.get(cid,config.exhauststorage)..' more seconds.')
            else
                doSetStorage(config.globalstorage, g)
                doCreatureSetStorage(cid,config.enteredArea,1)
                doTeleportThing(cid,config.tppos)
                doSendMagicEffect(config.tppos, CONST_ME_TELEPORT)
                doSendMagicEffect(pos,CONST_ME_POFF)
                if getStorage(config.monsterstorage) < 1 then
                    doCreateMonster(monsters[math.random(#monsters)],config.monsterpos)
                    doSendMagicEffect(config.monsterpos,CONST_ME_TELEPORT)
                    doSetStorage(config.monsterstorage,1)
                end
                return
            end
        end
        doTeleportThing(cid, {x=32369,y=32241, z=7})
        doSendMagicEffect({x=32369, y=32241, z=7}, CONST_ME_TELEPORT)
    end
end

function onAddItem(moveitem, tileitem, pos)
    pos.x = pos.x + 3
    doTeleportThing(moveitem.uid, pos)
    doSendMagicEffect(pos, 12)
end

bossarenatpout
Code:
local config = {
tppos = {x=32369,y=32241,z=7}, -- WHERE TO TELEPORT TO. (SHOULD BE CENTER OF THE ROOM)
maxplayers = 10, -- HOW MANY PLAYERS CAN ENTER.
globalstorage = 70290,
monsterstorage = 70310,
enteredArea = 70320,
from = {x=1056, y=1624, z=7}, -- AREA UPPERLEFT CORNER.
to = {x=1073, y=1642, z=7}, -- AREA LOWERRIGHT CORNER.
bossspawnstorage = 70322,
exhausttimer = 5, -- EXHAUSTION IN MINUTES.
exhauststorage = 70340
}

local from, to = config.from, config.to

function onStepIn(cid,item,pos,fromPos)
    local v = getThingPos(cid)
    if isPlayer(cid) then
        if getStorage(config.bossspawnstorage) > 0 then
            doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,'Please wait until the next boss is spawned before leaving.')
            doTeleportThing(cid, fromPos, true)
            return true
        end
        exhaustion.set(cid,config.exhauststorage,config.exhausttimer*60)
        local s = math.max(0, getStorage(config.globalstorage) - 1)
        doSetStorage(config.globalstorage, s)
        doBroadcastMessage('['..s..'/'..config.maxplayers..'] people are in boss event now!')
        doTeleportThing(cid,config.tppos)
        doSendMagicEffect(pos,CONST_ME_POFF)
        doSendMagicEffect(config.tppos,CONST_ME_TELEPORT)
        doCreatureSetStorage(cid,config.enteredArea)
        if s == 0 then
            doSetStorage(config.monsterstorage,0)
            for x = from.x, to.x do
                for y = from.y, to.y do
                    local v = getTopCreature({x=x, y=y, z=from.z})
                    if v.type == 2 then
                        doRemoveCreature(v.uid)
                    end
                end
            end
        end
    end
    return true
end

@tetra20
Also now when I am starting up the server, this shows up.

"WARNING: Could not load house data"
 
Last edited by a moderator:
Try This One
Code:
 local config = {
  respawnSecs = 20, -- how many seconds until next boss spawns
  storage = 70320,
  bosspos = {x=1065,y=1634,z=7},
  bossspawnstorage = 70322
}

local t = {'morgaroth','ghazbaran','ferumbras','madareth','annihilon','ferumbras','devovorga','orshabaal','hellgorak','latrivan','massacre','ushuriel','zugurosh'}

local function f()
  doCreateMonster(t[math.random(#t)], config.bosspos, false, true, true)
  doBroadcastMessage('A new boss has spawned in the boss arena!', MESSAGE_STATUS_CONSOLE_ORANGE)
  doSetStorage(config.bossspawnstorage, 0)
end

function onKill(cid, target, damage, flags)
  if isMonster(target) and getPlayerStorageValue(cid,config.storage) == 1 then
  local s = getCreatureName(target)
     for i = 1,#t do
  if s:lower() == t[i] and getStorage(config.bossspawnstorage) == 0 then
  doBroadcastMessage(getCreatureName(cid)..' has just killed the boss "'..s..'", a new boss will spawn in '..config.respawnSecs..' seconds!', MESSAGE_STATUS_CONSOLE_ORANGE)
  doSetStorage(config.bossspawnstorage,1)
  addEvent(f, config.respawnSecs*1000)
  end
     end
  end
  return true
end
 
@tetra20

Here you go xD

Code:
local config = {
  respawnSecs = 180, -- how many seconds until next boss spawns
  storage = 80320,
  bosspos = {x=1065,y=1634,z=7},
  bossspawnstorage = 80322
}

local t = {'morgaroth','ghazbaran','ferumbras','madareth','annihilon','ferumbras','orshabaal','hellgorak','latrivan','massacre','ushuriel','zugurosh'}

local function f()
  doCreateMonster(t[math.random(#t)], config.bosspos, false, true, true)
  doBroadcastMessage('A new boss has spawned in the boss arena!', MESSAGE_STATUS_CONSOLE_ORANGE)
  doSetStorage(config.bossspawnstorage, 0)
end

function onKill(cid, target, damage, flags)
  if isMonster(target) and getPlayerStorageValue(cid,config.storage) == 1 then
  local s = getCreatureName(target)
     for i = 1,#t do
  if s:lower() == t[i] and getStorage(config.bossspawnstorage) == 0 then
  doBroadcastMessage(getCreatureName(cid)..' has just killed the boss "'..s..'", a new boss will spawn in '..config.respawnSecs..' seconds!')
  doSetStorage(config.bossspawnstorage,1)
  addEvent(f, config.respawnSecs*1000)
  end
     end
  end
  return true
end

@tetra20

Well skip that script... But I need help with the zombie script. When you win it keeps spamming to create zombies. That is really annoying.

EDIT: Well I also need help with LMS, when there is only 1 player left. It takes like 2 minutes for me to recive the reward... How come? How do I set so when there is 1 player left you instantly get your reward and are tped to the masterlocation.
 
Last edited by a moderator:
Back
Top