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

[RevScript Help] - Sounds!

magoale1

New Member
Joined
Jun 12, 2014
Messages
22
Reaction score
1
Location
Brazil
Hello!

I was figuring out how to use RevScripts in Revscriptsys · otland/forgottenserver Wiki but I stumbled upon a doubt that I couldn't resolve, could you help me?

I am trying to make a test on-hit effect, where when you hit a creature with a specific weapon, a thunder effect will happen. But as my server version supports sounds already, I wanted to make a thunder sound happen too. I already managed to do the thunder effect and the proc function, however, I'm still unable to produce sound, what is the function to call sounds?

LUA:
local on_hit = CreatureEvent("PlayerOnHit")

function on_hit.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    local weapon = attacker:getSlotItem(CONST_SLOT_LEFT)
    local creature_position =  creature:getPosition()

    -- Thunder God Rage --
    if weapon.itemid == 3271 then
        print("Thunder God Rage - PROC!")
        creature_position:sendMagicEffect(CONST_ME_ENERGYHIT)
        creature_position:sendSound(SOUND_EFFECT_TYPE_SPELL_LIGHTNING) -- This does not work unfortunately :c
    end

    return primaryDamage, primaryType, secondaryDamage, secondaryType
end

on_hit:register()
 
register event on login
LUA:
local LoginEvent = CreatureEvent("SoundsLogin")

function LoginEvent.onLogin(player)
  player:registerEvent("PlayerOnHit")
  return true
end
LoginEvent:type("login")
LoginEvent:register()
 
register event on login
LUA:
local LoginEvent = CreatureEvent("SoundsLogin")

function LoginEvent.onLogin(player)
  player:registerEvent("PlayerOnHit")
  return true
end
LoginEvent:type("login")
LoginEvent:register()
The event is triggering fine, the problem is that I have no idea how to call sounds via script. 😭
 
Back
Top