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.

karmakarma

Master Procrastinator

  • "karmakarma" started this thread

Posts: 442

Location: Miami

Occupation: Diesel Mechanic (semi-trucks/tractor-trailers)

  • Send private message

1

Wednesday, March 13th 2013, 8:18pm

need help with an in-game macro

im trying to come up with an IN-GAME macro to target enemies and npcs by their Unit Id. so far i have tried the following..

/script TargetUnit()

/script TargetUnitId()

/script TargetUnitById()

/script FindNearestNameOrId()


so far i havent had any luck and im hoping someone on the forums might be able to help me, thank you in advance to all that attempt to help.

i of course put the id number in the () but not sure what function i should be trying to call on
LifeFire - Eternal - Grimdal
Mage/Priest/Knight
82/82/82

Give a macro, Take a Macro
Lifefire's Collections

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

2

Thursday, March 14th 2013, 3:13am

You can't target by unit ID, or at least I've never seen a means to do it and I have previously looked for a way.

The main problem is that though you can retrieve the GUID of a unit (mob or npc), there is nothing to set your target based on this ID.
2013... The year from hell....

karmakarma

Master Procrastinator

  • "karmakarma" started this thread

Posts: 442

Location: Miami

Occupation: Diesel Mechanic (semi-trucks/tractor-trailers)

  • Send private message

3

Thursday, March 14th 2013, 11:35am

That sucks very much. Guess ill try something else then. Thank you for taking the time to answer my post
LifeFire - Eternal - Grimdal
Mage/Priest/Knight
82/82/82

Give a macro, Take a Macro
Lifefire's Collections

4

Thursday, March 14th 2013, 1:49pm

you can target by something's specific name...peryl made a schweet little addon for it a while back (that i shamefully butchered into the anti-fandreith targeting addon for siege :o)

5

Thursday, March 14th 2013, 5:46pm

The only thing you can do with the INGAME macro system is to use a macro to target the nearest enemy (or friend). You can also do a check to see if the Enemy that is selected is a Player or a Mob:

This one just targets the nearest enemy. Doesn't check to see if it's a player or a mob, just the closest thing you can kill:

Source code

1
2
/run for i=1,10 do TargetNearestEnemy(IsShiftKeyDown()) if not UnitMaster("target") then break end end
/cast Flame


This one checks to make sure the selected enemy is a Player - if it's a Mob or a players pet, it'll clear the target:

Source code

1
2
3
/run for i=1,10 do TargetNearestEnemy(IsShiftKeyDown()) if UnitIsPlayer("target") then break end end
/run if not UnitIsPlayer("target") then TargetUnit("") end
/cast Silence


There's more you can do with TargetNearestEnemy/TargetNearestFriend().. Perhaps if you explained a little bit about what you're trying to accomplish, someone can help with a more detailed macro.

karmakarma

Master Procrastinator

  • "karmakarma" started this thread

Posts: 442

Location: Miami

Occupation: Diesel Mechanic (semi-trucks/tractor-trailers)

  • Send private message

6

Thursday, March 14th 2013, 8:01pm

its pretty much going to be an "all-around" targeting macro, because i would change the id number for the targets to suit whatever i needed at each time, for example if i wanted to target a specific guard in siege first without wasting the time to click on him, my macro would be ... target guard leader, cast flame, cast fireball,... that way i wouldnt have to deal with the other 2 knocking me down when all 3 rush at once, it would also serve a purpose in andor training range to make killing those tiny turtles easier since "tab" and targetnearest enemy and frined dont work there, instead i would make that macro,... useextraaction(1), targetid(turtles number),.. it would pretty much target anything that i have the guid for, whether it can be clicked on or tabbed to regularly or not.


i know i can target the guard leader by using his name but it doesnt work with npcs/mobs that cant be highlighted when clicked. thats what im trying to work around.

the possibilities are endless with a "target by id" macro, if it can be made of course
LifeFire - Eternal - Grimdal
Mage/Priest/Knight
82/82/82

Give a macro, Take a Macro
Lifefire's Collections

7

Thursday, March 14th 2013, 9:03pm

As far as I know, there's nothing in the API that assigns a specific ID to a particular mob type.. The UnitGUID is a unique identifier, and every mob will have a different one.

I ran this though 10 different mobs of the same name, for instance:

/script ChatFrame1:AddMessage(UnitGUID("target"))

And all 10 came back with 10 different IDs (although they were sequential).

If there's an API function that returns a generic ID for a particular monster type, then it should be pretty easy to write a macro for it (using Peryl's wonderful "target by name" macro as a baseline), but I know of no such ID..

8

Thursday, March 14th 2013, 9:10pm

