• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action Pacman

Fallen

Freelancer
Senator
Joined
Aug 21, 2009
Messages
3,712
Reaction score
249
Location
Egypt
Script:
Code:
local fromPos, toPos =
	{x = 1007, y = 988, z = 7},
	{x = 1032, y = 1011, z = 7}

local startPosition, lives, eatable =
	{x = 1019, y = 1011, z = 7},
	5307, {2677, 2675}

local delayMonsters, itemsToWin = 34561, 250

local useCountDown, delay, eatEvent, storageEvent, wins, loses = 
	true, 3, 9531, 3123, 5613, 5614

local myTable = {
	{fromPos = {x = 1019, y = 988, z = 7}, toPos = {x = 1032, y = 999, z = 7}},
	{fromPos = {x = 1007, y = 988, z = 7}, toPos = {x = 1018, y = 999, z = 7}},
	{fromPos = {x = 1007, y = 1011, z = 7}, toPos = {x = 1017, y = 1004, z = 7}},
	{fromPos = {x = 1032, y = 1011, z = 7}, toPos = {x = 1023, y = 1003, z = 7}},
	{fromPos = {x = 1007, y = 996, z = 7}, toPos = {x = 1009, y = 1005, z = 7}}
}

local pos_t = {
	{x = 1008, y = 1004, z = 7},
	{x = 1029, y = 993, z = 7},
	{x = 1031, y = 1001, z = 7},
	{x = 1014, y = 989, z = 7}
}

local function endGame(cid)
	for _, iv in ipairs(myTable) do
		for x = iv.fromPos.x, iv.toPos.x do
			for y = iv.fromPos.y, iv.toPos.y do
				local from_ = {x = x, y = y, z = iv.fromPos.z}
				local getItem = getTileItemById(from_, eatable[1]).uid
				if getItem > 0 then doRemoveItem(getItem) end
				if doTileQueryAdd(doCreateItemEx(eatable[1]), from_) == 1 then
					doCreateItem(eatable[1], 1, from_)
				end
			end
		end
	end

	for _, n in ipairs(pos_t) do
		doCreateItem(eatable[2], 1, n)
	end

	for x = fromPos.x, toPos.x do
		for y = fromPos.y, toPos.y do
			local monster = getTopCreature({x = x, y = y, z = fromPos.z}).uid
			if isMonster(monster) then doRemoveCreature(monster) end
		end
	end
	setGlobalStorageValue(delayMonsters, os.time() + 120)
	if getPlayerStorageValue(cid, lives) == 0 then
		setPlayerStorageValue(cid, loses, getPlayerStorageValue(cid, loses)+1)
	else
		setPlayerStorageValue(cid, wins, getPlayerStorageValue(cid, wins)+1)
	end
	setPlayerStorageValue(cid, lives, 3)
	setPlayerStorageValue(cid, eatEvent, 0)
	doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), true)
	doReloadInfo(RELOAD_ACTIONS)
end

local function checkTiles(cid)
	local success = false
	for x = fromPos.x, toPos.x do
		for y = fromPos.y, toPos.y do
			local ik = getTileItemById({x = x, y = y, z = fromPos.z}, eatable[1]).uid
			if ik < 1 or getPlayerStorageValue(cid, eatEvent) >= itemsToWin then success = true break end
		end
	end
	if success == true then endGame(cid) end
end

