Solved Spawn armor stand right in front of player

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

PatoFrango

Active Member
Jul 12, 2017
240
14
18
Hi,

How would I spawn an armor stand right in front of the player? Using "spawn armor stand in front of player" gives me this result

upload_2019-7-23_21-19-46.png


but it's too far away for what I wanna do. Any ideas on how to shorten the distance?
 
I think you can specify how close/far away it is by adding "(number) blocks" in between "armor stand" and "in front of"
 
I think you can specify how close/far away it is by adding "(number) blocks" in between "armor stand" and "in front of"
I tried doing
Code:
set {_loc} to location 0.5 blocks between player and location in front of player
and it said "Can't understand this expression"
[doublepost=1563971681,1563927918][/doublepost]bump
 
I tried doing
Code:
set {_loc} to location 0.5 blocks between player and location in front of player
and it said "Can't understand this expression"
[doublepost=1563971681,1563927918][/doublepost]bump
Try "spawn armor stand 0.5 blocks in front of player"
 
i believe you can add 0.5 to your x or z coordinate (current player's location)

Code:
set {_loc} to y-coordinate of player + 10
send "%{_loc}%"

ZuJj.png
What...?
The player won't be exactly facing north or south. What if the player is facing the axis diagonally? That would only work if the player was looking straight at certain directions. But no. They can be looking at any direction.
 
...
Code:
if player is facing is west:
    # do your thing
Haha. As I said, thats only for CERTAIN directions. What if the player is looking south west or even between southwest and west? I want the armor stand to be placed wherever the player is looking doing a 360 angle, not have only 4 options.
 
from what i can see in that picture it is already spawning at your direction (?) what exactly is your issue + current code
Yeah, because I used the "location in front of player" expression.
Code:
set {_loc} to location in front of player
spawn armor stand at {_loc}
What I wanna do is have it placing closer to the player. Still in front of them, but closer.
 
well you could modify {_loc}'s x/z axis and remove like 0.5 i don't know, have a look at my older post because i edited it in case you haven't seen it
I know the general "idea" of it, I just don't know exactly how to do it. That's why I'm asking for help. Thank you anyway.
About the forcing idea: I don't want to force anything, I really just want it to spawn closer in front of the player wherever they're facing.
 
Code:
remove 1 from x-coordinate of {_loc} # this is an example (NOT TESTED BUT SHOULD WORK)
Dude... I know I can remove coordinate values of locations. But explain to me how that will work with any location the player's facing. I know you said it's "just an example", but I want the actual EXPRESSION that generalizes it for every location. Sometimes programming isn't that straightforward.
 
i don't get what you mean... i tested and it works flawless, elaborate please?
also i have been programming for a long time i know its not straight forward but i gave you everything also this isn't programming this is scripting or whatever it's called
Skript is a programming language so we're programming lol. Anyway, I really don't know how to explain it any better than this, I'm sorry. Thanks for your help anyway.
 
skript is definitely not a programming language...
you need to elaborate on what you need boss, else i cant help
Let's try with pictures.

upload_2019-7-24_23-24-36.png


This is what happens when I try to spawn it "in front of the player" This is what I want to achieve:

upload_2019-7-24_23-24-53.png


It's CLOSER! WOAH!
 

Attachments

  • upload_2019-7-24_23-17-42.png
    upload_2019-7-24_23-17-42.png
    27 KB · Views: 270
  • upload_2019-7-24_23-18-34.png
    upload_2019-7-24_23-18-34.png
    26.2 KB · Views: 293
https://forums.skunity.com/threads/direction-based-on-players-direction.4057/#post-13296
Code:
if player's yaw is greater than 22.5:
    if player's yaw is less than 67.5:
        remove 0.5 from x-coordinate of {_loc} # an example

final answer has been given that's an example so you should be able to do the others (yeah at least 4 checks)
Oh my god... dude, just forget it. ChocoAura got what I meant, but I've tried to tell you that it's impossible to manually check EVERY possible direction the player's facing. A player's yaw doesnt have only 2, 3 or 4 values. It has many of them. And I want the armor stand to be placed EXACTLY towards where the player is facing, so much probably there wouldn't even be any checks. But seriously though, just move on from this post. I've thanked you for your help and time and I truly do, but right now I just need to find an answer as quickly as possible and get other things that I'm doing done.
 
you really need to develop your logic while programming... i gave you straight answer spoonfeed paste ready code but sure i will move on from this post. see you around.
Your answer is still far away from what I asked. You even admitted that you didn't know what I was asking for, so you don't need to get all triggered just cause your answer isn't actually being helpful. I was polite and I thanked you many times for your time, and I only asked you to move on because you really weren't getting what I meant. It's no use to keep trying as I've said I can't explain it any better. I'm not calling you stupid or anything close, I'm just saving you time as I've seen you're also answering other user's questions.
As for the "developing my logic while programming", you really don't know me. You can go check the times that I've answered people's questions and then come back telling me the response wasn't logic. I've actually "spoon-fed" people code and I don't mind doing it as long as they understand how it was done and learn something from it.

Anyway, I'm still open for answers everybody. Any ideas? At all?
 
Use vectors (look at the Skript docs to see how)
 
Use vectors (look at the Skript docs to see how)
Thank you for your answer. I’ve thought of that and I’ve tried many different things but I can’t seem to manage to get HALF of the distance from two points (for example) and then set a new location to that point. I could use the vector length expression, but then again how would I actually set the location... Agh.
 
Thank you for your answer. I’ve thought of that and I’ve tried many different things but I can’t seem to manage to get HALF of the distance from two points (for example) and then set a new location to that point. I could use the vector length expression, but then again how would I actually set the location... Agh.
Use the vector length (divide it by 2)
 
Thank you for your answer. I’ve thought of that and I’ve tried many different things but I can’t seem to manage to get HALF of the distance from two points (for example) and then set a new location to that point. I could use the vector length expression, but then again how would I actually set the location... Agh.
Code:
location 0.1 in front of player
 
Status
Not open for further replies.