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

MoveEvent Flame wall.

EvulMastah

๏̯͡๏﴿
Premium User
Joined
Aug 19, 2007
Messages
4,941
Solutions
11
Reaction score
352
This idea recently comes from someone who I cant remember. x|

data/movements/scripts/flamewall.lua:
Code:
local config = {
	flameWall = 5062,
	started = FALSE,
	createDelayMargin = 0,
	removeDelayMargin = 0,
	minDamage = 50,
	maxDamage = 100,
	positions = {
			{ x = 236, y = 565, z = 6 , stackpos = 1 },
			{ x = 237, y = 565, z = 6 , stackpos = 1 },
			{ x = 238, y = 565, z = 6 , stackpos = 1 },
			{ x = 239, y = 565, z = 6 , stackpos = 1 },
			{ x = 240, y = 565, z = 6 , stackpos = 1 },
			{ x = 241, y = 565, z = 6 , stackpos = 1 },
			{ x = 242, y = 565, z = 6 , stackpos = 1 },
			{ x = 243, y = 565, z = 6 , stackpos = 1 },
			{ x = 244, y = 565, z = 6 , stackpos = 1 }
		}
	}
local function reset(position)
	config.createDelayMargin = 0
	config.createDelayMargin = 0
	doSendMagicEffect(position, CONST_ME_FIREAREA)
	return TRUE
end

local function hitCreature(position)
	local thing = getThingfromPos(position)
	local damage = math.random(config.minDamage, config.maxDamage)
	if isCreature(thing.uid) == TRUE then
		if getCreatureCondition(thing.uid, CONDITION_MANASHIELD) == TRUE then
			if getCreatureMana(thing.uid) >= damage then
				doTargetCombatMana(0, thing.uid, - damage, - damage, CONST_ME_LOSEENERGY)
			elseif getCreatureMana(thing.uid) < damage then
				doTargetCombatMana(0, thing.uid, - damage, - damage, CONST_ME_HITBYFIRE)
				doTargetCombatHealth(0, thing.uid, COMBAT_FIREDAMAGE, - damage, - damage, CONST_ME_HITBYFIRE)
			end
		else
			doTargetCombatHealth(0, thing.uid, COMBAT_FIREDAMAGE, - damage, - damage, CONST_ME_HITBYFIRE)
		end
	end
	return TRUE
end

local function creation(position)
	local thing = getThingfromPos(position)
	if isPlayer(thing.uid) == TRUE then
		hitCreature(position)
		return FALSE
	end
	doCreateItem(config.flameWall, 1, position)
	return TRUE
end

local function removal(position)
	local thing = getThingfromPos(position)
	if thing.uid > 0 then
		if isPlayer(thing.uid) == TRUE then
			return FALSE
		end
	doRemoveItem(thing.uid)
	end
	return TRUE
end

local function start()
	for i = 1, table.maxn(config.positions) do
		config.createDelayMargin = config.createDelayMargin + 200
		config.removeDelayMargin = config.createDelayMargin + 200
		addEvent(creation, config.createDelayMargin, config.positions[i])
		addEvent(removal, config.removeDelayMargin, config.positions[i])
		if i == table.maxn(config.positions) then
			addEvent(reset, config.createDelayMargin, config.positions[i])
			addEvent(start, config.createDelayMargin)
		end
	end
	return TRUE
end

function onStepIn(cid, item, position, fromPosition)
	if isPlayer(cid) == TRUE and config.started == FALSE then
		config.started = TRUE
		start()
	end
	return TRUE
end

And add it in movements.xml also.

I have found already one bug, but doubt Ill be able to fix it:
- When you will step in the 'right' moment on the flame, it will stay, but the others will still go.

Have fun oki.

-----
If someone does not know what it does:
It creates a loop of creating and removing flame wall item which goes from one side to the other hitting creatures that walks into it.
 
Last edited:
Back
Top