• 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:
@tetra20

Hey m8, can you look at this script. I want it so when you advance in for example Level and if you are an druid or elder druid a distanceeffect will show up, if you are a sorcerer or master sorcerer then a different will show up and so on. But I cant get it to work.. :(

Please help me fix this problem, It would be cool if it worked :D
Script made by Pitufo/Haifurer, Credits goes to them. I just want different vocs will show up different distance effects at advance level/skill.

Script
Code:
--Script made by Pitufo/Haifurer, edited by figaro!
local config = {
    [0] = { "Fist skill UP", 30}, -- 30 = variable[2]  -- Animation effect
    [1] = { "Club skill UP", 30}, -- 30 = variable[2]  -- Animation effect
    [2] = { "Sword skill UP", 30}, -- 30 = variable[2]  -- Animation effect
    [3] = { "Axe skill UP", 30}, -- 30 = variable[2]  -- Animation effect
    [4] = { "Distance skill UP", 30}, -- 30 = variable[2]  -- Animation effect
    [5] = { "Shield skill UP", 30}, -- 30 = variable[2]  -- Animation effect
    [6] = { "Fishing skill UP", 30}, -- 30 = variable[2]  -- Animation effect
    [7] = { "Magic level UP", 30}, -- 30 = variable[2]  -- Animation effect
    [8] = { "Level UP", 30} -- 30 = variable[2]  -- Animation effect
}
local vocation = getCreatureVocation(cid)
local sorcerer = 1
local druid = 2
local paladin = 3
local knight = 4
local mastersorcerer = 5
local elderdruid = 6
local royalpaladin = 7
local eliteknight = 8

function onAdvance(cid, skill, oldlevel, newlevel)

local pos = getPlayerPosition(cid)
local effectPositions = {
{x = pos.x, y = pos.y - 2, z = pos.z},
{x = pos.x, y = pos.y + 2, z = pos.z},
{x = pos.x - 2, y = pos.y, z = pos.z},
{x = pos.x + 2, y = pos.y, z = pos.z},
{x = pos.x - 1, y = pos.y - 1, z = pos.z},
{x = pos.x + 1, y = pos.y - 1, z = pos.z},
{x = pos.x + 1, y = pos.y + 1, z = pos.z},
{x = pos.x - 1, y = pos.y + 1, z = pos.z}
}

    for type, variable in pairs(config) do
        if skill == type and vocation == druid or vocation == elderdruid then
            doCreatureSay(cid, ""..variable[1].." ["..newlevel.."]", TALKTYPE_ORANGE_1)
    for _, ePos in ipairs(effectPositions) do
        doSendDistanceShoot(pos, ePos, 28)
        doSendMagicEffect(ePos, 30)
            end
        end
    for type, variable in pairs(config) do
        if skill == type and vocation == sorcerer or vocation == mastersorcerer then
            doCreatureSay(cid, ""..variable[1].." ["..newlevel.."]", TALKTYPE_ORANGE_1)
    for _, ePos in ipairs(effectPositions) do
        doSendDistanceShoot(pos, ePos, 31)
        doSendMagicEffect(ePos, 30)
            end
        end
    for type, variable in pairs(config) do
        if skill == type and vocation == knight or vocation == eliteknight then
            doCreatureSay(cid, ""..variable[1].." ["..newlevel.."]", TALKTYPE_ORANGE_1)
    for _, ePos in ipairs(effectPositions) do
        doSendDistanceShoot(pos, ePos, 24)
        doSendMagicEffect(ePos, 30)
            end
        end
    for type, variable in pairs(config) do
        if skill == type and vocation == paladin or vocation == royalpaladin then
            doCreatureSay(cid, ""..variable[1].." ["..newlevel.."]", TALKTYPE_ORANGE_1)
    for _, ePos in ipairs(effectPositions) do
        doSendDistanceShoot(pos, ePos, 33)
        doSendMagicEffect(ePos, 30)
            end
        end
    end    
return TRUE
end

ERROR:
Code:
[24/02/2014 13:47:43] [Error - LuaScriptInterface::loadFile] data/creaturescripts/scripts/advance.lua:71: 'end' expected (to close 'for' at line 45) near '<eof>'
[24/02/2014 13:47:43] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/advance.lua)
[24/02/2014 13:47:43] data/creaturescripts/scripts/advance.lua:71: 'end' expected (to close 'for' at line 45) near '<eof>'
 
