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

Wednesday, May 2nd 2012, 1:24am

Targeting macro

Hi I'm trying to make a macro to target specific unit.

So far I got /run TargetSpecific("insert unit name") but this does not work

I'm new in making macro and stuff please help.

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

2

Wednesday, May 2nd 2012, 1:48am

There is no function called TargetSpecific. For a list of known functions (not all of them documented unfortunately) see this RoMWiki page.

For a tutorial on creating macros, try this one (shameless self-plug).

Now as for your particular question, as far as I know there isn't a way to just target a specific named PC/NPC/Mob. But that doesn't mean it can't be done at all.

Basically, the idea is to target a mob, see if it is the creature you actually want and if not, select a new target. We can't do this continuously or the game would freeze up while it tries to find your target, so we'll limit it to 10 tries.

Source code

1
2
/run for i=1,10 do TargetNearestEnemy() if UnitName("target")=="[I][B]Mob Name Here[/B][/I]" then break end end
/run if UnitName("target")~="[I][B]Mob Name Here[/B][/I]" then TargetUnit("") end

Change the Mob Name Here part to the appropriate creature name.

The above should work for mobs and other enemies (that is, stuff you can normally TAB-target). To target friendly units and NPCs, change TargetNearestEnemy() to TargetNearestFriend().
2013... The year from hell....

3

Wednesday, May 2nd 2012, 3:09am

Thank you very much. I got the idea from the iceblade thread so I assumed its applicable. To target 2 units, would I repeat the first line?

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

4

Wednesday, May 2nd 2012, 3:25am

You can't really target two different things, though you can put a target as your focus (up to 12 units).

To put a target into your focus list use:

Source code

1
/run FocusUnit([I][B]pos[/B][/I], "target")

where pos is a number from 1 to 12 (note that if you remove a unit from your focus list, later positions will drop down one position slot)

To set your target to one of the focus slots use:

Source code

1
/run TargetUnit("focus[I][B]#[/B][/I]")

where # is the slot number to use.

To clear your current target, use:

Source code

1
/run TargetUnit("")


To clear a focus slot use:

Source code

1
/run FocusUnit([I][B]pos[/B][/I], "")

again, pos is the slot number (1 to 12) you want to clear, and again later slots will drop down one position.
2013... The year from hell....