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

Closed

Status
Not open for further replies.

JDB

OtLand Veteran
Joined
Jun 1, 2009
Messages
4,145
Solutions
2
Reaction score
115
Sorry for the inconvenience.

Regards,
JDB.
 
Last edited:
could be further explained, eg where to place or action or uniqueid, the right tag
this so complicated to understand for beginners in scripting
 
lulz, here's mine
somewhat old. :p
Lua:
local t = {
	[1] = {{x=33268, y=31833, z=10}, 8304, {x=33268, y=31833, z=12}},
	[2] = {{x=33268, y=31838, z=10}, 8305, {x=33267, y=31838, z=12}},
	[3] = {{x=33270, y=31835, z=10}, 8300, {x=33270, y=31835, z=12}},
	[4] = {{x=33266, y=31835, z=10}, 8306, {x=33265, y=31835, z=12}}
}
local fence = {
	[1] = {x1=33266, x2=33270, y1=31828, sound={x=33268, y=31828, z=12}},
	[2] = {x1=33266, x2=33270, y1=31843, sound={x=33267, y=31843, z=12}},
	[3] = {x1=33275, y1=31834, y2=31838, sound={x=33275, y=31836, z=12}},
	[4] = {x1=33260, y1=31834, y2=31838, sound={x=33260, y=31835, z=12}}
}
local machine = {
	[8304] = {49106, 49107},
	[8305] = {49108, 49109},
	[8300] = {49110, 49111},
	[8306] = {49112, 49113}
}
local effects = {
	{x=33261, y=31829, z=12}, {x=33262, y=31830, z=12}, {x=33263, y=31831, z=12},
	{x=33264, y=31832, z=12}, {x=33265, y=31833, z=12}, {x=33266, y=31834, z=12},
	{x=33267, y=31835, z=12}, {x=33268, y=31836, z=12}, {x=33269, y=31837, z=12},
	{x=33270, y=31838, z=12}, {x=33271, y=31839, z=12}, {x=33272, y=31840, z=12},
	{x=33273, y=31841, z=12}, {x=33274, y=31842, z=12}, {x=33274, y=31829, z=12},
	{x=33273, y=31830, z=12}, {x=33272, y=31831, z=12}, {x=33271, y=31832, z=12},
	{x=33270, y=31833, z=12}, {x=33269, y=31834, z=12}, {x=33268, y=31835, z=12},
	{x=33267, y=31836, z=12}, {x=33266, y=31837, z=12}, {x=33265, y=31838, z=12},
	{x=33264, y=31839, z=12}, {x=33263, y=31840, z=12}, {x=33262, y=31841, z=12},
	{x=33261, y=31842, z=12}
}

local kickEvent, warnEvent = 0, 0

local function kick()
	setGlobalStorageValue(49105, -1)
	for i = 49101, 49105 do
		local v = getGlobalStorageValue(i)
		if isPlayer(v) == TRUE and isInRange(getThingPos(v), {x=33238, y=31806, z=12}, {x=33297, y=31865, z=12}) == TRUE then
			doTeleportThing(v, {x=33265, y=31838, z=10})
			doSendMagicEffect({x=33265, y=31838, z=10}, CONST_ME_TELEPORT)
		end
		setGlobalStorageValue(i, -1)
	end
end

local function fail(cid)
	return TRUE, doCreatureSay(cid, 'You need one player of each vocation having completed the Elemental Spheres quest and also carrying the elemental rare item.', TALKTYPE_ORANGE_1, false, 0, {x=33268, y=31835, z=10})
end

function isMonster(cid)
	return isCreature(cid) == TRUE and cid >= 0x40000000 and cid < 0x80000000
end

