Code:if(inrange(Target:toLocal(Stalker:pos()), vec(-20,-40,0),vec(20,0,0)) { # Stalker is behind the target if(inrange(Target:toLocal(Stalker:angles():yaw()), -30,30)) { # Stalker is more or less facing the target } }
So, I am designing an E2 that is meant to creep people out, And so far, I have been able to make it so that, If you turn around it goes/stops but I have not been able to figure out how to make a function execute when the target is behind the entity.
I figured it had something to do with:
Because I made holo's at those two locations to see where the range was looking but the code didn't execute.Code:if(!inrange(Target:pos,Stalker:forward()*-250,Stalker:forward*-1) { ////Moarcodehere }
Also, As far as I can see, That would only work if the target was within a certain distance behind the entity "Stalker"...
So, Has anyone got any suggestions as to what I should do?
Any help is appreciated, Thanks.
Code:if(inrange(Target:toLocal(Stalker:pos()), vec(-20,-40,0),vec(20,0,0)) { # Stalker is behind the target if(inrange(Target:toLocal(Stalker:angles():yaw()), -30,30)) { # Stalker is more or less facing the target } }
Last edited by Colonel Thirty Two; 08-22-2010 at 12:12 PM. Reason: Fix'd
I think you forgot :yaw()
.siht daer ot gniyrt emit detsaw ev'uoY
Okay, what you did to check if 'Target' was facing in the direction of the 'Stalker' was better than my way for checking...
Buuuutttttt...
seems to return whether the 'Target' is within a certain distance on the X & Y axis, not whether the 'Target' is behind the 'Stalker'.Code:if(inrange(Target:toLocal(Stalker:pos()), vec(-20,-40,0),vec(20,40,0)) { }
Thanks for the other code though.![]()
Last edited by TalkingGoose; 08-22-2010 at 11:50 AM.
Whoops, check updated code.
Still seems to only be true when you are in a range, and is still sometimes true when you are in front of it.
Would it help if I posted my code? :P
Bookmarks