Can someone tell me why it’s not working?
I wanted to create a homing projectile that sleeps a player when it hits him, but for some reason sometimes ball chases wrong player but sleeps the correct one or sleeps primary target and some random player.
Please help
Code: J6MRH
Host Player.BallTarget = Slot Of(Player Closest To Reticle(Host Player, All Teams));
…
Chase Player Variable At Rate(Host Player, BallPos, Position Of(Players In Slot(Host Player.BallTarget, All Teams)) + Vector(0, 1, 0), 10, Destination and Rate);
…
Set Status(Players In Slot(Host Player.BallTarget, All Teams), Null, Asleep, 7.500);
Here is a reason for the issue I guess… Can you see it?
1 Like
Not really, everything u wrote is exactly like in the script 
try to find something I marked by “bold” text style.
But i want this to target a player regardless of his team
Correct, that is why I ignored the first action but second and third actions cannot be “all teams” because the target is already defined. Possible it is better to store Event player instead of Slot of(…).
Can you just post working code? I would be very grateful
If I give you all working … then how you would learn from it? I have pointed you to something you should think of and try to change something. Find a solution yourself or possible someone else wants to post the working code…
I would learn from working code like i always do, just post working code cuz i really need it
I actually had the same problem with this one too, and you see it depends on what “player” you are targeting. If you’re targeting the “closest player to”:event player or the “Player closest to reticle” then most likely these happenings will occur. I think there is one work around with this, and it’s very simple. Use a variable. So let’s say you want to sleep “Player 1” as the homing projectile hits it, in order for that it to be completely synchronized, you can set a player variable to be TRUE on the designated player (Let’s call it variable A) and then you can make the projectile target the player that has the variable A TRUE and then after it hits you can then add the “set status:sleep” rule to the player that has the variable A TRUE, after the sleep effect set the player variable A on the victim FALSE so that the player can be slept and hit with the projectile again. Just tell me if you can’t understand what I mean and I will say it in simpler words!
Thank you so much for explaining but for me this is too complicated, (if u want u can add a code for this script, but only if u really want to do it) anyway u explained more than the other guy
Instead of setting the BallTarget variable to a slot (players in team1 and team2 have the same slots; there are always 2 players with slot 3 e.g.: one in team1, one in team2) you could set the variable directly to the target player:
set player variable(host player, BallTarget, player closest to reticle(host player, all teams))
Then, instead of inserting the slot etc., you directly insert the variable. Replace this: “Players In Slot(Host Player.BallTarget, All Teams)” with this:
player variable(host player, BallTarget)
1 Like
You should thank Rany too, as he found the bug.
He never thanks me (looking at his prevision posts), even does not post if he successfully used it in his code. And not only him for real… a lot of player know just to ask…
Thank you too Rany, and yes i used your code from my previous post in the game and it works perfect, i liked your answer by clicking the heart and for me that means i am grateful
1 Like