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

Exevo gran mas pox (same dmg to players and monsters)

jakub742

Member
Joined
May 1, 2010
Messages
144
Solutions
2
Reaction score
20
Location
Slovakia
Hello. I want to ask if its possible to make the spell exevo gran mas pox immune to
Code:
--how much % of the total damage players actually receive when attacked by other players?
--Old Tibia has this in 100%
pvp_damage = 50

I want the same damage to monsters and players but only for this spell. I dont want to change the other spells just this one.
 
remove the formula (the line with the numbers) of the spell and add:

Lua:
onGetFormulaValues(cid, level, magic etc etc)
min = -(your formula for min damage)
max = -(your formula for max damage)

if isPlayer(cidEx --> i'm not sure about the syntax, you will have to search more, but make sure you are checking if the TARGET is the player, not the one who casts the spell) then
return(2*min, 2*max)
else return(min, max)
end
end

By default, players receive 50% less damage than monsters, so that's why I doubled the damage.
 
remove the formula (the line with the numbers) of the spell and add:

Lua:
onGetFormulaValues(cid, level, magic etc etc)
min = -(your formula for min damage)
max = -(your formula for max damage)

if isPlayer(cidEx --> i'm not sure about the syntax, you will have to search more, but make sure you are checking if the TARGET is the player, not the one who casts the spell) then
return(2*min, 2*max)
else return(min, max)
end
end

By default, players receive 50% less damage than monsters, so that's why I doubled the damage.
you are just writing poor non-code and thats a bad habit, for the people who doesnt understand this its like a "solution" what you posted and thats not correct
 
you are just writing poor non-code and thats a bad habit, for the people who doesnt understand this its like a "solution" what you posted and thats not correct

I just gave him an idea lol, I'm pretty sure he is capable of finishing the rest on his own. It is not something difficult
 
remove the formula (the line with the numbers) of the spell and add:

Lua:
onGetFormulaValues(cid, level, magic etc etc)
min = -(your formula for min damage)
max = -(your formula for max damage)

if isPlayer(cidEx --> i'm not sure about the syntax, you will have to search more, but make sure you are checking if the TARGET is the player, not the one who casts the spell) then
return(2*min, 2*max)
else return(min, max)
end
end

By default, players receive 50% less damage than monsters, so that's why I doubled the damage.
Thanks man. I totally forgot that i could check if target is a player in LUA script.

Im having an issue with isPlayer function. I dont know if i can access target ID outside of onCastSpell function. Because i keep hitting 50% to players.
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_POISONDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_GREEN_RINGS)
function onGetFormulaValues(cid, level, maglevel)
   local min = -((level/2)+(maglevel*5))
   local max = -((level/2)+(maglevel*10))
   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "target: " ..target)
   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "target name: " ..getPlayerName(target))
   if isPlayer(target) then
     return 2*min, 2*max
   else
     return min, max
   end
end

local condition = createConditionObject(CONDITION_POISON)
setConditionParam(condition, CONDITION_PARAM_DELAYED, 1)
addDamageCondition(condition, 10, 2000, -10)
setCombatCondition(combat, condition)

local arr = {
    {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
    {0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
    {0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
    {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
    {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
    {1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1},
    {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
    {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
    {0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
    {0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
    {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}
}

local area = createCombatArea(arr)
setCombatArea(combat, area)
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
function onCastSpell(cid, var)
  target = variantToNumber(var)
    return doCombat(cid, combat, var)
end

Here is my code. But the target keeps returning my name.
 
Last edited by a moderator:
Are you sure 'target' is the right syntax for this? Try cidEx, I think i've seen it somewhere, but you are probably right about being unable to access target outside of onCast
 
Same thing with cidEx i guess its nul value.
I have an idea, if you don't understand just tell me and I will write the script for you.

Create two combats instead of only one. On the first one you use min and max values with onGetFormulaValues, and on the second combat you use 2*min 2*max.

Then INSIDE the onCastSpell you return doCombat (cid, combat, var) if target is monster and return doCombat (cid, combat2, var) if target is player. Since this will be used inside the onCastSpell, the target will be acknowledged
 
I have an idea, if you don't understand just tell me and I will write the script for you.

Create two combats instead of only one. On the first one you use min and max values with onGetFormulaValues, and on the second combat you use 2*min 2*max.

Then INSIDE the onCastSpell you return doCombat (cid, combat, var) if target is monster and return doCombat (cid, combat2, var) if target is player. Since this will be used inside the onCastSpell, the target will be acknowledged

I believe this will not work, since exevo gran mas pox is an area spell. You don't know the target at the time spell is casted.
 
I believe this will not work, since exevo gran mas pox is an area spell. You don't know the target at the time spell is casted.
Yea you are right i dont have a target inside the onCombat function. The var should be target if i use variantToNumber but since this is area spell the variantToNumber(var) is only my ID.
 
Back
Top