SRL Archive - OSR Help

Detecting If Player Is In Combat


ekips88

2013-04-15 17:51:40

I am looking for a method that can accurately detect if the character is currently fighting. The player is located in a highly populated area where many other fights occur at the same time. Also, the inventory tab must stay open at all times.

If anyone is aware of a detection method please let me know.

Thanks


Edit: This is for EOC not 07

Enslaved

2013-04-15 18:12:35

have you tried pixelshift for the your character, this would work as your player will always visually dominate the square you are on, so set the confines of the pixelshift detection to that area

Kevin

2013-04-15 18:29:28

Is this EOC or 07?

ekips88

2013-04-15 18:50:36

From: kevin
is this eoc or 07?


eoc

Kevin

2013-04-15 18:55:53

EOC is pretty easy. You have several methods that are all valid.
InFight;//Returns true if in a fight, located in {$i SRL/SRL/Skill/Fighting.Simba} 
or you can check the combat tab if your target has a health bar by counting the color green in that slot (that's what I do).
or you can check the combat tab for a target name (lasts slightly longer than the fight occasionally)
if(pos('Target',GetTextAtExWrap(595, 220, 660, 230, 0, 50, 10, 3111603, 10, 'UpChars')) = 0)then//'NoTarget' is shown when there is no target.

ekips88

2013-04-15 18:56:32

From: Enslaved
have you tried pixelshift for the your character, this would work as your player will always visually dominate the square you are on, so set the confines of the pixelshift detection to that area



The issue I'm finding is that often there are other players fighting in the same game square as me (or extremely close). This has thrown off every method I am familiar with (with that exception of the combat tab, but that is not an option).

To the extent of my knowledge, this would also cause problems when using pixleshift. Please let me know if I am wrong.

senrath

2013-04-15 19:01:34

Out of curiosity, why must the script always stay on the inventory tab?

ekips88

2013-04-15 19:02:20

From: Kevin
EOC is pretty easy. You have several methods that are all valid.
InFight;//Returns true if in a fight, located in {$i SRL/SRL/Skill/Fighting.Simba} 
or you can check the combat tab if your target has a health bar by counting the color green in that slot (that's what I do).
or you can check the combat tab for a target name (lasts slightly longer than the fight occasionally)
if(pos('Target',GetTextAtExWrap(595, 220, 660, 230, 0, 50, 10, 3111603, 10, 'UpChars')) = 0)then//'NoTarget' is shown when there is no target.



Due to the nature of the script using the combat tab is not an option. I will try the InFight function, however, I believe that one picks up mainscreen HP bars which would not be accurate in a densely populated combat zone. But, I am not fully familiar with the function so I may be wrong.

ekips88

2013-04-15 19:06:43

From: senrath
Out of curiosity, why must the script always stay on the inventory tab?



It does not have to be on the inventory at all times, just during combat. But, the script must frequently check if it is in combat and I feel it would not be entirely human-like to rapidly switch between tabs. While I doubt it would raise too many red flags, I plan to use this script with my near-maxed account and the less risk the better.

Rich

2013-04-15 19:07:07

Have you tried making the area for PixelShift so that it only focuses on your square? As your character will always be on top on your screen, limiting it to just the square your character is on should hopefully get things working.

Kevin

2013-04-15 19:08:30

Oops, sorry, I didn't take note of the inventory requirement.
If within a densely populated combat zone AND not allowing for a separate tab (why is that, btw?), then I would have to recommend a world hopper to remove combat density.

Edit: why is it necessary to view your inventory between each kill?

ekips88

2013-04-15 19:16:07

From: Kevin
Oops, sorry, I didn't take note of the inventory requirement.
If within a densely populated combat zone AND not allowing for a separate tab (why is that, btw?), then I would have to recommend a world hopper to remove combat density.

Edit: why is it necessary to view your inventory between each kill?



My mistake, meant to say during combat (switches between weapons during fight)

Kevin

2013-04-15 19:27:03

Doesn't switching weapons mid fight harm your ability to fight in EOC pretty hardcore? What exactly are you fighting that requires this, tormented demons?

ekips88

2013-04-15 19:31:26

From: Kevin
Doesn't switching weapons mid fight harm your ability to fight in EOC pretty hardcore? What exactly are you fighting that requires this, tormented demons?



Grotworms, but I didn't think of that. To tell you the truth, I've haven't played much recently so I'm still leaning how EOC works.

Kevin

2013-04-15 19:37:37

From: ekips88
Grotworms, but I didn't think of that. To tell you the truth, I've haven't played much recently so I'm still leaning how EOC works.


Oh, I have a grot bot myself :p
Just stick with one form of combat, they fall over easy to melee just fine, if you want faster tags then use ranged. You don't need to switch weapons ever for them, I promise. I use the color count I mention on them and it works fine.

ekips88

2013-04-15 19:40:08

From: Kevin
Oh, I have a grot bot myself :p
Just stick with one form of combat, they fall over easy to melee just fine, if you want faster tags then use ranged. You don't need to switch weapons ever for them, I promise. I use the color count I mention on them and it works fine.



Alright, thanks very much for the help

Kevin

2013-04-15 19:45:17

As a side note, there may be additional issues you don't quite see yet/speed up opportunities. If you run across them, feel free to PM me and I'll share what I've learned in respect to them.

Oh yeah and if someone else kills your target, while you get the drops, the green doesn't go away for a few seconds. Add a check for exp change to discover faster kills in those scenarios.

ekips88

2013-04-15 20:21:51

From: Kevin
As a side note, there may be additional issues you don't quite see yet/speed up opportunities. If you run across them, feel free to PM me and I'll share what I've learned in respect to them.

Oh yeah and if someone else kills your target, while you get the drops, the green doesn't go away for a few seconds. Add a check for exp change to discover faster kills in those scenarios.



Thanks again

t4q

2013-04-16 06:03:26

I've searched for health bars put these stay there little pit after fight and if adrenaline starts to drain you have to wait alot. This combat tab checking seems to be pretty good for me, thanks!