Page 1 of 2

Cant get my knight so use punishment

Posted: Thu Nov 11, 2010 5:34 pm
by Jengoso
Testing knight class but I cant seem to get him to use punishment. Basically I would like him to use 2 holy strikes (I find that 2 is usually enough combined with disarm and punishment to finish a mob of at these levels), 2 disarm and then punishment. Here is the script I use:

<skill name="KNIGHT_HOLY_STRIKE" modifier="" hotkey="VK_3" priority="90" maxuse="2" />
<skill name="KNIGHT_PUNISHMENT" modifier="" hotkey="VK_2" priority="100" />
<skill name="KNIGHT_DISARMAMENT" modifier="" hotkey="VK_4" priority="70" />
<skill name="KNIGHT_HOLY_SHIELD" modifier="" hotkey="VK_7" priority="60" inbattle="true" hpper="15" />
<skill name="KNIGHT_HOLY_SEAL" modifier="" hotkey="VK_5" priority="80" />

Too me this would mean that he should use 2 holys, 2 disarms and then punishmen or holy, punishment, disarm. But obviously not, he uses 1 holy, 1 disarm, 1 holy, 1 disarm and then just keep using disarm and no punishment. Any ideas?

Re: Cant get my knight so use punishment

Posted: Thu Nov 11, 2010 6:42 pm
by jduartedj
Jengoso wrote:Testing knight class but I cant seem to get him to use punishment. Basically I would like him to use 2 holy strikes (I find that 2 is usually enough combined with disarm and punishment to finish a mob of at these levels), 2 disarm and then punishment. Here is the script I use:

<skill name="KNIGHT_HOLY_STRIKE" modifier="" hotkey="VK_3" priority="90" maxuse="2" />
<skill name="KNIGHT_PUNISHMENT" modifier="" hotkey="VK_2" priority="100" />
<skill name="KNIGHT_DISARMAMENT" modifier="" hotkey="VK_4" priority="70" />
<skill name="KNIGHT_HOLY_SHIELD" modifier="" hotkey="VK_7" priority="60" inbattle="true" hpper="15" />
<skill name="KNIGHT_HOLY_SEAL" modifier="" hotkey="VK_5" priority="80" />

Too me this would mean that he should use 2 holys, 2 disarms and then punishmen or holy, punishment, disarm. But obviously not, he uses 1 holy, 1 disarm, 1 holy, 1 disarm and then just keep using disarm and no punishment. Any ideas?

Why don't you use the "required buff" options instead? I think It would make much more sense!

Code: Select all

reqbufftype="debuff" reqbuffcount="2" reqbufftarget="target" reqbuffname="buff's name"

Re: Cant get my knight so use punishment

Posted: Thu Nov 11, 2010 6:56 pm
by rock5
This post may be of help.
http://www.solarstrike.net/phpBB3/viewt ... =21&t=1758

Basically it goes through the list of skills 1 at a time. If you use maxuse of 2 then it will cast it the second time round but then no more. If you want to cast 2 skills in a row try adding this to your <onSkillCast> section.

Code: Select all

if arg1.Name == "KNIGHT_HOLY_STRIKE" then
    target=player:getTarget()()
    target:updateBuffs()
    local n = 2 -- The number of debuffs you want
    for i = (n-1), target.Debuffs["Light Seal"), -1 do -- Is that the right debuff name?
        player:cast("KNIGHT_HOLY_STRIKE");
    end
elseif arg1.Name == "KNIGHT_DISARMAMENT" then
    target=player:getTarget()()
    target:updateBuffs()
    local n = 2 -- The number of debuffs you want
    for i = (n-1), target.Debuffs["Disarmament"), -1 do
        player:cast("KNIGHT_DISARMAMENT");
    end
end
Then adjust the priorities of your skills so they cast in the right order.

See how that works.

Re: Cant get my knight so use punishment

Posted: Fri Nov 12, 2010 5:52 am
by Sumdumguy
On a totally unrelated topic:

Punishment is absolutely useless at later levels when your weapon does more damage, as punishment is not based on weapon damage and it does not generate aggro.

Re: Cant get my knight so use punishment

Posted: Sat Oct 27, 2012 4:30 pm
by Cindy
<onSkillCast><![CDATA[
-- Additional Lua code to execute when casting a skill
-- Note: arg1 contains the skill being used.

-- Knight Holy strike doubler
if arg1.Name == "KNIGHT_HOLY_STRIKE" then
target=player:getTarget()()
target:updateBuffs()
local n = 3 -- The number of debuffs you want
for i = (n-1), target.Debuffs["Light Seal"), -1 do -- Is that the right debuff name?
-- player:cast("KNIGHT_HOLY_STRIKE");
end
--elseif arg1.Name == "KNIGHT_DISARMAMENT" then
-- target=player:getTarget()()
-- target:updateBuffs()
-- local n = 4 -- The number of debuffs you want
-- for i = (n-1), target.Debuffs["Disarmament"), -1 do
-- player:cast("KNIGHT_DISARMAMENT");
-- end
end
]]></onSkillCast>

Results in
"Failed to compile and run Lua code for OnSkillCast in character profile".

As you can see I did some debugging.... when I uncommented the for loop, the code died. Any ideas?

Re: Cant get my knight so use punishment

Posted: Sat Oct 27, 2012 9:06 pm
by lisa
My guess your issue is here

Code: Select all

 target.Debuffs["Light Seal")
notice the [ and )

Re: Cant get my knight so use punishment

Posted: Sun Oct 28, 2012 5:18 pm
by Cindy
yes.

code is from a rock5 post, and neither [] nor () appears to work....

Re: Cant get my knight so use punishment

Posted: Sun Oct 28, 2012 6:54 pm
by lisa
Cindy wrote:yes.

code is from a rock5 post, and neither [] nor () appears to work....
could you be more specific?

saying it doesn't appear to work isn't exactly telling me what is happening.

--=== Added ===--

OMG Rock did put the [ ) [ ) twice in the code he posted, so I'm not the only one to post "broken" code after all lmao

--=== Added something usefull ===--
you have this

Code: Select all

target=player:getTarget()()
it will cause an error saying failing to compile.

I suspect you want something like this
have knight holy strike as autouse = false in your profile, then add this

Code: Select all

<onSkillCast><![CDATA[
   local target = player:getTarget()
   if target:hasDebuff("Light Seal (3)") then
      player:cast("KNIGHT_HOLY_STRIKE");
   end
]]></onSkillCast>
Mind you I thought the light seals were good for mana return, ohh well.

I guess you could do both if you wanted, have mana return autouse = false in profile aswell.

Code: Select all

<onSkillCast><![CDATA[
   local target = player:getTarget()
   if target:hasDebuff("Light Seal (3)") then
      if 400 > player.MP then -- could do a % thing here
            player:cast("KNIGHT_MANA_RETURN");
      else
            player:cast("KNIGHT_HOLY_STRIKE");
      end
   end
]]></onSkillCast>

Re: Cant get my knight so use punishment

Posted: Sun Oct 28, 2012 9:25 pm
by rock5
I think an important issue, too, is that there is no target.Debuff. I think there might have been once but that was a long time ago. But even if you use "target.Buffs" you can't access them any more like this target.Buffs["Light Seal"] because the Buffs table isn't structured like that anymore. So that post you got that code from must have been pretty old :)

Re: Cant get my knight so use punishment

Posted: Sun Oct 28, 2012 10:34 pm
by lisa
rock5 wrote:I think an important issue, too, is that there is no target.Debuff. I think there might have been once but that was a long time ago. But even if you use "target.Buffs" you can't access them any more like this target.Buffs["Light Seal"] because the Buffs table isn't structured like that anymore. So that post you got that code from must have been pretty old :)
Thu Nov 11, 2010 5:56 pm

Hmmm just a little old there.

Re: Cant get my knight so use punishment

Posted: Sun Oct 28, 2012 11:08 pm
by Cindy
Yes, perhaps we need an "obsolete" marker :)


Yes, I was trying to get my knight to stack attacks and whatnot properly. Eventually I'd like to be able to bot some instance boss fights:) I have dreams of bots doing Hos colors boss. My preliminary thinking is that I'd have to just quickly teleport to each crystal and activate right click, since I am not sure if the bot can figure out which crystal is which color and head to the correct one.

Also I want to figure out champion battling, and that is very heavily dependent on right buffs with the right preconditions and right actions.

This 'botting game' is a lot more fun than the actual game ;)

Re: Cant get my knight so use punishment

Posted: Mon Oct 29, 2012 12:25 am
by rock5
Looks like you are still after code that reproduces the original code. Try this

Code: Select all

if arg1.Name == "KNIGHT_HOLY_STRIKE" then
	local target=player:getTarget()
	local n = 3 -- The number of debuffs you want
	local buff=target:getBuff("Light Seal")
	if buff then n = n - buff.Count
	for i = 1, n do
		player:cast("KNIGHT_HOLY_STRIKE");
	end
elseif arg1.Name == "KNIGHT_DISARMAMENT" then
	local target=player:getTarget()
	local n = 4 -- The number of debuffs you want
	local buff=target:getBuff("Disarmament")
	if buff then n = n - buff.Count
	for i = 1, n do
		player:cast("KNIGHT_DISARMAMENT");
	end
end

Re: Cant get my knight so use punishment

Posted: Mon Oct 29, 2012 4:22 am
by botje
how would this code work then?

Code: Select all

