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.

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

621

Wednesday, May 9th 2012, 6:50pm

Quoted from "bilalab;529586"

lol ur response time is awesome on this thread ;).

Merely coincidental. I was at the computer, refreshed the forum page and saw a new post. It isn't like I'm just sitting here waiting for questions ;)

Quoted from "bilalab;529586"

I'm just learning the various functions and just wanted to confirm the functions actually do what I think they do. UnitIsPlayer seems to target only players, but since you guys modified the targetting system globally using UnitIsPlayer I thought it might actually do something extra too :)

UnitIsPlayer doesn't target anything. All it does is return a boolean (true or false) value to indicate if the specified unit is in fact a player controlled character or if it is an NPC/Mob (i.e. controlled by the game). The parameter given to it is a string representing the type of unit. Some valid values are "player", "target", "pet", "targettarget", "raid1", "focus1", etc. You can mix and match as in the "targettarget" value. For example, if you want the unit targeted by your pet's target, you can use "pettargettarget" etc.

These same unit types can also be used with other "unit" functions such as TargetUnit(). In the case of TargetUnit(), giving an empty string for the unit type will clear your current target.

So the code change I posted effectively does the following:

  • Do the following ten times:

    • Get a new target via TargetNearestEnemy(). This is effectively the same as pressing the TAB key.
    • Check if the target is a player, if so exit the loop immediately.


  • Verify that the current target is indeed a player. If not, clear the target via TargetUnit().
2013... The year from hell....

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

622

Wednesday, May 9th 2012, 6:53pm

Quoted from "blitzclub06;529603"

So I guess my main question is, can I incorporate both targeting mobs and players only into my diyce or do I have to actually set up a macro for the player target only? This is the code that I have written into my diyce and when I wrote it in the diyce would no longer target mobs.

