SRL Archive - OSR Help

Need help with fighting script


Sax

2012-11-14 07:14:52

Hi. Im currently making a fighting script and I want to know how can I know if the monster is dead so I can wait a bit and then click when he respawns. I have read the fighting includes but didn't get much of it. If anyone could post a code to do that I would appreciate. Thanks :D

IsoMorphic

2012-11-14 07:30:41

Think on this

(*
srl_InFight
~~~~~~~~~~~

.. code-block:: pascal

function srl_InFight: Boolean;

Checks whether player currently is in a fight, using mainscreen
HP bar presence detection. Returns True if Player's HP bar is detected.
Idea for improvement: Also check using PixelShift(); to see whether Player
is performing fighting animations to further improve the certainty of results.

.. note::

by Narcle

Example:

.. code-block:: pascal

while srl_InFight do
begin
CheckHP;
EatFood;
end;

*)

P1ng

2012-11-14 07:37:00

You're specifically looking at when a monster is dead?
Check out SRL_InFight and maybe use a while do loop.


While SRL_InFight do
begin
Wait(100);
CheckHP;
if HP < 20 then
Eat;
end;

Obviously some of those are just example procedure and don't exist, but you get my drift..

Also, if there is only 1 of that NPC that you are fighting you could try having a look at the minimap NPC dots, there's a function in the include for counting them IIRC.

Ian

2012-11-14 08:50:00

For me, SRL_Infight takes a few seconds to realize that it's in a fight, but seems to detect not being in a fight almost instantly, so you might want a slightly longer wait (unless you expect the monster to die in a few seconds anyway.)

Google

2012-11-14 11:05:15

SRL_InFight has always been inaccurate for me. Try this by putonnajonny is pretty accurate. http://villavu.com/forum/showthread.php?t=79633

Ian

2012-11-14 11:40:25

^this would fix everything :)

Sax

2012-11-14 12:21:43

Thanks :D