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

Alternative Damage

G4BB3R

New Member
Joined
Jul 23, 2010
Messages
80
Reaction score
4
1: In my server I have a spell caled conjure trap (exevo tar []), and when the player cast spell, the trap fall in the ground, but when someone steps, the player (that casted the spell) dont get Skull, and if a monster step on the trap, it dont give the experience to the player ! :/
Is possible to "associate" the trap damage to the player like an phisical damage or a agressive spell ?
Example: The player cast the spell, the trap fall in the ground, another player step on it and the the caster get skull...
Example2: The player cast the spell, the trap fall in the ground, a monster steps on the ground and the player win the normal experience...

2:Is possible to disable certain spells or ANY spell in certain area/condition ?
Example: I enter in arena and there I cant cast certain spell, and when i leave the arena, the player can cast what he want..(normal)

Thanks!

#Moderator: I think that now I posted on the correct section.. It's a request!
If not, PLEASE move it to the correct board ? Please :/
 
1: try checking how magic fields are connected with caster
2. possible, but can be anoying to code(in every single spell add check for stroage to check if isnt disabled, or do the same in source,)
oh, this is request board, but well
Hope that my post can help others to code this
 
1: try checking how magic fields are connected with caster
2. possible, but can be anoying to code(in every single spell add check for stroage to check if isnt disabled, or do the same in source,)
oh, this is request board, but well
Hope that my post can help others to code this

I dont understand the "connection" T_T
I cant find any connection

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)
return doCombat(cid, combat, var)
end

Can you help me ?
 
If there was any connection it would be limited by the config value:
Lua:
fieldOwnershipDuration

However, it is not a field, it`s an item being created - the exact same as magic wall or wild growth - there is no way without modifiying sources (and I don`t even WANT to know how many things you`d have to change...) to attribute the trap as having an owner.
 
or try in items.xml making it <attribute key="type" value="magicfield" /> and <attribute key="field" value="physical">
<attribute key="damage" value="20" />
</attribute>
 
I know it can be optimized/shortened, but it's fine for internal usage so don't complain on it.

Just in case someone in the future might want to get the normal traps working, here's the code for it:
actions.xml:
XML:
<action itemid="2578;2579" event="script" value="other/trap.lua"/>
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 2578 then
		doTransformItem(item.uid, item.itemid + 1)
		doItemSetAttribute(item.uid, 'aid', 100 + getPlayerGUID(cid))
	else
		doItemEraseAttribute(item.uid, 'aid')
		doTransformItem(item.uid, item.itemid - 1)
		doSendMagicEffect(fromPosition, CONST_ME_POFF)
	end
	return true
end
movements.xml
XML:
	<!-- Traps -->
	<movevent type="StepIn" itemid="1510" event="script" value="trap.lua"/>
	<movevent type="StepOut" itemid="1511" event="script" value="trap.lua"/>
	<movevent type="StepIn" itemid="1512" event="script" value="trap.lua"/>
	<movevent type="StepOut" itemid="1513" event="script" value="trap.lua"/>
	<movevent type="StepIn" itemid="2579" event="script" value="trap.lua"/>
	<movevent type="RemoveItem" itemid="2579" event="script" value="trap.lua"/>
	<movevent type="AddItem" itemid="2579" event="script" value="trap.lua"/>
Lua:
function onStepIn(cid, item, pos)
	if item.itemid == 2579 then
		if not isPlayer(cid) then
			doTargetCombatHealth(getPlayerByGUID(item.actionid - 100) or 0, cid, COMBAT_PHYSICALDAMAGE, -15, -30, CONST_ME_NONE)
			doTransformItem(item.uid, item.itemid - 1)
			doItemEraseAttribute(item.uid, 'aid')
		end
	else
		doTargetCombatHealth(0, cid, COMBAT_PHYSICALDAMAGE, -50, -100, CONST_ME_NONE)
		doTransformItem(item.uid, item.itemid + 1)
	end
end

function onStepOut(cid, item, pos)
	doTransformItem(item.uid, item.itemid - 1)
end

function onRemoveItem(item, tile, pos)
	if item.uid ~= 0 then
		local thingPos = getThingPos(item.uid)
		if(getDistanceBetween(thingPos, pos) > 0) then
			doTransformItem(item.uid, item.itemid - 1)
			doSendMagicEffect(thingPos, CONST_ME_POFF)
			doItemEraseAttribute(item.uid, 'aid')
		end
	end
end

function onAddItem(item, tile, pos)
	if item.actionid ~= 0 then
		doSendMagicEffect(pos, CONST_ME_POFF)
		doTransformItem(item.uid, item.itemid - 1)
		doItemEraseAttribute(item.uid, 'aid')
	end
end
If you have more than 65435 players, you'll have to use some other attribute name like owner or something.
 
Last edited:
Back
Top