SRL Archive - Help

Help with NPC


cool13bro

2012-02-26 12:44:00

As I was scripting a simple fighting bot, I am having trouble solving a problem. The fact is that the monster to be fought spawns once at a time.. and the FindObjCustom function seems to run once and end as soon as the specific color is not found. Obviously this is a problem as it takes some time for the monster to respawn. Is there anyway around this problem?

Yes, as you may have guessed I am a noob to all this scripting, but hey I'm making an attempt. Thanks :)

Ashaman88

2012-02-26 13:03:54

I guess you could do something like

Repeat
Wait(100)
Until FindObjCustom

cool13bro

2012-02-26 15:30:00

Alright, do you think there would be any other function that would be more appropriate for the situation?

Sin

2012-02-26 15:52:15

From: ashaman88
I guess you could do something like

Repeat
Wait(100)
Until FindObjCustom



Add a timeout.

procedure Eh
var
T,X,Y:integer
begin
MarkTime(t);
repeat
wait(100);
if TimeFromMark(t) > 'your number here' then
break
until(FindObjCustom);


end;

cool13bro

2012-02-26 16:08:18

lol Sin, nice procedure name, and that seemed to really work.. wow, thanks.
Another question, how could I ensure my player never leaves his safe spot (it is a range script)?

Any help is appreciated.

Sin

2012-02-26 17:33:33

 if IsMoving then
Sps walk;

cool13bro

2012-02-26 17:41:24

hmm, tried that code but…

[Error] (58:5): Unknown identifier 'Sps' at line 57

Ashaman88

2012-02-26 17:43:37

From: cool13bro
hmm, tried that code but…

[Error] (58:5): Unknown identifier 'Sps' at line 57


He means you need an sps path back to your spot… at least I think that's what he was saying

cool13bro

2012-02-26 17:46:33

Meh, not sure I understand that. Lol, it's fine a little bit of experimenting never hurt anyone. :)

EtherFreak

2012-02-27 00:05:39

you could do it through the minimap as well
MarkTime(t);
repeat
wait(100);
if TimeFromMark(t) > 'your number here' then
break
until CountDots('yellow')>SomeValue

where countdots counts the dots in the minimap.

smurg

2012-02-27 03:22:10

Use more colors.

xtrapsp

2012-02-27 18:40:11

Try posting some of your script, maybe we can look at it and explain it a bit better mate

cool13bro

2012-03-02 23:15:02

Hey guys,

Thanks for all your input, eventually (with the help of the SPS walking guide) I figured how to keep my player from straying away.