local function cleanTile(pos)
	pos.stackpos = 1
	local v = getThingfromPos(pos)
	while v.uid ~= 0 do
		if isMonster(v.uid) then
			doRemoveCreature(v.uid)
		elseif isCreature(v.uid) == FALSE and isInArray({1387, 1945, 1946}, v.itemid) == FALSE then
			doRemoveItem(v.uid)
		else
			pos.stackpos = pos.stackpos + 1
		end
		v = getThingfromPos(pos)
	end
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.uid == 49105 then
		if getGlobalStorageValue(49105) > 0 then
			return TRUE, doCreatureSay(cid, 'Wait for the current team to exit.', TALKTYPE_ORANGE_1, false, 0, {x=33268, y=31835, z=10})
		end
		for k, v in pairs(t) do
			local player = getTopCreature(v[1]).uid
			if isPlayer(player) == FALSE then
				return fail(cid)
			end
			local voc = getPlayerVocation(player)
			if voc > 4 then
				voc = voc - 4
			end
			if voc ~= k or getPlayerItemCount(player, v[2]) < 1 or getPlayerStorageValue(player, 65100) < 2 then
				return fail(cid)
			end
		end
		setGlobalStorageValue(49105, 1)
		stopEvent(kickEvent)
		stopEvent(warnEvent)
		for x = 33261, 33274 do
			for y = 31829, 31842 do
				cleanTile({x=x, y=y, z=12})
			end
		end
		for k, v in ipairs(fence) do
			for x = v.x1, v.x2 or v.x1 do
				for y = v.y1, v.y2 or v.y1 do
					local c = getTileItemById({x=x, y=y, z=12}, k < 3 and 8861 or 8862).uid
					if c > 0 then
						doRemoveItem(c)
					end
				end
			end
		end
		local effectTable = {}
		for k, v in pairs(t) do
			local player = getTopCreature(v[1]).uid
			setGlobalStorageValue(49100 + k, player)
			setPlayerStorageValue(cid, 65049, -1)
			doTeleportThing(player, v[3])
			doSendMagicEffect(v[1], CONST_ME_TELEPORT)
			table.insert(effectTable, v[3])
		end
		for _, v in ipairs(effectTable) do
			doSendMagicEffect(v, CONST_ME_TELEPORT)
			v = nil
		end
		for _, y in ipairs({8304, 8305, 8300, 8306}) do
			setGlobalStorageValue(y, -1)
		end
		for i = 49101, 49104 do
			doTransformItem(getThing(i).uid, 1945)
		end
		for i = 49106, 49113 do
			local v = getThing(i)
			if v.itemid > 7914 then
				doTransformItem(v.uid, v.itemid - 983)
			end
		end
		warnEvent = addEvent(doCreatureSay, 5 * 60 * 1000, getTopCreature({x=33266, y=31835, z=13}).uid, 'You have 5 minutes from now on until you get teleported out.', TALKTYPE_ORANGE_2)
		kickEvent = addEvent(kick, 10 * 60 * 1000)
	else
		if item.itemid == 1945 then
			local voc, p = getPlayerVocation(cid), getThingPos(cid)
			if voc > 4 then
				voc = voc - 4
			end
			if voc ~= item.uid - 49100 or getThing(machine[t[voc][2]][1]).itemid < 7915 or getThingfromPos({x=p.x, y=p.y, z=p.z, stackpos=0}).uid ~= item.uid + 100 then
				return TRUE, doCreatureSay(cid, 'Charge the four machines and stand at the marked spots beside the levers.', TALKTYPE_ORANGE_1, false, cid, getThingPos(cid))
			end
			local c = fence[voc]
			for x = c.x1, c.x2 or c.x1 do
				for y = c.y1, c.y2 or c.y1 do
					doCreateItem(voc < 3 and 8861 or 8862, 1, {x=x, y=y, z=12})
				end
			end
			doCreatureSay(cid, 'ZOOOOOOOOM', TALKTYPE_ORANGE_1, false, 0, c.sound)
			doTransformItem(item.uid, 1946)
			for i = 49101, 49104 do
				if getThing(i).itemid == 1945 then return TRUE end
			end
			for _, v in ipairs(effects) do
				doSendMagicEffect(v, CONST_ME_ENERGYHIT)
			end
			stopEvent(warnEvent)
			stopEvent(kickEvent)
			doCreatureSay(getTopCreature({x=33266, y=31835, z=13}).uid, 'You have 10 minutes from now on until you get teleported out.', TALKTYPE_ORANGE_2)
			warnEvent = addEvent(doCreatureSay, 5 * 60 * 1000, getTopCreature({x=33266, y=31835, z=13}).uid, 'You have 5 minutes from now on until you get teleported out.', TALKTYPE_ORANGE_2)
			kickEvent = addEvent(kick, 10 * 60 * 1000)
			doSummonCreature('Lord of the Elements', {x=33267, y=31836, z=12})
			setGlobalStorageValue(49105, 2)
		else
			doCreatureSay(cid, 'You can\'t turn it off again.', TALKTYPE_ORANGE_1, false, cid, getThingPos(cid))
		end
	end
	return TRUE
