CoverPower
New Member
- Joined
- Apr 1, 2013
- Messages
- 19
- Reaction score
- 1
dear developers,
is there any function that returns the CID of the caster?
im creating a spell but the area of the spell have to be based on my current location.
OTHire Beta 0.0.2
OpenTibia Server for Tibia 7.72..
problem here is that i cannot setCobmatArea inside onCastSpell. setCobmatArea "can only be used while loading the script" so theres no way for me to send CID into setArea function. do you have any idea how could i solve this?
SOLVED
[SOLVED]
is there any function that returns the CID of the caster?
im creating a spell but the area of the spell have to be based on my current location.
OTHire Beta 0.0.2
OpenTibia Server for Tibia 7.72..
Code:
function setArea(cid) -- <------- this function doesnt know the CID
.... --some code
playerpos = getPlayerPosition(cid)
.... --some code
local area = {}
..... --some code
return area
end
local area = createCombatArea(setArea())
setCombatArea(combat, area)
function onCastSpell(cid, var)
doCombat(cid, combat, var)
return true
end
problem here is that i cannot setCobmatArea inside onCastSpell. setCobmatArea "can only be used while loading the script" so theres no way for me to send CID into setArea function. do you have any idea how could i solve this?
SOLVED
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_EXPLOSIONAREA)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_DEATH)
function onGetFormulaValues(cid, level, maglevel)
return -(((maglevel * 1.2) + 25) + (level / 5)), -(((maglevel * 1.2) + 25) + (level / 5)), 0
end
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
function onCastSpell(cid, var)
local players = {}
players = getSpectators(getPlayerPosition(cid), 10, 10, false)
for index,value in pairs(players) do
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, value)
doCombat(cid, combat, numberToVariant(value))
end
return true
end
[SOLVED]
Last edited: