I need a function that checks if the player is looking at a trigger. Like the UseTriggerRequireLookAt() which works for using a trigger, but I need a function that returns bool, or anything I can work with. I was thinking of may trying to work with getting angles and checking positions of the trigger and player, but I am not sure that will work or that I am capable of that kind of math, lol. I was trying to use:
Code Snippet
Plaintext
player isLookingAt(trigger);
but it keeps returning 0, even when I was looking and even using the trigger. Any help with a function that works like that one sounds like it should, or what I may be doing wrong?
looking(){ trigradius = getent("testradius", "targetname); trigstruct = getentt("teststruct", "targetname); trigstruct.name = "struct"; trigradius.name = "trigger radius"; players = get_players(); while(1){ for(i=0;i<players.size;i++){ if(players[i] islookingat(trigradius) || players[i] islookingat(trigradius)){ // this is an or statement. iprintlnbold("I see you " + self.name); }else{ iprintln("No line of sight " + self.name); } } wait(1); } }
dont overthink things. this will check if your looking at the struct or the radius
LOL! Boy if I had a nickel for every time I heard that. I don't know if I am not explaining myself well enough or what. It probably looks like I am over thinking things because I have tried everything simpler than what I posted already. So now I am running every test I can imagine to try and get any response out of this function:
Code Snippet
Plaintext
player islookingat(trigger);
I tried your code and it never says "I see you " and the name. Is it working for you? Do I have some other problem? I assume that this function doesn't do what it sounds like. I may need something else to tell me when a player is looking at a specific entity.
Thank you to everyone who was trying to help. My problem was not the script it self. It had nothing to do with the script, I was just testing with that script. The problem is the isLookingAt() function. I gave up on that function and made my own:
yes after a few attempts at that function, it seems to be broken
Guaranteed! I would really like to see this function. When it started returning true when my reticle turned red, aimed at the zombies, my head exploded, . May be useful in the future, but wasn't what I was going for. There goes about 5 hours of my life, lol.