end
Lua:
local t = {
	[1] = {x=33183, y=32197, z=13},
	[2] = {x=33331, y=32076, z=13},
	[3] = {x=33265, y=32202, z=13},
	[4] = {x=33183, y=32197, z=13}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if isInRange(toPosition, {x=33238, y=31806, z=12}, {x=33297, y=31865, z=12}) == FALSE then
		if isInArray({7911, 7912}, item.itemid) == TRUE then
			if isInArray({33268, 33269}, toPosition.x) == TRUE and toPosition.y == 31830 and toPosition.z == 10 and getPlayerStorageValue(cid, 65102) >= 20 then
				local v = getPlayerVocation(cid)
				if v > 4 then
					v = v - 4
				end
				setPlayerStorageValue(cid, 65102, getPlayerStorageValue(cid, 65102) - 20)
				doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
				doTeleportThing(cid, t[v])
				doSendMagicEffect(t[v], CONST_ME_TELEPORT)
			end
			toPosition.x = toPosition.x + (item.itemid == 7911 and 1 or -1)
			local get = getTileItemById(toPosition, item.itemid == 7911 and 7912 or 7911)
			doTransformItem(get.uid, get.itemid + 4)
			doTransformItem(item.uid, item.itemid + 4)
		else
			toPosition.x = toPosition.x + (item.itemid == 7915 and 1 or -1)
			local get = getTileItemById(toPosition, item.itemid == 7915 and 7916 or 7915)
			doTransformItem(get.uid, get.itemid - 4)
			doTransformItem(item.uid, item.itemid - 4)
		end
		return TRUE
	end
end
Lua:
local t = {
	[8298] = {useOn = 8572, transform = 8576, effect = CONST_ME_BIGPLANTS},
	[8299] = {useOn = 8573, transform = 8575},
	[8302] = {useOn = 8571, transform = 8574, effect = CONST_ME_ICEATTACK},
	[8303] = {useOn = 8567, create = 1495}
}
local machine = {
	[8304] = {49106, 49107},
	[8305] = {49108, 49109},
	[8300] = {49110, 49111},
	[8306] = {49112, 49113}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local v = t[item.itemid]
	if v and v.useOn == itemEx.itemid then
		if v.transform then
			doTransformItem(itemEx.uid, v.transform)
			doDecayItem(itemEx.uid)
		elseif v.create then
			doDecayItem(doCreateItem(v.create, 1, toPosition))
		end
		if v.effect then
			doSendMagicEffect(toPosition, v.effect)
		end
		doChangeTypeItem(item.uid, item.type - 1)
		return TRUE
	end

	v = machine[item.itemid]
	if v and isInArray(v, itemEx.uid) == TRUE and itemEx.itemid < 7915 then
		doSendMagicEffect(toPosition, CONST_ME_ENERGYHIT)
		doRemoveItem(item.uid)
		for _, x in ipairs(v) do
			doTransformItem(x, getThing(x).itemid + 983)
		end
		return TRUE
	end
end
XML:
	<action fromid="8298" toid="8306" event="script" value="soils.lua"/>
	<action fromid="7911" toid="7918" event="script" value="machine.lua"/>
	<action fromuid="49101" touid="49105" event="script" value="levers.lua"/>
Lua:
local fence = {
	[1] = {x1=33266, x2=33270, y1=31828},
	[2] = {x1=33266, x2=33270, y1=31843},
	[3] = {x1=33275, y1=31834, y2=31838},
	[4] = {x1=33260, y1=31834, y2=31838}
}

function onStepOut(cid, item, position, fromPosition)
	if isPlayer(cid) == FALSE or getGlobalStorageValue(49105) == 2 or getThing(item.uid - 100).itemid == 1945 then return end

	local i = fence[item.uid - 49200]
	doTransformItem(item.uid - 100, 1945)
	for x = i.x1, i.x2 or i.x1 do
		for y = i.y1, i.y2 or i.y1 do
			doRemoveItem(getTileItemById({x=x, y=y, z=12}, item.uid - 49200 < 3 and 8861 or 8862).uid)
		end
	end
end
Lua:
local t = {
	[8568] = {
		corpse = 8967,
		charged = 1495
		boss = 'Energy Overlord',
		effect = CONST_ME_BIGCLOUDS,
		summonPos = {x=33095, y=32194, z=13},
		pos = {
			{x=33094, y=32189, z=13},
			{x=33097, y=32189, z=13},
			{x=33099, y=32191, z=13},
			{x=33099, y=32194, z=13},
			{x=33097, y=32196, z=13},
			{x=33094, y=32196, z=13},
			{x=33092, y=32194, z=13},
			{x=33092, y=32191, z=13}
		}
	},
	[8569] = {
		corpse = 8969,
		charged = 8575,
		boss = 'Fire Overlord',
		effect = CONST_ME_FIREAREA,
		summonPos = {x=33199, y=32103, z=13},
		pos = {
			{x=33198, y=32102, z=13},
			{x=33201, y=32102, z=13},
			{x=33203, y=32104, z=13},
			{x=33203, y=32107, z=13},
			{x=33201, y=32109, z=13},
			{x=33198, y=32109, z=13},
			{x=33196, y=32107, z=13},
			{x=33196, y=32104, z=13}
		}
	},
	[8570] = {
		corpse = 8968,
		charged = 8574,
		boss = 'Ice Overlord',
		effect = CONST_ME_ICETORNADO,
		summonEffect = CONST_ME_ICEAREA,
		summonPos = {x=33286, y=32102, z=13},
		pos = {
			{x=33285, y=32097, z=13},
			{x=33288, y=32097, z=13},
			{x=33290, y=32099, z=13},
			{x=33290, y=32102, z=13},
			{x=33288, y=32104, z=13},
			{x=33285, y=32104, z=13},
			{x=33283, y=32102, z=13},
			{x=33283, y=32099, z=13}
		}
	},
	[8578] = {
		corpse = 8934,
		charged = 8576,
		boss = 'Earth Overlord',
		effect = CONST_ME_BIGPLANTS,
		summonPos = {x=33347, y=32208, z=13},
		pos = {
			{x=33346, y=32203, z=13},
			{x=33349, y=32203, z=13},
			{x=33351, y=32205, z=13},
			{x=33351, y=32208, z=13},
			{x=33349, y=32210, z=13},
			{x=33346, y=32210, z=13},
			{x=33344, y=32208, z=13},
			{x=33344, y=32205, z=13}
		}
	}
}
function onAddItem(moveitem, tileitem, position)
	local v = t[tileitem.itemid]
	if v and v.corpse == moveitem.itemid and getGlobalStorageValue(tileitem.itemid) < 1 then
		for i = 1, #v.pos do
			if getTileItemById(v.pos[i], v.charged).uid < 1 then
				return
			end
		end
		doRemoveItem(moveitem.uid)
		doSendMagicEffect(position, v.effect)
		doSummonCreature(v.boss, v.summonPos)
		doSendMagicEffect(v.summonPos, v.summonEffect or v.effect)
		setGlobalStorageValue(tileitem.itemid, 1)
	end
end
XML:
	<movevent type="StepOut" fromuid="49201" touid="49204" event="script" value="sphere.lua"/>
	<movevent type="AddItem" tileitem="1" fromid="8568" toid="8570" event="script" value="SummonOverlord.lua"/>
	<movevent type="AddItem" tileitem="1" itemid="8578" event="script" value="SummonOverlord.lua"/>
XML:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Arkulius" script="Arkulius.lua">
<look type="130" head="0" body="79" legs="110" feet="76" addons="3"/>
</npc>
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

local Topic = {}
local storageMain = 65100
local storageKill = 65101
local greetMsg = {
	"...if the expected constant is higher than... Hmmm, who are you?? What do you want?",
	"...then I could transform a spell to bend... How can anyone expect me to work under these conditions?? What do you want?",
	"...if my calculations are correct, I will be able to revive... Arrgghh!! What do you want?"
}
local thinkMsg = {
"Oh my! Alverus!! Did you really...?!?! I have to recalculate it to make sure that I made no mistake.",
"...the minimum square deviation could cause a dislocation, in a matter of fact...",
"...it could be possible to bring the sphere to a destination where...",
"...the arithmetical paradox has the same value in a metaphysical way, then...",
"<mumbles>",
"Yes, that's it! The elementary particle are corresponding to the... the ... UNBELIEVEABLE!!! "
}

function onCreatureAppear(cid)				npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) 			npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) 	npcHandler:onCreatureSay(cid, type, msg) end
function onThink() 						npcHandler:onThink() end