local function moveDirection(cid)
	local moveDir = getCreatureLookPosition(cid)
	local msg = "%s lives left!"
	if doTileQueryAdd(cid, moveDir) == 1 then
		local f, fc = getTileItemById(moveDir, eatable[1]), getTileItemById(moveDir, eatable[2])
		if f.uid > 0 then
			doRemoveItem(f.uid, f.type)
			setPlayerStorageValue(cid, eatEvent, getPlayerStorageValue(cid, eatEvent)+1)
			doSendAnimatedText(moveDir, getPlayerStorageValue(cid, eatEvent), 180)
		elseif fc.uid > 0 then
			doRemoveItem(fc.uid, fc.type)
			setPlayerStorageValue(cid, eatEvent, getPlayerStorageValue(cid, eatEvent)+2)
			doSendAnimatedText(moveDir, getPlayerStorageValue(cid, eatEvent), 180)
		end
		doMoveCreature(cid, getCreatureLookDirection(cid))
	else
		local c = getTopCreature(moveDir).uid
		if isMonster(c) then
			if getPlayerStorageValue(cid, eatEvent) < 50 then
				if getPlayerStorageValue(cid, lives) <= 0 then
					return endGame(cid)
				else
					doTeleportThing(cid, startPosition, true)
					setPlayerStorageValue(cid, lives, getPlayerStorageValue(cid, lives)-1)
					doCreatureSay(cid, msg:format(getPlayerStorageValue(cid, lives)), 19)
				end
			elseif getPlayerStorageValue(cid, eatEvent) >= 50 then
				doTeleportThing(cid, moveDir, true)
				doRemoveCreature(c)
				setPlayerStorageValue(cid, eatEvent, getPlayerStorageValue(cid, eatEvent)+2)
				doSendAnimatedText(moveDir, getPlayerStorageValue(cid, eatEvent), 180)
			end
		end
	end
	checkTiles(cid)
	return addEvent(moveDirection, 500, cid)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
	for x = fromPos.x, toPos.x do
		for y = fromPos.y, toPos.y do
			local this = getTopCreature({x = x, y = y, z = fromPos.z}).uid
			if isPlayer(this) then
				return doPlayerSendTextMessage(cid, 27, string.format("Please wait for %s to finish.", getCreatureName(this)))
			end
		end
	end
	if getGlobalStorageValue(storageEvent) <= os.time() then
		if getGlobalStorageValue(delayMonsters) <= os.time() then
			setPlayerStorageValue(cid, lives, 3)
			setPlayerStorageValue(cid, eatEvent, 0)
			doTeleportThing(cid, startPosition, true)
			addEvent(moveDirection, 4 * 1000, cid)
			if useCountDown then
				doCreatureSetNoMove(cid, true)
				doSendAnimatedText(getThingPos(cid), delay, 180)
				for i = 1, delay-1 do
					addEvent(doSendAnimatedText, i * 1000, getThingPos(cid), delay-i, 180)
				end
				addEvent(doCreatureSetNoMove, 4 * 1000, cid, false)
				addEvent(doSendAnimatedText, 4 * 1000, getThingPos(cid), "Go!", 180)
			end
			setGlobalStorageValue(storageEvent, os.time() + 60)
		else
			return doPlayerSendTextMessage(cid, 27, string.format("You must wait %d seconds till the monsters get back.", getGlobalStorageValue(delayMonsters) - os.time()))
		end
	else
		return doPlayerSendTextMessage(cid, 27, string.format("You must wait %d seconds.", getGlobalStorageValue(storageEvent) - os.time()))
	end
	return doTransformItem(item.uid, item.itemid == 1945 and item.itemid + 1 or item.itemid - 1)
end

How to setup?
Code:
local fromPos, toPos =
	{x = 1007, y = 988, z = 7},
	{x = 1032, y = 1011, z = 7}
fromPos (top left position)
toPos (buttom right position)
both are play ground
--
Code:
local startPosition, lives, eatable =
	{x = 1019, y = 1011, z = 7},
	5307, {2677, 2675}
startPosition (where you get tped)
lives (storage, they are 3 lives until you get tped out(die basically))
eatable (items that are eat able)
--
Code:
local delayMonsters, itemsToWin = 34561, 250
delayMonsters (storage, just leave it alone)
itemsToWin (how many items you eat then you win?)
-
Code:
local useCountDown, delay, eatEvent, storageEvent, wins, loses = 
	true, 3, 9531, 3123, 5613, 5614
useCountDown (is basically like (1, 2, 3, go) (true/false/nil))
-
Code:
local myTable = {
	{fromPos = {x = 1019, y = 988, z = 7}, toPos = {x = 1032, y = 999, z = 7}},
	{fromPos = {x = 1007, y = 988, z = 7}, toPos = {x = 1018, y = 999, z = 7}},
	{fromPos = {x = 1007, y = 1011, z = 7}, toPos = {x = 1017, y = 1004, z = 7}},
	{fromPos = {x = 1032, y = 1011, z = 7}, toPos = {x = 1023, y = 1003, z = 7}},
	{fromPos = {x = 1007, y = 996, z = 7}, toPos = {x = 1009, y = 1005, z = 7}}
}
[
Code:
local pos_t = {
	{x = 1008, y = 1004, z = 7},
	{x = 1029, y = 993, z = 7},
	{x = 1031, y = 1001, z = 7},
	{x = 1014, y = 989, z = 7}
}
both are used to renew items - first one (myTable) for blue berries, 2nd one (pos_t) for oranges
-
just change the items in the "eatable" from the config
-
---Monsters---
Inky.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<monster name="Inky" nameDescription="a Inky Ghost" race="undead" experience="0" speed="160" manacost="0">
	<health now="150" max="150"/>
	<look type="48" corpse="5993"/>
	<targetchange interval="0" chance="0"/>
	<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="0"/>
		<flag canpushcreatures="0"/>
		<flag targetdistance="0"/>
		<flag staticattack="0"/>
		<flag runonhealth="0"/>
	</flags>
	<attacks>
		<attack name="melee" interval="0" skill="0" attack="0"/>
		<attack name="lifedrain" interval="1000" chance="0" range="0" min="0" max="0"/>
	</attacks>
	<defenses armor="0" defense="0"/>
	<elements>
		<element physicalPercent="100"/>
		<element earthPercent="100"/>
		<element deathPercent="100"/>
	</elements>
	<immunities>
		<immunity lifedrain="0"/>
		<immunity paralyze="0"/>
	</immunities>
</monster>
-
Clyde.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<monster name="Clyde" nameDescription="a Clyde Ghost" race="undead" experience="0" speed="160" manacost="0">
	<health now="150" max="150"/>
	<look type="48" corpse="5993"/>
	<targetchange interval="0" chance="0"/>
	<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="0"/>
		<flag canpushcreatures="0"/>
		<flag targetdistance="0"/>
		<flag staticattack="0"/>
		<flag runonhealth="0"/>
	</flags>
	<attacks>
		<attack name="melee" interval="0" skill="0" attack="0"/>
		<attack name="lifedrain" interval="1000" chance="0" range="0" min="0" max="0"/>
	</attacks>
	<defenses armor="0" defense="0"/>
	<elements>
		<element physicalPercent="100"/>
		<element earthPercent="100"/>
		<element deathPercent="100"/>
	</elements>
	<immunities>
		<immunity lifedrain="0"/>
		<immunity paralyze="0"/>
	</immunities>
</monster>
--
Blinky.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<monster name="Blinky" nameDescription="a Blinky Ghost" race="undead" experience="0" speed="160" manacost="0">
	<health now="150" max="150"/>
	<look type="48" corpse="5993"/>
	<targetchange interval="0" chance="0"/>
	<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="0"/>
		<flag canpushcreatures="0"/>
		<flag targetdistance="0"/>
		<flag staticattack="0"/>
		<flag runonhealth="0"/>
	</flags>
	<attacks>
		<attack name="melee" interval="0" skill="0" attack="0"/>
		<attack name="lifedrain" interval="1000" chance="0" range="0" min="0" max="0"/>
	</attacks>
	<defenses armor="0" defense="0"/>
	<elements>
		<element physicalPercent="100"/>
		<element earthPercent="100"/>
		<element deathPercent="100"/>
	</elements>
	<immunities>
		<immunity lifedrain="0"/>
		<immunity paralyze="0"/>
	</immunities>
</monster>
--
Pinky.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<monster name="Pinky" nameDescription="a Pinky Ghost" race="undead" experience="0" speed="160" manacost="0">
	<health now="150" max="150"/>
	<look type="48" corpse="5993"/>
	<targetchange interval="0" chance="0"/>
	<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="0"/>
		<flag canpushcreatures="0"/>
		<flag targetdistance="0"/>
		<flag staticattack="0"/>
		<flag runonhealth="0"/>
	</flags>
	<attacks>
		<attack name="melee" interval="0" skill="0" attack="0"/>
		<attack name="lifedrain" interval="1000" chance="0" range="0" min="0" max="0"/>
	</attacks>
	<defenses armor="0" defense="0"/>
	<elements>
		<element physicalPercent="100"/>
		<element earthPercent="100"/>
		<element deathPercent="100"/>
	</elements>
	<immunities>
		<immunity lifedrain="0"/>
		<immunity paralyze="0"/>
	</immunities>
</monster>
-
--Map
http://www.speedy*****malware.localhost/files/23257881/map.rar
Code:
UPDATE players SET posx = 1019, posy = 1023, posz = 7
-
Have fun and report bugs.
 
Last edited:
why not a maze :ninja: like mock's pacman
comecoco.png
 
Last edited:
@up nice menz


first tetirs, then Bombaerman, then pacman, then..?
Frogger or pong?
gogogoogo i wanna play pong :p
 
well it's an old pacman code script im updating, works very fine the event
now we need the snake game, hope cykotitan does it sometime
 
where to add this?

Code:
local fromPos, toPos =
	{x = 1007, y = 988, z = 7},
	{x = 1032, y = 1011, z = 7}

local startPosition, lives, eatable =
	{x = 1019, y = 1011, z = 7},
	5307, {2677, 2675}

local delayMonsters, itemsToWin = 34561, 250

local useCountDown, delay, eatEvent, storageEvent, wins, loses = 
	true, 3, 9531, 3123, 5613, 5614

local myTable = {
	{fromPos = {x = 1019, y = 988, z = 7}, toPos = {x = 1032, y = 999, z = 7}},
	{fromPos = {x = 1007, y = 988, z = 7}, toPos = {x = 1018, y = 999, z = 7}},
	{fromPos = {x = 1007, y = 1011, z = 7}, toPos = {x = 1017, y = 1004, z = 7}},
	{fromPos = {x = 1032, y = 1011, z = 7}, toPos = {x = 1023, y = 1003, z = 7}},
	{fromPos = {x = 1007, y = 996, z = 7}, toPos = {x = 1009, y = 1005, z = 7}}
}

local pos_t = {
	{x = 1008, y = 1004, z = 7},
	{x = 1029, y = 993, z = 7},
	{x = 1031, y = 1001, z = 7},
	{x = 1014, y = 989, z = 7}
}

local function endGame(cid)
	for _, iv in ipairs(myTable) do
		for x = iv.fromPos.x, iv.toPos.x do
			for y = iv.fromPos.y, iv.toPos.y do
				local from_ = {x = x, y = y, z = iv.fromPos.z}
				local getItem = getTileItemById(from_, eatable[1]).uid
				if getItem > 0 then doRemoveItem(getItem) end
				if doTileQueryAdd(doCreateItemEx(eatable[1]), from_) == 1 then
					doCreateItem(eatable[1], 1, from_)
				end
			end
		end
	end

	for _, n in ipairs(pos_t) do
		doCreateItem(eatable[2], 1, n)
	end

	for x = fromPos.x, toPos.x do
		for y = fromPos.y, toPos.y do
			local monster = getTopCreature({x = x, y = y, z = fromPos.z}).uid
			if isMonster(monster) then doRemoveCreature(monster) end
		end
	end
	setGlobalStorageValue(delayMonsters, os.time() + 120)
	if getPlayerStorageValue(cid, lives) == 0 then
		setPlayerStorageValue(cid, loses, getPlayerStorageValue(cid, loses)+1)
	else
		setPlayerStorageValue(cid, wins, getPlayerStorageValue(cid, wins)+1)
	end
	setPlayerStorageValue(cid, lives, 3)
	setPlayerStorageValue(cid, eatEvent, 0)
	doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), true)
	doReloadInfo(RELOAD_ACTIONS)
