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

Saturday, July 28th 2012, 6:15am

Need help with a Distance to TGT (sort of) addon

OK, I know that RoM disabled the Distance to Target bit of code a long time ago but I was wondering if it is possible to re-enable that like some people did with other bits. I am not looking for anything illeagal just curious about that part.

If not, than I think it would be possible using GetActionUsable. If there was a list of skills that had different ranges (it could be specific hotbar slots or manually filled in like DIYCE) it could display the approximate range once that skill lights up. For example, I have a skill that has a range of 250 a "250" would show up over the target's head (or something like that). Once the next skill lights up at 200 the same thing would happen. The catch is that the check needs to be on a timer so that the GetActionUsable check is automatic if the player has a target. It wouldn't be 100% precise but would give a good general distance.

I guess the basic idea would be something like

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
local LockedOn = UnitExists("target")
local updateTime = 0        -- How long since we last did an update
local updateIntervall = 0.5 -- How often do we update the frames

function Distance()
if LockedOn and (GetActionUsable(11) == true) then --melee distance skill
    [[insert tooltip showing distance code here]]
elseif
   if LockedOn and (GetActionUsable(12) == true) then -- next closest distance
    [[insert tooltip showing distance code here]] 
end

updateTime = updateTime + elapsedTime
    if updateTime >= updateIntervall and LockedOn then
      Distance()
   end


I know this is probably all wrong but that's the concept anyway.

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

2

Saturday, July 28th 2012, 12:56pm

Well the idea sounds workable, but you'll have trouble finding skills for some distances. For example, perusing the warrior skills on runesdatabase the longest ranged skill I saw was around 150 (Surprise Attack), one at 90 (Terror) and a few at 50 (Open Flank, Probing Attack and others). Specific class combos may have a few others distances, but only for those specific combos. Then of course, there's the problem of what level they get those skills at.

For the periodic updates, you'll need a frame to do it with. So may as well also intercept the PLAYER_TARGET_CHANGED event (I can't remember if it actually gets triggered or not, but worth a try) and so would be able to tell when the player targets something.
2013... The year from hell....

3

Tuesday, July 31st 2012, 5:12pm

Thanks Alt for posting this for me. Ideally what I want to happen is I target a player and when I target him, somewhere on the screen it tells me how far away he is. I would also like it to be dynamic. If I move towards or away from the target, the number changes.

This functionality may not be possible, which is why Alt has suggested using the skill distances in some manner to imitate the same thing.
Jacobmo 97Scout/97Warden/95Warrior/97Rogue/88D/85M
Allenmo 78S/77R/56P/1W/1K/1M - retired
Bteam all the way

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

4

Wednesday, August 1st 2012, 5:54pm

@mohjo
Doesn't alter the basics of what I mentioned though. His idea relies on checking if a skill on an action bar is usable. Therefore, you'd need both the action bar slots and list of skills to check in order to get the desired distances. Since not all classes have the same skill ranges, this could be problematic.

@Alterios
Though the function probably doesn't work, did you try using UnitDistance("target") to see if it returns an actual distance. I just can't remember if that was disabled as well (I know GetPlayerPosition() has).

Anyway, I do have a few other ideas but they require a fair bit of testing and investigation just to see if they would be viable, let alone getting them to work. If interested, PM me.
2013... The year from hell....

5

Wednesday, August 1st 2012, 6:02pm

Quoted from "Peryl;562082"

@mohjo
Doesn't alter the basics of what I mentioned though. His idea relies on checking if a skill on an action bar is usable. Therefore, you'd need both the action bar slots and list of skills to check in order to get the desired distances. Since not all classes have the same skill ranges, this could be problematic.

@Alterios
Though the function probably doesn't work, did you try using UnitDistance("target") to see if it returns an actual distance. I just can't remember if that was disabled as well (I know GetPlayerPosition() has).

Anyway, I do have a few other ideas but they require a fair bit of testing and investigation just to see if they would be viable, let alone getting them to work. If interested, PM me.


UnitDistance returns 0, regardless of any circumstances.