Give a Macro, Take a Macro!

Welcome to the forums of Runes of Magic EN & US

Rules and Guidelines: Game Rules - Community Guidelines - Terms of Use - RoM Servers Status

Customer Support: EN/EU Customer Support - US Customer Support

Get in touch with us: Join our Discord!
  • Without more pieces of information, the only thing I can recommend is to check if this file can be loaded properly and executed or if some syntax errors have sneaked in.

    Can you rule those out or have you checked with e. g. assert(loadfile(PATH_TO_THIS_FILE))?

  • Is it possible to check the health of a monster faster than every 2 seconds? For instance, when your target changes? I was trying to make a bit of code to cast flame on a monster if it had less than 800,000 HP. The code I have works fine at first, but when I target another monster and it's been less than 2 seconds, it messes up. Is there possibly a different function I could use other than UnitChangeHealth that will return the current health (in a number, not %) that could be called when targets change or something? The code I have is:



    if UnitCanAttack("player","target") and UnitChangeHealth("target") then local targetHealth = UnitChangeHealth("target")

    if targetHealth < 800000 then FrblChkHlth = true else FrblChkHlth = false end

    end


    if FrblChkHlth then CastSpellByName("Fireball") end

    Edited once, last by Champ ().

  • https://runesofmagic.fandom.com/wiki/API:UnitHealth



    Code
    1. if UnitCanAttack("player","target") and UnitHealth("target") < 800000 then CastSpellByName("Fireball") end

    I tried that, but for some reason when targeting a monster, it changes to percentage instead of actual health values. I used SendChatMessage("Health is " .. UnitHealth("target"),"SAY") to check. I'm not sure why it changes to percentages when targeting things other than yourself, but it seems to. By doing the same with UnitChangeHealth it shows exact health of the enemy.

  • Ok, so after further testing and changing the chat messages to chat window instead of the say channel (chat window limits the amount of messages to every 2 seconds), it seems that it changes faster when you target other mobs. It just updates every 2 seconds on the same mob. If you change mobs 3 times in a second, you will get the health of all 3 mobs, but if you keep the same mob targeted, it only updates every 2 seconds. I believe my misunderstanding of the function was the problem.

  • small explaination around your topic:


    UnitHealth shows the health of npcs always as % value and the health of players and player pets (f.e. warden pets) with real hp values.

    UnitChangeHealth shows max hp * % value as hp value and not as %


    for an enemy with f.e. 1.000.000.000 maxhp will show the following values:

    real current hp UnitHealth UnitChangeHealth
    900.000.000 90% 900.000.000
    900.000.001 91% 910.000.000
    910.000.000 91% 910.000.000
    910.000.001 92% 920.000.000


    you won't get the real hp


    so if you wanna do you check on current bosses, you won't ever reach a value <800k because the lowest most of them will show is like 6kk hp

  • Thank you for that explanation, it helps for future topics. In this instance, I was mainly just wanting the total HP of the monster to determine if a skill should be cast before combat, so the UnitChangeHealth function seems to do it. Thank you all for the assistance with this.


    After further testing of UnitChangeHealth, I have decided that function is too buggy for the purpose I had intended it for. Weird things happen with it if used too much. Not sure if this is because it isn't a standard LUA function, or not. I guess I will have to abandon this idea, as I see no other way to get the real HP instead of a %.

    Edited once, last by Champ ().

  • Hi guys, can i know good rotation to do with ch/rogue for take high aggro for keep dps under me ? i already have hatred IX and VIII on main hand and dagger. i also understand how can i add this in kitty. anyone can answer me pls and training me pls ?ty

    Ainz  Champ


    and in kitty if there are many condition to do.

    Edited 2 times, last by Ragdoll ().