• 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 thanks to cykotitan as usual]

Exmortis

Member
Joined
Jun 27, 2008
Messages
189
Reaction score
5
No replies yet, i'm supprised.
How about if you make it so that when u pull the lever, all players standing on the platforms dies?

What's up!
So I've been thinking alot about this structure on my otserver.
And finally i've gathered the guts to ask you guys if you could make a scripts so that when
there are skulled players that stands on the platforms and someone pulls the lever, the players dies and falls through the floor.
(but if the players only dies, thats enough for me.)
And maybe some text or broadcast or something like "Justice has been served.".
hanging.jpg

Comon people! I know there's talented scripters out there! :D

Tell me what you think is possible!
I bet this could be a challenge. Anyone ready to step up? :D

ID for switch:9827, 9828
ID for wooden floor and open hatch (for player to fall through): 3217, 8281
 
Last edited:
Lua:
local positions = {
	{x=498, y=538, z=8, stackpos=0},
	{x=498, y=540, z=8, stackpos=0},
	{x=498, y=542, z=8, stackpos=0},
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 9827 then
		local t = {}
		for _, v in ipairs(positions) do
			local tmp = getTopCreature(v).uid
			if isCreature(tmp) then
				table.insert(t, tmp)
			end
			doRelocate(v, {x=v.x, y=v.y, z=v.z+1})
			doTransformItem(getThingfromPos(v).uid, 3137)
		end
		for i = 1, #t do
			if isPlayer(t[i]) then
				doBroadcastMessage('Justice has been served to ' .. getCreatureName(t[i]) .. '.')
			end
			doCreatureAddHealth(t[i], - getCreatureHealth(t[i]), 0, COLOR_RED, true)
		end
	else
		for _, v in ipairs(positions) do
			doTransformItem(getThingfromPos(v).uid, 3217)
		end
	end
	return doTransformItem(item.uid, item.itemid == 9827 and 9828 or 9827)
end
Don't forget to change the positions.
 
Last edited:
Hm, the players fall through the floor and end up beneath the hanging but the justice message doesnt broadcast, and the players dont loose any life.
Also a reset thing would be awesome. Anyway, you're getting rep for doing this for me, so the hanging place isnt just a deco :D
Thanks mate

Error: Lua Script Error: [Action Interface]
data/actions/scripts/other/hanging.lua:eek:nUse
data/actions/scripts/other/hanging.lua:20: in function <data/actions/scripts/other/hanging.lua:7>
LuaGetcreaturename<>. Creature not found
data/actions/scripts/other/hanging.lua:20: attempt to call global 'doBroadcastMessage' <a nil value>
stack traceback: data/actions/scripts/other/hanging.lua:20: in function <data/actions/scripts/other/hanging.lua:7>
 
It's because of your distribution. I forgot you were using an older TFS.

Lua:
local positions = {
	{x=498, y=538, z=8, stackpos=0},
	{x=498, y=540, z=8, stackpos=0},
	{x=498, y=542, z=8, stackpos=0},
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 9827 then
		local t = {}
		for _, v in ipairs(positions) do
			local tmp = getTopCreature(v).uid
			if isCreature(tmp) == TRUE then
				table.insert(t, tmp)
			end
			doRelocate(v, {x=v.x, y=v.y, z=v.z+1})
			doTransformItem(getThingfromPos(v).uid, 3137)
		end
		for i = 1, #t do
			if isPlayer(t[i]) == TRUE then
				broadcastMessage('Justice has been served to ' .. getCreatureName(t[i]) .. '.', MESSAGE_STATUS_WARNING)
			end
			doTargetCombatHealth(0, t[i], COMBAT_PHYSICALDAMAGE, - getCreatureHealth(t[i]), - getCreatureHealth(t[i]), CONST_ME_NONE)
		end
	else
		for _, v in ipairs(positions) do
			doTransformItem(getThingfromPos(v).uid, 3217)
		end
	end
	return TRUE, doTransformItem(item.uid, item.itemid == 9827 and 9828 or 9827)
end
 
Back
Top