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

Pacman System

freddzor11

Member
Joined
May 25, 2009
Messages
695
Reaction score
5
I have a pacman system, It worked perfectly for a few days ago but I changed something that I don't know what it is, and now when Pacman ghost kill me I really die not just tp'd out of the pacman event
 

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 = 716, y = 937, z = 7})
        if dif > 1 then
            doCreateMonster("Pacman Ghost", {x = 726, y = 937, z = 7}) 
        end
        if dif > 2 then
            doCreateMonster("Pacman Ghost", {x = 721, y = 937, z = 7}) 
        end
    end
    doSendAnimatedText({x = 721, y = 942, 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 = 717, y = 934, z = 6}, true)
            doSendAnimatedText(position, ":D", TEXTCOLOR_GREEN)
            local prize = 5
            if dif == 2 then prize = 15 end
            if dif == 3 then prize = 30 end
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "[PACMAN] You won ".. prize .." Gold Nuggets!")
            doPlayerAddItem(cid,2157,prize)
        end
    elseif item.actionid == 7392 then
        -- HANDLE JOINING PERSON
        local c = isCreatureInArea({x = 716, y = 937, z = 7}, {x = 726, y = 947, 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
        doPlayerRemoveItem(cid, 2157, 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 = 721, y = 942, 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
 
Did it work before you modified the script? And are you using the pacman monster from tgyoshi aswell? If it did work before you must have removed smth wrong.
 
Did it work before you modified the script? And are you using the pacman monster from tgyoshi aswell? If it did work before you must have removed smth wrong.

don't know actually
here is my pacman ghost script
Code:
<?xml version="1.0" encoding="UTF-8"?>
<monster name="Pacman Ghost" nameDescription="a pacman ghost" race="undead" experience="0" speed="260" manacost="100">
    <health now="15000000" max="15000000"/>
    <look type="48" corpse="5993"/>
    <targetchange interval="5000" chance="8"/>
    <strategy attack="100" defense="0"/>
    <flags>
        <flag summonable="0"/>
        <flag attackable="0"/>
        <flag hostile="1"/>
        <flag illusionable="0"/>
        <flag convinceable="0"/>
        <flag pushable="0"/>
        <flag canpushitems="1"/>
        <flag canpushcreatures="0"/>
        <flag targetdistance="1"/>
        <flag staticattack="90"/>
        <flag runonhealth="0"/>
    </flags>
    <attacks>
        <attack name="melee" interval="1000" skill="45" attack="400000000"/>
    </attacks>
    <defenses armor="10" defense="10"/>
    <elements>
        <element firePercent="100"/>
        <element physicalPercent="100"/>
        <element earthpercent="100"/>
        <element energyPercent="100"/>
        <element deathPercent="100"/>
        <element icePercent="100"/>
        <element holyPercent="100"/>
        <element poisonPercent="100"/>
    </elements>
    <immunities>
        <immunity invisible="1"/>
        <immunity lifedrain="1"/>
        <immunity paralyze="1"/>
    </immunities>
    <voices interval="5000" chance="10">
        <voice sentence="Omnomnom!"/>
    </voices>
    <loot>
    <item id="2404" chance="8400" /><!-- combat knife -->
</loot>








</monster>
 
Test this one(working for me)
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 = 270, y = 2019, z = 9})
        if dif > 1 then
            doCreateMonster("Pacman Ghost", {x = 280, y = 2019, z = 9}) 
        end
        if dif > 2 then
            doCreateMonster("Pacman Ghost", {x = 275, y = 2019, z = 9}) 
        end
    end
    doSendAnimatedText({x = 275, y = 2024, z = 9}, text, col)
end

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
    if false == isPlayer(cid) then
        return
    end
   
    if item.actionid == 5302 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 = 271, y = 2016, z = 8}, 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 = 270, y = 2019, z = 9},{x = 280, y = 2029, z = 9}) -- 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", 5302)
        end
        pressedTiles = {}
        gameStarted = false
        doTeleportThing(cid, {x = 275, y = 2024, z = 9}, 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

But you have to change pos to your, and make sure they are correct. I mapped the "pacman hole" at the same pos as masiyah did. Then you know the pos is right.
WibbenZ
 
Test this one(working for me)
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 = 270, y = 2019, z = 9})
        if dif > 1 then
            doCreateMonster("Pacman Ghost", {x = 280, y = 2019, z = 9})
        end
        if dif > 2 then
            doCreateMonster("Pacman Ghost", {x = 275, y = 2019, z = 9})
        end
    end
    doSendAnimatedText({x = 275, y = 2024, z = 9}, text, col)