Ok, a bit more testing.. Apparently the UnitGUID is NOT completely random, instead it represents a specific spawn point.

IE., a monster at a specific spawn point may have a UnitGUID of "2938", and if you kill it when it respawns that one will also have the same UnitGUID of "2938".

So I would (assume/presume) that each guard in Siege would follow the same logic, with each one having it's own unique identifier, meaning you would need like 18 different macros just to target the 18 different guards by UnitGUID.

If there's a different, more generic ID that represents a specific Mob Type, this would be a lot easier. lol :)

karmakarma

Master Procrastinator

  • "karmakarma" started this thread

Posts: 442

Location: Miami

Occupation: Diesel Mechanic (semi-trucks/tractor-trailers)

  • Send private message

9

Thursday, March 14th 2013, 9:32pm

yes there is, each mob of the same name also has the same specific object id, like gear does and items do, for example kate weskers specific id that will never change is 121035, doesnt matter where they put her in the world, think of the id number as a name and not as a spawn point, if i were to use the macro to get the object id from many different "Floating Balloon Monster" in siege, the id number would be the same exact number every time because they all share the exact same name. another example is your character object id number, no matter how many times you log in and out your id number will always remain the same, mine is 1,xxx,xxx... while yours may be 3xx,xxx.. its basically like a phone number of sorts, that way other quests, and events can call on that specific number when needed.

edit: made a mistake, in the first post, its the OBJECT ID, not the unit id
LifeFire - Eternal - Grimdal
Mage/Priest/Knight
82/82/82

Give a macro, Take a Macro
Lifefire's Collections

karmakarma

Master Procrastinator

  • "karmakarma" started this thread

Posts: 442

Location: Miami

Occupation: Diesel Mechanic (semi-trucks/tractor-trailers)

  • Send private message

10

Thursday, March 14th 2013, 9:45pm

Quoted from "Southern;592823"

Ok, a bit more testing.. Apparently the UnitGUID is NOT completely random, instead it represents a specific spawn point.

IE., a monster at a specific spawn point may have a UnitGUID of "2938", and if you kill it when it respawns that one will also have the same UnitGUID of "2938".

So I would (assume/presume) that each guard in Siege would follow the same logic, with each one having it's own unique identifier, meaning you would need like 18 different macros just to target the 18 different guards by UnitGUID.

If there's a different, more generic ID that represents a specific Mob Type, this would be a lot easier. lol :)


also even if they all had different id's based on spawn points that many macros would not be needed, if the macro had enough room to condense them it could look something like this...

/script TargetGUID(xxxx, xxxx, xxxx, xxxx, xxxx)
/cast Flame
/wait 3
/cast Fireball

that way if the first couple numbers are not present it would jump to the next available number and target that first
LifeFire - Eternal - Grimdal
Mage/Priest/Knight
82/82/82

Give a macro, Take a Macro
Lifefire's Collections

11

Thursday, March 14th 2013, 9:52pm

the function to target still relies on the tab targeting limitations...if called by name the tower guard leader will be the only one in range so will be the only one targeted..any mobs with identical names will just be scrolled through by distance. and player names being unique, at least calling friendlies would be easy. pulling uniqueID off all mobs around you using only ingame macros without any custom functions would be a bit interesting to see.

there was an addon that basically filled an array of all targets and gave them their own identifiers but it was either canned or abandoned a chapter or 2 ago.

karmakarma

Master Procrastinator

  • "karmakarma" started this thread

Posts: 442

Location: Miami

Occupation: Diesel Mechanic (semi-trucks/tractor-trailers)

  • Send private message

12

Thursday, March 14th 2013, 10:40pm

thats entirely possible, i cant give up just yet though, im sure eventually i will find exactly the right macro to do what i need, its just going to take time
LifeFire - Eternal - Grimdal
Mage/Priest/Knight
82/82/82

Give a macro, Take a Macro
Lifefire's Collections

13

Thursday, March 14th 2013, 10:52pm

Quoted from "karmakarma;592826"

for example kate weskers specific id that will never change is 121035,


Ok, progress. If you tell me the API command that you use to get the "121035" number, I can probably hack something together that would only target by that ID.

Are you sure Peryl's "Target By Name" macro wouldn't do the exact same thing that you're looking for, though?

Source code

1
2
3
/run for i=1,10 do TargetNearestEnemy() if UnitName("target")=="Floating Balloon Monster" then break end end
/run if UnitName("target")~="Floating Balloon Monster" then TargetUnit("") end
/cast Fireball

karmakarma

Master Procrastinator

  • "karmakarma" started this thread

Posts: 442

Location: Miami

