How to detect if a hit was critical?
How to detect if a hit was critical?
Since i am knight/rogue, i got myself a nice attack "Smash", which is only usable aftera critical attack.
does anybody know of a way to make this happen with the bot?
Botje
sorry, posted in wrong section, could a mod please move this?
does anybody know of a way to make this happen with the bot?
Botje
sorry, posted in wrong section, could a mod please move this?
Re: How to detect if a hit was critical?
Have a look for a buff next time you see the skill is usable, my guess is there will be one.
Remember no matter you do in life to always have a little fun while you are at it 
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
Re: How to detect if a hit was critical?
I'm optimizing the use of skills for my char/bot at the moment, so I came across this old thread.
So I had the same idea I can tell you their is no buff on player or target side.
I could read the battle log but that is really a dirty solution. Has anyone a better idea?
So I had the same idea I can tell you their is no buff on player or target side.
Code: Select all
player:update()
for k,v in pairs(player.Buffs) do print(v.Id, v.Name) end
local target = player:getTarget();
if(target)then
print("target");
target:update()
for k,v in pairs(target.Buffs) do print(v.Id, v.Name) end
end
Jack-of-all-trades, but master-of-only of a few
My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226
My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226
Re: How to detect if a hit was critical?
Maybe use GetActionUsuable? I don't know if it's usable for this case but you can try it.
http://runesofmagic.gamepedia.com/API:GetActionUsable
http://runesofmagic.gamepedia.com/API:GetActionUsable
- Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
- I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
- How to: copy and paste in micromacro
________________________
Quote:- “They say hard work never hurt anybody, but I figure, why take the chance.”
- Ronald Reagan
Re: How to detect if a hit was critical?
costs 7% HP, wouldn't want to use it to often lol
lvl 20 elite, I might be able to lvl up a 20/20 char to check it out, if I get time.
There is more than likely something in memory that says if it's usable or not.
lvl 20 elite, I might be able to lvl up a 20/20 char to check it out, if I get time.
There is more than likely something in memory that says if it's usable or not.
Remember no matter you do in life to always have a little fun while you are at it 
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
Re: How to detect if a hit was critical?
I tried to dig a little deeper.
I had the idea what if the buff has no name ?
I checked it out in true the bot can't read a buff without name.
First I changed a small line of code(in updateBuffs() the read them all in and then I found:
The player has always the buff with the number of 508709 and sometimes the target has a buff with the number 500666.
Next I changed getBuff so that it works also with numbers which has no name.
I can tell adding 500666 as requirement for the the skill doesn't bring anything(possible wrong)
I don't know what 508709 means perhaps that the char is alive or not swimming. I would love to read the counters to dig a little deeper but the counters a read by phrasing the text of the buff.(possible counters works as a flag).
I had the idea what if the buff has no name ?
I checked it out in true the bot can't read a buff without name.
First I changed a small line of code(in updateBuffs() the read them all in and then I found:
The player has always the buff with the number of 508709 and sometimes the target has a buff with the number 500666.
Next I changed getBuff so that it works also with numbers which has no name.
I can tell adding 500666 as requirement for the the skill doesn't bring anything(possible wrong)
I don't know what 508709 means perhaps that the char is alive or not swimming. I would love to read the counters to dig a little deeper but the counters a read by phrasing the text of the buff.(possible counters works as a flag).
Jack-of-all-trades, but master-of-only of a few
My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226
My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226
Re: How to detect if a hit was critical?
For check this in Bot code maybe like this
Code: Select all
<onLoad>
G_Crit_Smash = false;
EventMonitorStart("CombatChecker", "COMBATMETER_DAMAGE");
function CombatChecker()
local time, moreToCome, _source, _type = EventMonitorCheck("CombatChecker", "1,5")
if time ~= nil then
if _source == player.Name and _type == "CRITIAL" then
G_Crit_Smash = true
else
G_Crit_Smash = false
end
end
end;
</onLoad>
"COMBATMETER_DAMAGE" event is fired every time the player or a partymember takes damage or causes damage.
This event doesn't use arg1, arg2, etc. It uses pre-defined global variables. These variables are as follows:
_source
The name of the source of the damage, usually the name of the player dealing it.
_target
The name of the target for the damage.
Example: "Cow Beetle"
_damage
The amount of damage done.
Example: 69
_skill
The name of the skill that was used to cause the damage. If it's just an auto-attack, this variable will have the value "ATTACK"
Example: "Fireball"
_type
The type of damage done.
Example: "NORMAL"
Re: How to detect if a hit was critical?
I can't get that event to print any messages, does it actually work for you ?
Remember no matter you do in life to always have a little fun while you are at it 
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
Re: How to detect if a hit was critical?
Ok got it worked out, thanks to rock.
anytime your hp changes or something elses hp changes because of you or party, or some other reason.
The in game globals change.
_source, _target, _damage, _skill, _type
Keep in mind it is only the very last change and you can't get previous changes, so the code you want might work in an addon but would be unrealistic inside bot.
anytime your hp changes or something elses hp changes because of you or party, or some other reason.
The in game globals change.
_source, _target, _damage, _skill, _type
Code: Select all
Command> local ll = RoMScript("_type") print(ll)
CRITIAL
Remember no matter you do in life to always have a little fun while you are at it 
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
Re: How to detect if a hit was critical?
Give this a test run.
it is in the folder
runes of magic/interface/addons/ingamefunction/
then you will need a little code in your profile.
Basically I have added in a variable as part of the game which is true or false for when you do a critical hit, it "should" reset to false 3 seconds after the last critical.
Tested and works fine.
runes of magic/interface/addons/ingamefunction/
then you will need a little code in your profile.
Code: Select all
<onPreSkillCast><![CDATA[
if arg1.Name == "KNIGHT_SMASH" and RoMScript("criticalevent") == false then
return false
end
]]> </onPreSkillCast>
Tested and works fine.
Remember no matter you do in life to always have a little fun while you are at it 
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
Re: How to detect if a hit was critical?
Should that be onPreSkillCast?
- Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
- I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
- How to: copy and paste in micromacro
________________________
Quote:- “They say hard work never hurt anybody, but I figure, why take the chance.”
- Ronald Reagan
Re: How to detect if a hit was critical?
Probably, my memory is bad and it's been a while since I played with skill stuffrock5 wrote:Should that be onPreSkillCast?
--=== Added ===--
Tested and edited in the working code.
Remember no matter you do in life to always have a little fun while you are at it 
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual