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

Advanced Fire Field

Xagul

deathzot.net
Joined
Jun 30, 2008
Messages
1,295
Solutions
3
Reaction score
1,043
Hello, I have been searching/experimenting and I just cant seem to figure this one out myself so I was hoping someone here could help me.

Back in the older OT Days fire field rune damage was based on the rune itself. So you could have fire field rune A make a fire field that hit for 10 dmg and fire field B that hit for 100 damage ect. I was wondering if there was a way to kinda simulate that idea nowadays on TFS. I just wanted to make a few different versions of fire field instead of the same 20 dmg on every fire field.
 
Either add more fire field IDs with OTItemEditor and change their damage in items.xml then,
or make something like actionid on fire fields, and a movement script.
 
Meh, was trying to stay away from actionid's >.< I don't understand how there can be a way to do it in older OTs and then the function just disappears into thin air over time =\
 
Well in the end, I want a fire field that is based on level/maglvl xD so with actionid's it would take alot of them =\
 
in spell script:
Code:
	local lvl, mlvl = getPlayerLevel(cid) * 0.5, getPlayerMagLevel(cid) * 2
	local field = doCreateItem(1492, 1, variantToPosition(var))
	doDecayItem(field)
	doItemSetAttribute(field, 'aid', 100 + lvl + mlvl)
? :)
and in onStepIn script, get damage from actionid :)
 
My server is a higher rate server so I didn't think this would work due to the actionid's being so high (I thought 65535 was the highest actionid) I however just tested this and it is not therefore this will work :D thanks alot for this idea <3
 
Sorry, I just realized with this script... if you kill a monster with it, you will not gain exp :(
 
well, i guess it's not possible to set owner with a lua function. it can only be set if you use COMBAT_PARAM_CREATEITEM

Well, maybe try using COMBAT_PARAM_CREATEITEM and then get the field from position?

local field = getTileItemById(variantToPosition(var), 1492).uid

(but remember to do combat first)

something like this:
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
setCombatParam(combat, COMBAT_PARAM_CREATEITEM, 1492)

function onCastSpell(cid, var)
	local f = doCombat(cid, combat, var)
	if f then
		local lvl, mlvl = getPlayerLevel(cid) * 0.5, getPlayerMagLevel(cid) * 2
		local field = getTileItemById(variantToPosition(var), 1492).uid
		doItemSetAttribute(field, 'aid', 100 + lvl + mlvl)
	end
	return f
end
if it's multiple tiles (area) you can use onTargetTile callback.
 
But the move event is still basically the same which I don't think will give the exp to the player since the damage is not being done by the player its being done by the move event. I have not scripted the move event yet however I would assume it should look something like this:

Code:
doTargetCombatHealth(0, cid, COMBAT_PHYSICALDAMAGE, -item.actionid, -item.actionid, CONST_ME_NONE)
 
Here is my failed attempt xD

the rune (added quas suggestion to Cykos suggestion):

Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
setCombatParam(combat, COMBAT_PARAM_CREATEITEM, 1504)

function onCastSpell(cid, var)
	local f = doCombat(cid, combat, var)
	if f then
		local lvl, mlvl = getPlayerLevel(cid) * 0.5, getPlayerMagLevel(cid) * 2
		local field = getTileItemById(variantToPosition(var), 1504).uid
		doItemSetAttribute(field, 'aid', 100 + lvl + mlvl)
		doItemSetAttribute(field, "owner", getCreatureName(cid))
	end
	return f
end

And here is the field movement (just a test so I used 99 damage):

Code:
function onStepIn(cid, item, pos)
		doTargetCombatHealth(0, cid, COMBAT_PHYSICALDAMAGE, -99, -99, CONST_ME_NONE)
	return true
end

Everything works properly however it still says "18:33 You lose 99 hitpoints." when you walk on another players field (so I am assuming it will not give exp still)
 
Code:
function onStepIn(cid, item, pos)
	local owner = getItemAttribute(item, 'owner')
	doTargetCombatHealth(isCreature(owner) and owner or 0, cid, COMBAT_ENERGYDAMAGE, -99, -99, CONST_ME_NONE)
end
 
For some reason doItemSetAttribute doesn't work for me or it doesn't work here too?
No error just nothing happens
 
still:

Code:
19:29 You lose 99 hitpoints.

Also, doItemSetAttribute is working I have confirmed that the field has the player name as the owner however it is still not acting like the owner is doing the damage.
 
Changed. Getting an error now.
Code:
[19:44:24.140] [Error - MoveEvents Interface]
[19:44:24.141] data/movements/scripts/fire.lua:onStepIn
[19:44:24.141] Description:
[19:44:24.141] (luaDoTargetCombatHealth) Creature not found

Also there was an error when using:

Code:
local owner = getItemAttribute(item, 'owner')

I changed to:

Code:
local owner = getItemAttribute(item.uid, 'owner')

and it worked

However I don't know why it cant find the player now >.<
 
Back
Top