Occupation: Diesel Mechanic (semi-trucks/tractor-trailers)

  • Send private message

14

Thursday, March 14th 2013, 11:32pm

yes it will find kate by her name, but it wouldnt be able to find the turtles or rabbits in andor, target by name only works for targeting objects and other things that have a tab function, correct? i cant remember the api coomand for objectid. but the main reason i want to solve this macro riddle is cuz it will be a huge time saver when it comes to needing to do any specific task
LifeFire - Eternal - Grimdal
Mage/Priest/Knight
82/82/82

Give a macro, Take a Macro
Lifefire's Collections

15

Thursday, March 14th 2013, 11:50pm

Quoted from "karmakarma;592838"

yes it will find kate by her name, but it wouldnt be able to find the turtles or rabbits in andor, target by name only works for targeting objects and other things that have a tab function, correct? i cant remember the api coomand for objectid. but the main reason i want to solve this macro riddle is cuz it will be a huge time saver when it comes to needing to do a specific task


OK, I see what you're saying.. In relation to the things like turtles in Andor Training Grounds, no - there's nothing in the API that will target things that are not tab-targetable.

karmakarma

Master Procrastinator

  • "karmakarma" started this thread

Posts: 442

Location: Miami

Occupation: Diesel Mechanic (semi-trucks/tractor-trailers)

  • Send private message

16

Thursday, March 14th 2013, 11:58pm

i believe the addon that paz refers to uses brute force methods to obtain the id number and since i have no idea what addon it is i cant look at the code it uses
LifeFire - Eternal - Grimdal
Mage/Priest/Knight
82/82/82

Give a macro, Take a Macro
Lifefire's Collections

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

17

Friday, March 15th 2013, 1:20am

Now that I'm back from work, let me butt in again.

Since you hadn't specified what you wanted the ID targeting for, I just assumed a general case. But since you want to do a kind of TAB targeting but only actually target based on a GUID, then that is in fact possible.

Basically you would want to modify the "target by name" or "target only players" macro to "target by GUID" instead. Something like this should do the trick:

Source code

1
2
/run foundIt=false for i=1,10 do TargetNearestEnemy(IsShiftKeyDown()) if UnitExists("target") and UnitGUID("target") == [I]IDToLookFor[/I] then foundIt=true break end end
/run if not foundIt then TargetUnit("") end

Replace the IDToLookFor with the GUID you want to look for.

A slight variation on this code could allow you to define an array of GUIDs to look for and allow targeting any of them. The only problem would be getting the list into the game since macros are only run via user interaction. Though you might want to check my macro guide since it does cover some of this aspect as well.

Anyway, you would define the list like this (much like the silence list in DIYCE):

Source code

1
2
3
4
5
ListOfGUIDS = {
    [I]ID1[/I] = true,
    [I]ID2[/I] = true,
    [I]ID3[/I] = true,
}

where the IDx are the GUIDs themselves.

Then the macro would become:

Source code

1
2
/run foundIt=false for i=1,10 do TargetNearestEnemy(IsShiftKeyDown()) if UnitExists("target") and ListOfGUIDS[UnitGUID('target')] then  foundIt=true break end end
/run if not foundIt then TargetUnit("") end


The cute thing with this is if you wanted to temporarily remove an ID from being targeted, you could simply set the entry to false instead of true and the entry would then be ignored. More GUIDs could be added to the list and the macro wouldn't need to change.

Edit:
For the stuff that isn't actually TAB targetable, you might try TargetUnit("mouseover"). This'll target whatever the mouse is currently hovering over. Would of course require you to move the mouse over the mob, but at least it is one method.

Edit 2:
Forgot to mention. You would want to do the mouseover trick with the UnitGUID() thing so you could modify the macro like so:

Source code

1
2
3
/run foundIt=false if UnitExists("mouseover") and ListOfGUIDS[UnitGUID('mouseover')] then TargetUnit("mouseover") foundIt=true end
/run if not foundIt then for i=1,10 do TargetNearestEnemy(IsShiftKeyDown()) if  UnitExists("target") and ListOfGUIDS[UnitGUID('target')] then   foundIt=true break end end end
/run if not foundIt then TargetUnit("") end
2013... The year from hell....

karmakarma

Master Procrastinator

  • "karmakarma" started this thread

Posts: 442

Location: Miami

Occupation: Diesel Mechanic (semi-trucks/tractor-trailers)

  • Send private message

18

Friday, March 15th 2013, 2:56am

you sir are a macro master, i bow to you
LifeFire - Eternal - Grimdal
Mage/Priest/Knight
82/82/82

Give a macro, Take a Macro
Lifefire's Collections