Code:
--Script made by Pitufo/Haifurer, edited by figaro!
local config = {
  [0] = { "Fist skill UP", 30}, -- 30 = variable[2]  -- Animation effect
  [1] = { "Club skill UP", 30}, -- 30 = variable[2]  -- Animation effect
  [2] = { "Sword skill UP", 30}, -- 30 = variable[2]  -- Animation effect
  [3] = { "Axe skill UP", 30}, -- 30 = variable[2]  -- Animation effect
  [4] = { "Distance skill UP", 30}, -- 30 = variable[2]  -- Animation effect
  [5] = { "Shield skill UP", 30}, -- 30 = variable[2]  -- Animation effect
  [6] = { "Fishing skill UP", 30}, -- 30 = variable[2]  -- Animation effect
  [7] = { "Magic level UP", 30}, -- 30 = variable[2]  -- Animation effect
  [8] = { "Level UP", 30} -- 30 = variable[2]  -- Animation effect
}
local vocation = getPlayerVocation(cid)
local sorcerer = 1
local druid = 2
local paladin = 3
local knight = 4
local mastersorcerer = 5
local elderdruid = 6
local royalpaladin = 7
local eliteknight = 8

function onAdvance(cid, skill, oldlevel, newlevel)

local pos = getPlayerPosition(cid)
local effectPositions = {
{x = pos.x, y = pos.y - 2, z = pos.z},
{x = pos.x, y = pos.y + 2, z = pos.z},
{x = pos.x - 2, y = pos.y, z = pos.z},
{x = pos.x + 2, y = pos.y, z = pos.z},
{x = pos.x - 1, y = pos.y - 1, z = pos.z},
{x = pos.x + 1, y = pos.y - 1, z = pos.z},
{x = pos.x + 1, y = pos.y + 1, z = pos.z},
{x = pos.x - 1, y = pos.y + 1, z = pos.z}
}

  for type, variable in pairs(config) do
  if skill == type and vocation == druid or vocation == elderdruid then
  doCreatureSay(cid, ""..variable[1].." ["..newlevel.."]", TALKTYPE_ORANGE_1)
  for _, ePos in ipairs(effectPositions) do
  doSendDistanceShoot(pos, ePos, 28)
  doSendMagicEffect(ePos, 30)
  end
  end
  for type, variable in pairs(config) do
  if skill == type and vocation == sorcerer or vocation == mastersorcerer then
  doCreatureSay(cid, ""..variable[1].." ["..newlevel.."]", TALKTYPE_ORANGE_1)
  for _, ePos in ipairs(effectPositions) do
  doSendDistanceShoot(pos, ePos, 31)
  doSendMagicEffect(ePos, 30)
  end
  end
  for type, variable in pairs(config) do
  if skill == type and vocation == knight or vocation == eliteknight then
  doCreatureSay(cid, ""..variable[1].." ["..newlevel.."]", TALKTYPE_ORANGE_1)
  for _, ePos in ipairs(effectPositions) do
  doSendDistanceShoot(pos, ePos, 24)
  doSendMagicEffect(ePos, 30)
  end
  end
  for type, variable in pairs(config) do
  if skill == type and vocation == paladin or vocation == royalpaladin then
  doCreatureSay(cid, ""..variable[1].." ["..newlevel.."]", TALKTYPE_ORANGE_1)
  for _, ePos in ipairs(effectPositions) do
  doSendDistanceShoot(pos, ePos, 33)
  doSendMagicEffect(ePos, 30)
  end
  end
  end
end
end
end
return TRUE
end
 
Last edited:
@tetra20

Getting this error when I reload the creature events

Code:
[24/02/2014 21:49:37] [Error - CreatureScript Interface] 
[24/02/2014 21:49:37] data/creaturescripts/scripts/advance.lua
[24/02/2014 21:49:37] Description: 
[24/02/2014 21:49:37] data/creaturescripts/scripts/advance.lua:13: attempt to call global 'getCreatureVocation' (a nil value)
[24/02/2014 21:49:37] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/advance.lua)
 
Try The SCript Again



@tetra20

Getting this error when I reload the creature events

Code:
[24/02/2014 21:49:37] [Error - CreatureScript Interface]
[24/02/2014 21:49:37] data/creaturescripts/scripts/advance.lua
[24/02/2014 21:49:37] Description:
[24/02/2014 21:49:37] data/creaturescripts/scripts/advance.lua:13: attempt to call global 'getCreatureVocation' (a nil value)
[24/02/2014 21:49:37] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/advance.lua)
 
@tetra20

I did, When I startup the server I get that error, same when I reload the creaturescript events. Also when I do /addskill testchar, level, 1 there aint comming no animation :(

I want different distance animations for different vocations :D

@tetra20

Please help me fix :(
 
Last edited by a moderator:
@tetra20

Now it is comming this error up at startup...

ERROR
Code:
[25/02/2014 11:03:21] [Error - CreatureScript Interface] 
[25/02/2014 11:03:21] data/creaturescripts/scripts/advance.lua
[25/02/2014 11:03:21] Description: 
[25/02/2014 11:03:21] (internalGetPlayerInfo) Player not found when requesting player info #6
 
Back
Top