local targetPawn = CPawn(player.TargetPtr);
		 if( arg1.Name == "KNIGHT_MANA_ABSORPTION" ) then
			 if( targetPawn ~= nill and targetPawn ~= 0 and targetPawn ~= player.Address ) then
				local bool, count = targetPawn:hasDebuff("Holy Seals (3)");
				if( bool == true ) then
					return true;
				else
					return false;
				end
			 else
				return true;
			 end
		 else
			 return true;
		 end

Re: Cant get my knight so use punishment

Posted: Mon Oct 29, 2012 4:43 am
by lisa
targetPawn ~= nill
don't think nill would work
local bool, count = targetPawn:hasDebuff("Holy Seals (3)");
you don't use the count so don't need it in there

Code: Select all

if targetPawn:hasDebuff("Holy Seals (3)") then
        return true;
else
        return false;
end
would be enough.
targetPawn ~= player.Address
Not sure you would need this check as it shouldn't try to use the skill on yourself and you wouldn't have the required buff anyway.

It "should" work though ;)

Re: Cant get my knight so use punishment

Posted: Mon Oct 29, 2012 7:32 am
by rock5
Can it even use that skill when the entry in the database doesn't even have an id?

Re: Cant get my knight so use punishment

Posted: Tue Oct 30, 2012 2:16 pm
by scithen
This might be a silly answer, but couldn't you set the cast priority to false and do something like this?

Code: Select all

<skill name="KNIGHT_HOLY_STRIKE" modifier="" hotkey="VK_3" priority="90" />
<skill name="KNIGHT_HOLY_STRIKE" modifier="" hotkey="VK_3" priority="90" />
<skill name="KNIGHT_DISARMAMENT" modifier="" hotkey="VK_4" priority="70" />
<skill name="KNIGHT_DISARMAMENT" modifier="" hotkey="VK_4" priority="70" />
<skill name="KNIGHT_PUNISHMENT" modifier="" hotkey="VK_2" priority="100" />
<skill name="KNIGHT_HOLY_SHIELD" modifier="" hotkey="VK_7" priority="60" inbattle="true" hpper="15" />
<skill name="KNIGHT_HOLY_SEAL" modifier="" hotkey="VK_5" priority="80" />
Since priority to false means it'll cast sequentially instead.

Re: Cant get my knight so use punishment

Posted: Tue Oct 30, 2012 10:33 pm
by rock5
If PRIORITY_CASTING is false or it doesn't exist (because it defaults to false) then it will cast sequentially. Let me clarify, though, it's sequentially by the priority numbers. So it wont cast in the order listed above but like this.

Code: Select all

<skill name="KNIGHT_PUNISHMENT" modifier="" hotkey="VK_2" priority="100" />
<skill name="KNIGHT_HOLY_STRIKE" modifier="" hotkey="VK_3" priority="90" />
<skill name="KNIGHT_HOLY_STRIKE" modifier="" hotkey="VK_3" priority="90" />
<skill name="KNIGHT_HOLY_SEAL" modifier="" hotkey="VK_5" priority="80" />
<skill name="KNIGHT_DISARMAMENT" modifier="" hotkey="VK_4" priority="70" />
<skill name="KNIGHT_DISARMAMENT" modifier="" hotkey="VK_4" priority="70" />
<skill name="KNIGHT_HOLY_SHIELD" modifier="" hotkey="VK_7" priority="60" inbattle="true" hpper="15" />
Just so you understand, if PRIORITY_CASTING is enabled then it always casts the highest priority skill first so it might never get to the later skills in the list (excluding friendly skills which are always checked).

Re: Cant get my knight so use punishment

Posted: Wed Oct 31, 2012 10:20 pm
by scithen
Well that explains a few things I've noticed in my own profiles.. thanks for clearing that up for me.

Re: Cant get my knight so use punishment

Posted: Fri Nov 02, 2012 4:27 am
by botje
rock5 wrote:Looks like you are still after code that reproduces the original code. Try this

Code: Select all

if arg1.Name == "KNIGHT_HOLY_STRIKE" then
	local target=player:getTarget()
	local n = 3 -- The number of debuffs you want
	local buff=target:getBuff("Light Seal")
	if buff then n = n - buff.Count
	for i = 1, n do
		player:cast("KNIGHT_HOLY_STRIKE");
	end
elseif arg1.Name == "KNIGHT_DISARMAMENT" then
	local target=player:getTarget()
	local n = 4 -- The number of debuffs you want
	local buff=target:getBuff("Disarmament")
	if buff then n = n - buff.Count
	for i = 1, n do
		player:cast("KNIGHT_DISARMAMENT");
	end
end
this fails to compile and run :(

Re: Cant get my knight so use punishment

Posted: Fri Nov 02, 2012 4:39 am
by lisa
make this

Code: Select all

if buff then n = n - buff.Count
into this

Code: Select all

if buff then n = n - buff.Count end
Make sure you get both of them.