You are not logged in.

Applications: [GameMaster: OPEN] | [Volunteer Testers: OPEN]


This forum will be permanently shut down on Friday 13.07.2018
Please copy or save all important information from old forum before they will be deactivated
We have moved to new board. https://forum.runesofmagic.gameforge.com/Come join us.

1

Sunday, March 4th 2012, 5:37pm

macro or addon question

Is there a way to check the damage received to see if it is physical or magical?

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

2

Sunday, March 4th 2012, 7:01pm

The only way I know of is to register a frame to receive the COMBATMETER_DAMAGE event. The event will tell you the source and target of the damage, the amount and type of damage as well as the skill used (see http://www.theromwiki.com/Event:COMBATMETER_DAMAGE for details).

Note that this event gets triggered when you or a party member does or receives damage, so you will need to verify the source and targets of the damage to figure out which is which.
2013... The year from hell....

3

Monday, March 5th 2012, 1:27am

So say...

If _source==Spriteling then 'Ignore' [not sure what to put in place of ignore] else "echo" [not sure here either... maybe echo, print, put, etc.] _type; end
If _type==Normal then usebagitem(117) else usebagitem(118); End

Where "usebagitem(117)" is Physical Immune Potion and "usebagitem(118)" is Magical Immune Potion.

Or maybe as a macro with frame...

/run if Global _source Spriteling=true then SPRITE_CHAT_FRAME:AddMessage("Your own damage was ignored") end
/run if not Global _source Spriteling=false and _type Normal=true then usebagitem(117) else usebagitem(118) end

Any thoughts? I know that isn't right.

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

4

Monday, March 5th 2012, 2:31am

First, this wouldn't work for a macro since it is an event. That is, the game will be calling a function you must define. Macros are only executed manually.

It would be good to know what you are attempting to actually do, but based on what you posted something like this might do the trick (nothing tested here):

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
-- Create a frame to receive events
local DamageEventFrame = CreateUIComponent("Frame", "DamageEventFrame", "UIParent")

-- Set the event handler
DamageEventFrame:SetScripts("OnEvent", [=[ DamageEventFrame.EventHandler(event) ]=])

-- Register for the event(s) we want
DamageEventFrame:RegisterEvent("COMBATMETER_DAMAGE")

-- The event handler function
function DamageEventFrame.EventHandler(event)
    if event == COMBATMETER_DAMAGE then
        if _source ~= "Spriteling" then
            DEFAULT_CHAT_FRAME:AddMessage("Damage type ".._type)
            if _type == "NORMAL" then
                UseItemByName("Physical Immune Potion")
            else
                UseItemByName("Magical Immune Potion")
            end
        end
    end
end

The above code needs to be in an add-on.


A Word of Warning!
The above code could be construed as a "bot" (or a variant thereof) and may therefore be forbidden since it would allow automatic use of immunity potions after receiving physical/magical damage. I present the above solely as a means of answering/clarifying the question and will not be held responsible if usage of the above results in any account bans.
2013... The year from hell....

5

Monday, March 5th 2012, 7:26am

That looks like what I wanted it to do. Will it run coninuously or just once? I want to be able to have it run when I activate it and stop when I turn it off. Can I add an on/off button for it?