Log in

View Full Version : Help with NPC



cool13bro
02-26-2012, 05:44 PM
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
02-26-2012, 06:03 PM
I guess you could do something like

Repeat
Wait(100)
Until FindObjCustom

cool13bro
02-26-2012, 08:30 PM
Alright, do you think there would be any other function that would be more appropriate for the situation?

Sin
02-26-2012, 08:52 PM
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
02-26-2012, 09:08 PM
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
02-26-2012, 10:33 PM
if IsMoving then
Sps walk;

cool13bro
02-26-2012, 10:41 PM
hmm, tried that code but...

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

Ashaman88
02-26-2012, 10:43 PM
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
02-26-2012, 10:46 PM
Meh, not sure I understand that. Lol, it's fine a little bit of experimenting never hurt anyone. :)

EtherFreak
02-27-2012, 05:05 AM
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
02-27-2012, 08:22 AM
Use more colors.

xtrapsp
02-27-2012, 11:40 PM
Try posting some of your script, maybe we can look at it and explain it a bit better mate

cool13bro
03-03-2012, 04:15 AM
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.