end

local function checkTiles(cid)
	local success = false
	for x = fromPos.x, toPos.x do
		for y = fromPos.y, toPos.y do
			local ik = getTileItemById({x = x, y = y, z = fromPos.z}, eatable[1]).uid
			if ik < 0 or getPlayerStorageValue(cid, eatEvent) >= itemsToWin then success = true break end
		end
	end
	if success == true then endGame(cid) end
end

local function moveDirection(cid)
	local moveDir = getCreatureLookPosition(cid)
	local msg = "%s lives left!"
	if doTileQueryAdd(cid, moveDir) == 1 then
		local f, fc = getTileItemById(moveDir, eatable[1]), getTileItemById(moveDir, eatable[2])
		if f.uid > 0 then
			doRemoveItem(f.uid, f.type)
			setPlayerStorageValue(cid, eatEvent, getPlayerStorageValue(cid, eatEvent)+1)
			doSendAnimatedText(moveDir, getPlayerStorageValue(cid, eatEvent), 180)
		elseif fc.uid > 0 then
			doRemoveItem(fc.uid, fc.type)
			setPlayerStorageValue(cid, eatEvent, getPlayerStorageValue(cid, eatEvent)+2)
			doSendAnimatedText(moveDir, getPlayerStorageValue(cid, eatEvent), 180)
		end
		doMoveCreature(cid, getCreatureLookDirection(cid))
	else
		local c = getTopCreature(moveDir).uid
		if isMonster(c) then
			if getPlayerStorageValue(cid, eatEvent) < 50 then
				if getPlayerStorageValue(cid, lives) <= 0 then
					return endGame(cid)
				else
					doTeleportThing(cid, startPosition, true)
					setPlayerStorageValue(cid, lives, getPlayerStorageValue(cid, lives)-1)
					doCreatureSay(cid, msg:format(getPlayerStorageValue(cid, lives)), 19)
				end
			elseif getPlayerStorageValue(cid, eatEvent) >= 50 then
				doTeleportThing(cid, moveDir, true)
				doRemoveCreature(c)
				setPlayerStorageValue(cid, eatEvent, getPlayerStorageValue(cid, eatEvent)+2)
				doSendAnimatedText(moveDir, getPlayerStorageValue(cid, eatEvent), 180)
			end
		end
	end
	checkTiles(cid)
	return addEvent(moveDirection, 500, cid)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
	for x = fromPos.x, toPos.x do
		for y = fromPos.y, toPos.y do
			local this = getTopCreature({x = x, y = y, z = fromPos.z}).uid
			if isPlayer(this) then
				return doPlayerSendTextMessage(cid, 27, string.format("Please wait for %s to finish.", getCreatureName(this)))
			end
		end
	end
	if getGlobalStorageValue(storageEvent) <= os.time() then
		if getGlobalStorageValue(delayMonsters) <= os.time() then
			setPlayerStorageValue(cid, lives, 3)
			setPlayerStorageValue(cid, eatEvent, 0)
			doTeleportThing(cid, startPosition, true)
			addEvent(moveDirection, 4 * 1000, cid)
			if useCountDown then
				doCreatureSetNoMove(cid, true)
				doSendAnimatedText(getThingPos(cid), delay, 180)
				for i = 1, delay-1 do
					addEvent(doSendAnimatedText, i * 1000, getThingPos(cid), delay-i, 180)
				end
				addEvent(doCreatureSetNoMove, 4 * 1000, cid, false)
				addEvent(doSendAnimatedText, 4 * 1000, getThingPos(cid), "Go!", 180)
			end
			setGlobalStorageValue(storageEvent, os.time() + 60)
		else
			return doPlayerSendTextMessage(cid, 27, string.format("You must wait %s seconds till the monsters get back.", getGlobalStorageValue(delayMonsters) - os.time()))
		end
	else
		return doPlayerSendTextMessage(cid, 27, string.format("You must wait %s seconds.", getGlobalStorageValue(storageEvent) - os.time()))
	end
	return doTransformItem(item.uid, item.itemid == 1945 and item.itemid + 1 or item.itemid - 1)
end

give me the xml
 
@up
if u want to see magic copy and paste it in a txt
and change the name to
daname.xml
magic menz
 
i mean this

<action uniqueid="7000" event="script" value="pacman.lua"/>
 
Back
Top