ID:145365
 
Code:
Removed Code //sry I dont need my code being ripped


Problem description:
Ok, theres my code for my monster, as you can see it is supposed to go through and if the person stands 2 tiles away from the monster its supposed to walk towards him. Well the problem is IT DOESNT. I figured out if I put "for(P in oview(2))" where the if P in oview statement is it will walk towards the person. But then the monster attacks, then moves random, then attacks, then moves random.

I need the monster to attack the guy only if hes in view by 2 and walk random only if hes not in view by 2. Any help would be appreciated.
if(oview(2,src))
P = locate() in oview(2)
if(P) step_towards(src,P)
else step_rand(src)


You need to find P somehow, or else it will just be null.
In response to DarkCampainger
DarkCampainger wrote:
> P = locate() in oview(2)
> if(P) step_towards(src,P)
> else step_rand(src)
>

You need to find P somehow, or else it will just be null.

Thanks for your help man.. it worked great, and now I actually understand what was wrong.
In response to X0Gohan0X
Don't remove your code, this could have helped someone else.

Besides, if you are THAT worried about people ripping your code, you shouldn't really be posting it on the boards.

It was quite a simple code anyway.
In response to Flame Sage
If its simple people should be able to code it themselves? dont you agree?

If they have the same problem as me i would be glad to share my code with them, but the idea of any, even the simpelist, of my coding being available for anyone to rip, I dont like.