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

Solved Experience is not given when atk with wand! TFS 1.1

danne3131

Active Member
Joined
Jun 26, 2008
Messages
390
Solutions
1
Reaction score
48
The damage dealt doesnt give any exp, Lets say a mosnter have 100 hp and gives 100 exp.. If the wand is doing 50 damage and 50 damage are given by etc Exori vis, The player only recieve exp by the Exori vis (50Damage) and the 50 damage give by wand isnt calculated to exp

What is the code to add this into the script? =) Thanks!

Code:
function onUseWeapon(player, var)
        local item = player:getSlotItem(CONST_SLOT_LEFT)
        if not item or item.itemid ~= 2453 then
                return true
        end
        local element = elements[item.actionid]
        if not element then
                player:sendCancelMessage("You must enchant this wand before using it. Ask Magic Mike located in Thais temple for more information!")
                return true
        end
        local target = Creature(var:getNumber())
        player:getPosition():sendDistanceEffect(target:getPosition(), element.distEff)
        doTargetCombatHealth(0, target, element.dmgType, -115, -150, element.magEff)
        return true
end
 
i don't see any lines where you experience..
Are you using TFS 1.0?

damage = the damage you did to monster.
doPlayerAddExp(player, damage)

or what exp we talking about? magic level exp or player exp?
 
Both magic level and player exp are appreciated! Since wand takes mana and the wand deals damage! you you got it right @whitevo

Can u help me with this? =)

@whiteve IM using TFS 1.1 sorry for not mentation.
 
Last edited by a moderator:
I already told you how to add Exp
And adding magic exp should be with manaSpent(player, value)

Im on android so too much hassle to check if manaSpent is correct.
If you want exactly the damage what you make go to exp then you need to make the script onHealthChange i think. And in creatureevents. There you would get the primaryDamage.

Else simply use static number. Or make mathrandom between min and max damage and use that variable.
 
The first parameter in doTargetCombatHealth is the attacker/creature executing the combat, so you can do it like Evil Hero posted. If the attacker is not a player it won't be counted as damage from that player (so it's like something else is doing the damage).
 
Back
Top