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

Lua Summon damage based on owner lv

natanal99

New Member
Joined
May 31, 2011
Messages
67
Reaction score
3
i have made summon's life based on the owners one, using setCreatureMaxHealth.
And i used setCreatureMaxMana to set the summon's mana the same as the owners level.
So, is there a way i can use the creature's maxMana or the owner's level in a spell for the summon or something like that?
 
Yes you can dude. I wont code it for you but isnt so hard. You just need to check if the player have a summon, if have doCombat. In combat you use GetFormulaValues, then you identify the factors of you spell (lvl, ml, storage, whatever), after this you send a distanceedect from your summon till the target. Its my way, may have others
 
So, i give it a try and that's the closest i got:


Code:
local distanceCombat = createCombatObject()
setCombatParam(distanceCombat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatParam(distanceCombat, COMBAT_PARAM_EFFECT, 6)
setCombatParam(distanceCombat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)

function getSpellDamage(cid, lv)

        local power = getPlayerMaxMana(cid)
        local spellDamage = 6.33
        damage_min = power * spellDamage
        damage_max = power * spellDamage

        if(damage_max < damage_min) then
                local tmp = damage_max
          damage_max = damage_min
          damage_min = tmp
        end
        return -damage_min, -damage_max
end

setCombatCallback(distanceCombat, CALLBACK_PARAM_SKILLVALUE, "getSpellDamage")



function onThink(cid, interval)

    if(not isPlayer(cid)) then
        return false
    end
   
    if (getPlayerVocation(cid) ~= 5) then
        return false
    end
   
    local count = #getCreatureSummons(cid)
    if (count == 0) then
        return false
    end
   
    if(getCreatureTarget(cid) == 0) then
        return false
    end
   
local var = getCreaturePosition(getCreatureTarget(cid))
return doCombat(cid, distanceCombat, var)
end

i really have no idea what an i supposed to code here:

Code:
local var = ???

i tried player target, then player target pos, but nothing works :/
can someone help me?
 
this solve my problem:
Code:
numberToVariant(getCreatureTarget(cid))

but i have one last problem, my tag in creaturescript.xml is like this:
Code:
    <event type="think" interval="1000" name="summonattacks" event="script" value="summonattacks.lua"/>

and the interval isn't working, it's happening rly fast, i would guess it's 500ms no matter what number i type, i could just put an exhaust condition but why is it happening?
 
Back
Top