end

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
    if false == isPlayer(cid) then
        return
    end
  
    if item.actionid == 5302 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 = 271, y = 2016, z = 8}, 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 = 270, y = 2019, z = 9},{x = 280, y = 2029, z = 9}) -- 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", 5302)
        end
        pressedTiles = {}
        gameStarted = false
        doTeleportThing(cid, {x = 275, y = 2024, z = 9}, 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

But you have to change pos to your, and make sure they are correct. I mapped the "pacman hole" at the same pos as masiyah did. Then you know the pos is right.
WibbenZ
I also did that haha with masiyah's script, so we use the same

Test this one(working for me)
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 = 270, y = 2019, z = 9})
        if dif > 1 then
            doCreateMonster("Pacman Ghost", {x = 280, y = 2019, z = 9})
        end
        if dif > 2 then
            doCreateMonster("Pacman Ghost", {x = 275, y = 2019, z = 9})
        end
    end
    doSendAnimatedText({x = 275, y = 2024, z = 9}, text, col)
end

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
    if false == isPlayer(cid) then
        return
    end
  
    if item.actionid == 5302 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 = 271, y = 2016, z = 8}, 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 = 270, y = 2019, z = 9},{x = 280, y = 2029, z = 9}) -- 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", 5302)
        end
        pressedTiles = {}
        gameStarted = false
        doTeleportThing(cid, {x = 275, y = 2024, z = 9}, 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

But you have to change pos to your, and make sure they are correct. I mapped the "pacman hole" at the same pos as masiyah did. Then you know the pos is right.
WibbenZ
Tell me every script you got, where they are, you don't need to post all :)
 
Last edited by a moderator:
search in creaturescript for pacman and post it.if you didn't find add this
Code:
-- Pacman die handler [TGY]
function onPrepareDeath(cid, dl)
   if isPlayer(cid) and isInArea(getCreaturePosition(cid), {x = 270, y = 2019, z = 9},{x = 280, y = 2029, z = 9}) then
    --doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid))
     doCreatureAddHealth(cid, getCreatureMaxHealth(cid), 65535, 256, true)
    doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid))
     doTeleportThing(cid, {x = 271, y = 2016, z = 8})
     doSendMagicEffect({x = 271, y = 2016, z = 8}, 10)
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "[PACMAN] Game over....")
     doPlayerPopupFYI(cid, "You were killed by a Pacman Ghost.")
     return false
  end
   return true
end

Creaturescripts.xml
Code:
  <event type="preparedeath" name="pacmanhandle" event="script" value="pacmanhandle.lua"/>

Login.Lua

Code:
  registerCreatureEvent(cid, "pacmanhandle")
 
search in creaturescript for pacman and post it.if you didn't find add this
Code:
-- Pacman die handler [TGY]
function onPrepareDeath(cid, dl)
   if isPlayer(cid) and isInArea(getCreaturePosition(cid), {x = 270, y = 2019, z = 9},{x = 280, y = 2029, z = 9}) then
    --doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid))
     doCreatureAddHealth(cid, getCreatureMaxHealth(cid), 65535, 256, true)
    doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid))
     doTeleportThing(cid, {x = 271, y = 2016, z = 8})
     doSendMagicEffect({x = 271, y = 2016, z = 8}, 10)
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "[PACMAN] Game over....")
     doPlayerPopupFYI(cid, "You were killed by a Pacman Ghost.")
     return false
  end
   return true
end

Creaturescripts.xml
Code:
  <event type="preparedeath" name="pacmanhandle" event="script" value="pacmanhandle.lua"/>

Login.Lua

Code:
  registerCreatureEvent(cid, "pacmanhandle")
thank you! forgot login.lua
 
Back
Top