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

Effect System Following Player [OTCv8] Definitive Tutorial How Use Auras.

underewar

Well-Known Member
Joined
Feb 9, 2013
Messages
61
Reaction score
74
Location
Brazil
GitHub
Underewarrr
I want to share with you guys this example, becauase its not to hard to do, and i see alot post with people doing it wrong.
Hello guys, recently i was struglin to make effect follow players and avoid this behavior


fb25ca195e0a13d87e0ca6dbf78c36c5-_1_.gif
First i was trying to create a new c++ function to handle DrawEffectAttached, after some research i discovery aura system for otcv8 its already doing exact this.

This is final result wich new custom effect following the player frame by frame without an new call.
d73a61714593535005b8d5ff00592d38.gifSo lets talk about the aproach i got to make this new effect for spells:

New Spell System Rework​

New Spell Added Genki Dama

This system use as core outfit from tibia spr to find an aura type with outfit.lookaura

How outfit.lookAura works?​

Its use the same structure for draw outfit to draw any other on Z-Index.
That means like mounts wich its bellow origin outfit, in this case we use this above character to use like an effect.

New Added
Added Effect animation
Define function to handle aura effect start
LUA:
Spell:startEffectAnimation(player, auraEffect)
Define function to handle aura effect stop
LUA:
Spell:stopEffectAnimation(player, targetPos)

Its very simple, now when we want to call an effect we use this outfit type.
I have worked in multiple function to make the code better and clean.

New Added
Added Effect Damage
Define function to handle detection based on targeted monster.
LUA:
TargetSpell:getCreaturesInRange(position, range)
Define function to handle damage in detection area in targeted monster.
LUA:
TargetSpell:applyDamageToMonstersAroundPosition(player, targetPos, minDamage, maxDamage, range)

Well in this case instead filter an array with all creature in screen, and aiming increase perfomance in any scenario i have added a verywell made custom detect monster based on creature target for this new target system.
increased this range will increase radius of effect in targeted spell.

Also we have an new system for targeted damage now we can apply range wich increase the Radius in genki dama increasing the arround damage when hited.

New Added
effect_list

To this works well you need to add aura with looktype id on auras.xml
XML:
<?xml version="1.0" encoding="UTF-8"?>
<auras>
    <aura id="1" clientid="918" name="Genki Dama Effect" speed="20" />
</auras>
This list will maintain all Constants for these system bellow.

Examples:


LUA:
effect = {
sayian = {
genki_dama = 918,
},
-- This is how maintain new effects in this file.
creatures = {
fireBallNewExample = 6666
},
}


when you need to acess in any lua script just use obj orientation, that mean acess keys using obj
effect.sayian.genki_dama to acess the value 918

Important:

Todo:
  • Spell Stats Manager, Increase and Decrease Values
Done:
  • Add Combat Function to spell damage (Comented in ApplyDamageFunction)
  • Spell Stats Min,Max Damage
  • Spell Stats AreaOfEffect(AOE)
How make it better:
Instead have an file effect_list we should load direct from aura.xml(Its beeing a redundant file at momment)
 
Back
Top