function thinkCallback(cid)
	local rand = math.random(250)
	if thinkMsg[rand] then
		npcHandler:say(thinkMsg[rand])
	end
	return true
end

function greetCallback(cid)
	npcHandler:setMessage(MESSAGE_GREET, greetMsg[math.random(#greetMsg)])
	Topic[cid] = 0
	return true
end

function creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	elseif msgcontains(msg, "job") then
		npcHandler:say("How dare you asking me this?!? I'm Arkulius - Master of Elements, the HEADMASTER of this academy!!", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "name") then
		npcHandler:say("I'm Arkulius - Master of Elements, the headmaster of this academy.", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "help") then
		npcHandler:say("I have better things to do than helping you. See that ice statue over there? My dear friend Alverus needs to be revived!", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "time") then
		npcHandler:say("Time is an illusion and completely irrelevant to me.", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "weapon") then
		npcHandler:say("Weapons are for those people who aren't able to use their heads or better what's INSIDE their heads. No offence <coughs>.", cid) -- < Knight; FIXME !!!
		Topic[cid] = 0
	elseif msgcontains(msg, "pits") and msgcontains(msg, "of") and msgcontains(msg, "inferno") then
		npcHandler:say("Yeye, I believe you almost feel like home among all those brainless creatures!", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "alverus") then
		npcHandler:say({"It happened while he carried out an experiment concerning the creation of the elemental {shrines}. I still get goose bumps just by thinking of it. ...", "You need to know about the process of creating an elemental shrine to understand it completely, but I don't want to go into detail now. ...", "Anyway, his spell had a different outcome than he had planned. He accidentally created an Ice Overlord, pure living elemental ice, who froze him in a blink of an eye."}, cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "shrine") then
		npcHandler:say({"The creation of the elemental shrines is a really complex matter. They are actually nodes, locations where the matching elemental sphere is very close. ...", "The shrine itself is like a portal between our world and the elemental {sphere} and enables us to use the elemental energy emerging from it."}, cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "sphere") and getPlayerLevel(cid) >= 80 then
		npcHandler:say({"There are four spheres we know of: ice, fire, earth and energy. ....<mumbles> Hmmm, should I ask or not?....The heck with it! Now that you know about the spheres ...", "I found a way to visit them. It's VERY dangerous and there is a decent chance that you won't come back BUT if you succeed you'll write history!!! Ask me about that {mission} if you're interested."}, cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "mission") or msgcontains(msg, "quest") then
		local v = getPlayerStorageValue(cid, storageMain)
		if v < 1 then
			if getPlayerLevel(cid) >= 80 then
				if isSorcerer(cid) then
					npcHandler:say({"Okay, listen closely: First of all, you need to gather 20 enchanted rubies in order to go to the fire sphere. Deep under the academy, one floor below the elemental shrines, there is a machine. Put the gems in there and activate it. ...", "Once you got there, find a way to gather elemental fire in any form. You will face fire elementals, that's for sure, but I don't know how the fire is stored. ...", "Anyway, there should be a way to use that elemental fire and strengthen one of the elementals. If my calculations are right, you will create a Fire Overlord who hopefully will consist of some sort of 'concentrated' fire or something similar. ...", "THAT'S what we need!! Are you in on it?"}, cid)
				elseif isDruid(cid) then
					npcHandler:say({"Okay, listen closely: First of all, you need to gather 20 enchanted emeralds in order to go to the earth sphere. Deep under the academy, one floor below the elemental shrines, there is a machine. Put the gems in there and activate it. ...", "Once you got there, find a way to gather elemental earth in any form. You will face earth elementals, that's for sure, but I don't know how the earth is stored. ...", "Anyway, there should be a way to use that elemental earth and strengthen one of the elementals. If my calculations are right, you will create an Earth Overlord who hopefully will consist of some sort of 'concentrated' earth or something similar. ...", "THAT'S what we need!! Are you in on it?"}, cid)
				elseif isPaladin(cid) then
					npcHandler:say({"Okay, listen closely: First of all, you need to gather 20 enchanted sapphires in order to go to the ice sphere. Deep under the academy, one floor below the elemental shrines, there is a machine. Put the gems in there and activate it. ...", "Once you got there, find a way to gather elemental ice in any form. You will face ice elementals, that's for sure, but I don't know how the ice is stored. ...", "Anyway, there should be a way to use that elemental ice and strengthen one of the elementals. If my calculations are right, you will create an Ice Overlord who hopefully will consist of some sort of 'concentrated' ice or something similar. ...", "THAT'S what we need!! Are you in on it?"}, cid)
				elseif isKnight(cid) then
					npcHandler:say({"Okay, listen closely: First of all, you need to gather 20 enchanted amethysts in order to go to the energy sphere. Deep under the academy, one floor below the elemental shrines, there is a machine. Put the gems in there and activate it. ...", "Once you got there, find a way to gather elemental energy in any form. You will face energy elementals, that's for sure, but I don't know how the energy is stored. ...", "Anyway, there should be a way to use that energy and strengthen one of the elementals. If my calculations are right, you will create an Energy Overlord who hopefully will consist of some sort of 'concentrated' energy. ...", "THAT'S what we need!! Are you in on it?"}, cid)
				end
			else
				npcHandler:say("I'm sorry this task is highly dangerous and I need experienced people for it.", cid)
				Topic[cid] = 0
				return
			end
			Topic[cid] = 1
		elseif v == 1 then
			if --[[getPlayerStorageValue(cid, storageKill) == 1 and]] getPlayerItemCount(cid, isSorcerer(cid) and 8304 or isDruid(cid) and 8305 or isPaladin(cid) and 8300 or isKnight(cid) and 8306) > 0 then
				setPlayerStorageValue(cid, storageMain, 2)
				npcHandler:say({"Impressive!! Let me take a look.......Ahh, " .. (isSorcerer(cid) and "an ETERNAL FLAME! Now you need to find a knight, a druid, and a paladin who also completed this first task. ..." or isDruid(cid) and "MOTHER SOIL! Now you need to find a knight, a paladin, and a sorcerer who also completed this first task. ..." or isPaladin(cid) and "a FLAWLESS ICE CRYSTAL! Now you need to find a knight, a druid, and a sorcerer who also completed this first task. ..." or isKnight(cid) and "PURE ENERGY! Now you need to find a druid, a paladin, and a sorcerer who also completed this first task. ..."), "Go down in the cellar again. I prepared a room under the academy where it should be safe. Your task is to charge the machines with the elemental substances and summon the LORD OF THE ELEMENTS. ...", "When you use an obsidian knife on it's corpse you hopefully get some of the precious neutral matter. It's the only way to revive my dear friend Alverus!!"}, cid)
			else
				npcHandler:say("You need some kind of pure elemental soil from the " .. (isSorcerer(cid) and "Fire" or isDruid(cid) and "Earth" or isPaladin(cid) and "Ice" or isKnight(cid) and "Energy") .. " Overlord. Come back when you've got it.", cid)
			end
			Topic[cid] = 0
		elseif v == 2 then
			if --[[getPlayerStorageValue(cid, storageKill) == 2 and]] doPlayerRemoveItem(cid, 8310, 1) == TRUE then
				npcHandler:say("AMAZING!! I'm going to start immediately with the research. If it turns out the way I expect it, Alverus will be revived soon!! Here, take this as a reward and try to collect more of this substance. I'll make you a good offer, I promise. ", cid)
				doPlayerAddItem(cid, isSorcerer(cid) and 8867 or isDruid(cid) and 8869 or isPaladin(cid) and 8853 or isKnight(cid) and 8883, 1)
				setPlayerStorageValue(cid, storageMain, 3)
			end
		end
	elseif Topic[cid] == 1 and msgcontains(msg, "yes") then
		setPlayerStorageValue(cid, storageMain, 1)
		npcHandler:say("Good, don't waste time! Come back here when you have the elemental object!", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "trade") and getPlayerStorageValue(cid, 65100) == 3 then
		local items = {{name="neutral matter", id=8310, sell=5000, subType = 1}}
		openShopWindow(cid, items,
			function(cid, itemid, subType, amount, ignoreCap, inBackpacks)
				customCallbackOnBuy(cid, itemid, subType, amount, ignoreCap, inBackpacks, items)
			end,
			function(cid, itemid, subType, amount, ignoreCap, inBackpacks)
				customCallbackOnSell(cid, itemid, subType, amount, ignoreCap, inBackpacks, items)
			end
		)
		npcHandler:say("I only buy neutral matter. You'll get 5,000 gold for each.", cid)
		Topic[cid] = 0
	end
	return TRUE
end

npcHandler:setMessage(MESSAGE_WALKAWAY, "Good bye and please stay away, okay?")
npcHandler:setMessage(MESSAGE_FAREWELL, "At last! Good things come to those who wait.")
npcHandler:setCallback(CALLBACK_ONTHINK, thinkCallback)
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Lua:
local spheres = {
	['energy overlord'] = 8568,
	['fire overlord'] = 8569,
	['ice overlord'] = 8570,
	['earth overlord'] = 8578
}

function onKill(cid, target)
	if isPlayer(target) == FALSE then
		local name = getCreatureName(target):lower()
		if spheres[name] then
			setGlobalStorageValue(spheres[name], -1)
		end
	end
	return true
end
add in your enchanting.lua:
Lua:
local spheres = {
	[7759] = {3, 7},
	[7760] = {1, 5},
	[7761] = {2, 6},
	[7762] = {4, 8}
}

	if isInArray({33268, 33269}, toPosition.x) == TRUE and toPosition.y == 31830 and toPosition.z == 10 and getPlayerStorageValue(cid, 65100) > 0 then
		if isInArray(spheres[item.itemid], getPlayerVocation(cid)) ~= TRUE then
			return FALSE
		elseif isInArray({7915, 7916}, itemEx.itemid) == TRUE then
			doCreatureSay(cid, 'Turn off the machine first.', TALKTYPE_ORANGE_1)
			return TRUE
		else
			setPlayerStorageValue(cid, 65102, math.max(1, getPlayerStorageValue(cid, 65102) + 1))
			doSendMagicEffect(toPosition, CONST_ME_PURPLEENERGY)
			doChangeTypeItem(item.uid, item.type - 1)
			return TRUE
		end
	end
add in your obsidian_knife.lua:
Lua:
	if itemEx.itemid == 9010 then
		if getPlayerStorageValue(cid, 65049) <= 0 then
			doSendMagicEffect(toPosition, CONST_ME_MAGIC_GREEN)
			doPlayerAddItem(cid, 8310, 1)
			setPlayerStorageValue(cid, 65049, 1)
		else
			doCreatureSayWithRadius(cid, "You already used your knife on the corpse.", TALKTYPE_ORANGE_1, 1, 1)
		end
		return TRUE
	end
replace the attributes of these items in items.xml:
XML:
		<item id="8574" article="an" name="ice sculpture">
		<attribute key="decayTo" value="8571"/>
		<attribute key="duration" value="100"/>
	</item>
	<item id="8575" article="a" name="magma hole">
		<attribute key="decayTo" value="8573"/>
		<attribute key="duration" value="100"/>
	</item>
	<item id="8576" article="a" name="mushroom">
		<attribute key="decayTo" value="8572"/>
		<attribute key="duration" value="100"/>
	</item>
they're for 0.2, but should work on newer
also
Lua:
doCreatureSay(getTopCreature({x=33266, y=31835, z=13}).uid, 'You have 10 minutes from now on until you get teleported out.', TALKTYPE_ORANGE_2)
put a monster on this pos so it can yell the messages (that's under the room)
 
Last edited:
Cyko gets joy not out of scripting, but out of making OP's fill like sh*t =)))
 
feel*

vF7vh.png
 
Not owned by Cyko, he's just showing off...he's got everything.
 
Status
Not open for further replies.
Back
Top