Skip to content

Tutorial Attached Effects

kokekanon edited this page Dec 21, 2024 · 3 revisions

Table of Contents

  1. Register

    1.1. Category

    1.2. Properties

  2. Creature

    2.1. UIcreature

    2.2. Creature

  3. Widget

    2.1. Tile Widget

    2.2. Creature Widget

  4. Particle

  5. Server Connection


https://github.com/mehah/otclient/blob/main/modules/game_attachedeffects/effects.lua

ThingCategoryEffect:

ThingCategoryCreature :

ThingExternalTexture: are images in Png | Apng https://github.com/mehah/otclient/tree/main/data/images/game/effects

--[[`
    register(id, name, thingId, thingType, config)
    config = {
        speed, disableWalkAnimation, shader, drawOnUI, opacity
        duration, loop, transform, hideOwner, size{width, height}
        offset{x, y, onTop}, dirOffset[dir]{x, y, onTop},
        light { color, intensity}, drawOrder(only for tiles),
        bounce{minHeight, height, speed},
        pulse{minHeight, height, speed},
        fade{start, end, speed}

        onAttach, onDetach
    }
`]]

--

speed:

fade:

pulse:

disableWalkAnimation

shader

opacity

duration

transform

loop

coming soon

hideOwner

size

offset

dirOffset (offset depends on the direction of the character)

  • horizontal
  • vertical

front/back:

bounce

  UICreature
    id: creature
    anchors.top: XXXXX.top
    anchors.left: XXXXX.left
    anchors.bottom: XXXXX.bottom
    size: 32 32 
UICreature:getCreature():attachEffect(g_attachedEffects.getById(ID))
local creature = g_map.getCreatureById(Creature_ID)
if creature  then
     creature:attachEffect(g_attachedEffects.getById(ID))
end

or

 g_game.getLocalPlayer():attachEffect(g_attachedEffects.getById(ID))
local tile = g_map.getTile(g_game.getLocalPlayer():getPosition())
local widget = g_ui.createWidget('Panel')
widget:setSize({width = 90,height = 22})
widget:setText("OTC Redemption")
widget:setFont("terminus-10px")
widget:setBackgroundColor('#111111cc')
widget:setMarginBottom(40)
tile:attachWidget(widget)

image

local widget = g_ui.createWidget('Panel')
widget:setTextAutoResize(true)
widget:setText("Yes you can Deux!!! ;)")
widget:setFont("terminus-10px")
widget:setBackgroundColor('red')
widget:setColor('black')
widget:setMarginBottom(40)
widget:setFontScale(3)
g_game.getLocalPlayer():attachWidget(widget)
g_game.getLocalPlayer():attachParticleEffect("creature-effect")

image

g_map.getTile(g_game.getLocalPlayer():getPosition()):attachParticleEffect("creature-effect")

image

- 5.1. TFS : Optimized tfs by SaiyansKing https://github.com/mehah/forgottenserver-optimized

creature:attachEffectById(<effect id>, <temporary>(true | false)) -- Temporary = does not save in character

- 5.2. TFS 1.5:

player:setMapShader(shaderName, [temporary])
player:getMapShader()

creature:setShader(shaderName)
creature:getShader()
creature:detachEffectById(effectId)
creature:attachEffectById(effectId, [temporary])
<monster name="Orc" nameDescription="an orc" race="blood" experience="25" speed="150" manacost="300" raceId="5" shaderEffect = "Outfit - Rainbow" auraEffect = "8" wignsEffect ="11" rayosEffect="7" >

Important

Active features OTC

    g_game.enableFeature(GameCreatureAttachedEffect)