Yes you can, though you will likely require to pass a parameter to KillSequence() in order to differentiate the modes. Something like this was posted somewhere in this thread using the "pve" and "pvp" parameters (though it might have been in a private message. Can't really remember).
2013... The year from hell....

623

Wednesday, May 9th 2012, 8:04pm

Quoted from "Peryl;529613"

Something like this was posted somewhere in this thread using the "pve" and "pvp" parameters (though it might have been in a private message. Can't really remember).


It was most likely done in private messages because I have looked through this thread from front to back and can not find anything on the pve/pvp parameters at all. I didnt think it would be this hard to to write a code to not select pets. Boy was I wrong
Reni ~ HolySaints~ ßouncyßallzz -70w/70wd/67s ~ Playing w/wd before the warrior trend started. Bigballzz 61p/50k/40s only because p/s owns all in SW.

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

624

Wednesday, May 9th 2012, 9:13pm

Quoted from "blitzclub06;529627"

It was most likely done in private messages because I have looked through this thread from front to back and can not find anything on the pve/pvp parameters at all. I didnt think it would be this hard to to write a code to not select pets. Boy was I wrong

It isn't the code that is actually hard, it's the integration with everything else that can be problematic.

I don't have the PM anymore (I delete old ones or my inbox would be packed by now), but I think I found the code still hanging around my computer. The following was for a modified version of DIYCE, can't find the original post of this version, but look at the version of customfunctions.lua posted by myfree090 here. That one seems to have the "pvp"/"pve" mode flag (though I think the case is different on that one).

Anyway, the relevant code to select players was:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
    --Select Next Enemy
    if (tDead) then
        TargetUnit("")
        return
    end
    
    if mode == "PvP" then
        if (not LockedOn) or (not enemy) then
            for i=1,10 do
                TargetNearestEnemy()
                if UnitIsPlayer("target") then
                    break
                end    
            end
        end
    else
        if mainClass == "RANGER" and (not party) then --To keep scouts from pulling mobs without meaning to.
            if (not LockedOn) or (not enemy) then
                TargetNearestEnemy()
                return
            end
        elseif mainClass ~= "RANGER" then --Let all other classes auto target.
            if (not LockedOn) or (not enemy) then
                TargetNearestEnemy()
                return
            end
        end
    end


Since that version of KillSequence takes two parameters, one for the debugging output and the second is the mode, you would use it like this:

Normal, PvE mode:

Source code

1
/run KillSequence("","PvE")


For PvP mode:

Source code

1
/run KillSequence("","PvP")


Note that you do end up with two different macros for this. You might be able to detect if you are in Siege based on the current map/zone ID for auto-detecting PvP mode for siege wars, but other than that I can't think of another way to detect PvP situations.
2013... The year from hell....

625

Thursday, May 10th 2012, 12:11am

Thank you in advance Peryl I will incorporate this code tonight when I get home, it sucks being at work and not being able to do anything but edit the codes. I hope this will work, as we have seige tonite and I hate the players who run around with 3 pets and I hit my diyce button and target the pets. Wish me luck tonite. Let ya know tomorrow whether or not it worked
Reni ~ HolySaints~ ßouncyßallzz -70w/70wd/67s ~ Playing w/wd before the warrior trend started. Bigballzz 61p/50k/40s only because p/s owns all in SW.

626

Thursday, May 10th 2012, 7:46pm

well it didn't work and i ended up breaking my diyce trying to fix it. I dont know what i did wrong but adding that lower section to my diyce and then the killsequence for pve and pvp brought up errors saying that it was a nil value so i dont know. Maybe im just trying to do something that shouldnt be done.
Reni ~ HolySaints~ ßouncyßallzz -70w/70wd/67s ~ Playing w/wd before the warrior trend started. Bigballzz 61p/50k/40s only because p/s owns all in SW.

627

Friday, May 11th 2012, 12:44pm

i cant get this one to work for me not sure if im doing something wrong




function wwr()
local Skill = {}
local i = 0
local rage = UnitMana("player")
local energy = UnitSkill("player")
local friendly = (not UnitCanAttack("player", "target"))
local tbuffs = BuffList("target")


i=i+1; Skill = { name = "Enraged", use = (rage <= 15) }
i=i+1; Skill[i] = { name = "Slash", use = ((not friendly) and (rage >= 25) and (not string.find(tbuffs, "Bleed"))) }
i=i+1; Skill[i] = { name = "Tactical Attack", use = ((not friendly) and (rage >= 15) and string.find(tbuffs, "Bleed")) }
i=i+1; Skill[i] = { name = "Probing Attack", use = ((not friendly) and (rage >= 20)) }
i=i+1; Skill[i] = { name = "Splitting Chop", use = ((not friendly) and (rage >= 15) and string.find(tbuffs, "Vulnerable")) }
i=i+1; Skill[i] = { name = "Open Flank", use = ((not friendly) and (rage >= 10) and string.find(tbuffs, "Vulnerable")) }
i=i+1; Skill[i] = { name = "Shadow Stab", use = ((not friendly) and (Energy >= 20)) }
i=i+1; Skill[i] = { name = "Attack", use = (not friendly) }

MyCombat(Skill,arg1)
end

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

628

Saturday, May 12th 2012, 5:48am

That's code for the older DIYCE 1.4. DIYCE 2.0 and its variants have quite a few changes that will not make your code work without modification. For example all the string.find calls are no longer needed since tbuffs is now a table, not a long string. There are more changes as well.
2013... The year from hell....

629

Thursday, May 17th 2012, 8:51pm

First of all I do not know much about lua, but I have little unusual question. Is there a way to make autotarget in DIYCE not targeting certain mobs, by their IDs of names? Same as not targeting pets at sieges, but with normal mobs (not all of them). I've tried something like UnitMaster("focus1"), but it doesn't work. Actually I need to blacklist one mob only.

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

630

Friday, May 18th 2012, 5:19am

You can get the name of your current target with UnitName("target"). This will work for any mob/target, but as you only want to make sure you don't target a specific mob, this will work (note that if you use the name of a generic mob, then all mobs of with that name will be rejected).

To ensure you never target this mob, you would add the following immediately after every call to TargetNearestEnemy.

Source code

1
2
3
4
5
6
7
8
9
    for j = 1,10 do
        if UnitName("target") ~= "Specific Name of Mob Here" then
            break
        end
        TargetNearestEnemy()
    end
    if UnitName("target") == "Specific Name of Mob Here" then
        TargetUnit("")
    end

What this then does is checks if your current target is the mob in question, if it isn't, it will skip this mob, otherwise it selects another target and checks again. It does this up to 10 times, if after this it still has that mob as a target, it clears the target for you.

The above will work for a single mob name. If you want to be able to have multiple mobs, then we can do something like the spell silence list. First you would create a list of all the mobs you want to not be targeted like this:

Source code

1
2
3
4
5
local NoTargetList = {
    ['Mob Name 1'] = true,
    ['Mob Name 2'] = true,
        -- Add more names to this list as needed following above format.
    }


Now we can modify the code above to this:

Source code

1
2
3
4
5
6
7
8
9
    for j = 1,10 do
        if not NoTargetList[UnitName('target')] then
            break
        end
        TargetNearestEnemy()
    end
    if NoTargetList[UnitName('target')] then
        TargetUnit("")
    end
2013... The year from hell....

631

Friday, May 18th 2012, 3:19pm

Well I have changet it a bit. Orginal version was not working anyway....

Source code

1
2
3
4
5
6
7
8
9
10
11
12
if tDead then
        TargetUnit("")
        return
    end
        TargetNearestEnemy()
         if UnitName("target") ~= "XXX" then
            break
        end
    end
     if UnitName("target") == "XXX" then
        TargetUnit("")
    end


The part with skipping target works great, but when I enter a group of mobs, than it keeps changing targets and not attacking. With one mob in range works like it should, same (what is obvious as it is not attacking any mobs in groups) with multiple "XXX" targets.

632

Saturday, May 19th 2012, 2:53am

I'm trying to get wound attack to work with my blind spot bleed (id:620297) and my low blow bleed (id:620314) or a r/s low blow bleed (id:500704). Currently I have this but it never casts wound attack even when I use blind spot and low blow manually first. Any help?

Source code

1
{ name = "Wound Attack", use = (EnergyBar1 >= 35) and ((tbuffs['620297']) and (tbuffs['620314'])  or (tbuffs['620297']) and (tbuffs['500704'])) },

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

633

Saturday, May 19th 2012, 6:07am

Quoted from "schrutefarms;531331"

I'm trying to get wound attack to work with my blind spot bleed (id:620297) and my low blow bleed (id:620314) or a r/s low blow bleed (id:500704). Currently I have this but it never casts wound attack even when I use blind spot and low blow manually first. Any help?

Source code

1
{ name = "Wound Attack", use = (EnergyBar1 >= 35) and ((tbuffs['620297']) and (tbuffs['620314'])  or (tbuffs['620297']) and (tbuffs['500704'])) },


I suspect a problem with the logic here, likely caused by the mix of and and or statements. See my guide to using Lua's logic operators for more details then you care to know about how this stuff works (pay attention to the sections on mixing multiple logic operators and also the section on simulating the conditional operator).
2013... The year from hell....

634

Saturday, May 19th 2012, 6:22pm

Quoted from "Peryl;531349"

I suspect a problem with the logic here, likely caused by the mix of and and or statements. See my guide to using Lua's logic operators for more details then you care to know about how this stuff works (pay attention to the sections on mixing multiple logic operators and also the section on simulating the conditional operator).


Thanks for the help Peryl, but I have no idea what any of that means.

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

635

Sunday, May 20th 2012, 6:20am

Quoted from "schrutefarms;531413"

Thanks for the help Peryl, but I have no idea what any of that means.

Sigh... I'm guessing you didn't bother actually reading the guide.

Anyway, your problem basically boils down to an incorrectly formed logic line. What you stated you wanted was to have Wound Attack cast when Blind Spot and either Low Blow or Rogue Bleed is on the target.

That last sentence is a better description from which to do for your logic line. This would make the logic become:

Source code

1
{ name = "Wound Attack", use = (EnergyBar1 >= 35) and tbuffs['620297'] and (tbuffs['620314'] or tbuffs['500704']) },
2013... The year from hell....

636

Sunday, May 20th 2012, 9:19am

Quoted from "Peryl;531540"

Sigh... I'm guessing you didn't bother actually reading the guide.

Anyway, your problem basically boils down to an incorrectly formed logic line. What you stated you wanted was to have Wound Attack cast when Blind Spot and either Low Blow or Rogue Bleed is on the target.

That last sentence is a better description from which to do for your logic line. This would make the logic become:

Source code

1
{ name = "Wound Attack", use = (EnergyBar1 >= 35) and tbuffs['620297'] and (tbuffs['620314'] or tbuffs['500704']) },


Actually, I did read the guide over and over, but I am a dullard so I did not understand it. I used the line you wrote and it still doesn't work. I also double checked the bleed ID's and those are correct. I even tried to make it as simple as this and it did not work. Any idea why?

Source code

1
{ name = "Wound Attack", use = (EnergyBar1 >= 35) and (tbuffs['500704']) },

637

Sunday, May 20th 2012, 11:38am

because you should write it like this without ""

Source code

1
{ name = "Wound Attack", use = (EnergyBar1 >= 35) and (tbuffs[500704]) },

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

638

Sunday, May 20th 2012, 11:39am

Quoted from "schrutefarms;531561"

Actually, I did read the guide over and over, but I am a dullard so I did not understand it.

Then if there are things you need clarification on, please tell me and I'll try to update the guide.


Quoted from "schrutefarms;531561"

I used the line you wrote and it still doesn't work. I also double checked the bleed ID's and those are correct. I even tried to make it as simple as this and it did not work. Any idea why?

Yup, and I should of notice earlier too. That's what happens when you try to help when your tired. Ah well...

Anyway, the problem is that you have the skill IDs as strings, you need them as numbers. That is, remove the double quotes around the buff IDs like this (using your last test line):

Source code

1
{ name = "Wound Attack", use = (EnergyBar1 >= 35) and (tbuffs[500704]) },

Change the code I previously posted and you should be good to go.

Edit: Hovoom beat me to the answer, hehe...
2013... The year from hell....

639

Monday, May 21st 2012, 5:20am

Works fine now. Thanks for the help.

640

Wednesday, May 23rd 2012, 9:02am

Quoted from "Peryl;529613"

Yes you can, though you will likely require to pass a parameter to KillSequence() in order to differentiate the modes. Something like this was posted somewhere in this thread using the "pve" and "pvp" parameters (though it might have been in a private message. Can't really remember).


http://forum.us.runesofmagic.com/showthr…ll=1#post515437