Using the Minecraft plugin language Skript, how can I find the dimension (ex. "nether") of a player? - plugins

I'm pretty new to coding MC plugins, and I am currently making one with Skript. I need to be able to find what dimension a player is currently in, for example the nether or overworld.
However, this kind of thing doesn't work as I would expect:
{dimOfPlayer} = dimension of player
send "Dim: %{dimOfPlayer}%" # I get an error: "Can't understand this condition or effect"
Is there any way to actually get the dimension and print it to chat, or test what it is? Thanks!

You can do this by checking what WORLD the player is for example if you create a normal world there should be these 3 worlds "world", "world_nether" and "world_the_end". I think So then you can check the dimension of player like this.
if player is in world "World name":
#Do stuff

Related

Roblox - creating a multistory maze

I am trying to create a multistory maze. I found it fairly easy to create the first level, then I realized I had no idea how to simply raise this first level up in order to create a second level beneath it.
Also, is there a way to 'fuse' all of these wall parts into one object and then raise this object up?
Edit: Much to my embarrassment, their is a way to fuse objects. The 'Union' tool is what I needed, but had no idea existed. I 'fused' (unioned) the various parts that made up my walls and joined them together into one big part. After that unioning, moving the entire maze upwards became quite easy.
I don't understand your problem but I think that you're making a 3D maze in roblox and you want the first level to go up and the second level to form below the level.
If the maze is NOT procedurally generated AND the maps are built by hand. Then you can make the script detect if the player won, and then raise the first level by either using tween or using loops (I'd recommend tween because loops and linear tweening does the same), and then make an effect that shows it forming (Transparency, parts coming back together, etc..).
I will show you the simplest example. But you can add whatever you want
local ts = game:GetService("TweenService")
local ti = TweenInfo.new(0.5, Enum.TweenStyle.Linear, Enum.TweenDirection.Out) --Customize it to your liking
local levels = game.LevelStorageParent.LevelFolderOrModelHere:GetChildren()
local pos = workspace.Level1.Position --Change (Not the levels because we are not cloning this)
local levelYRaise = 10 --Put any number or just get bounding box for full raise
ts:Create(workspace.Level1, ti, {Position = Vector3.new(pos.X, pos.Y+levelYRaise, pos.Z):Play()
local newLevel = levels.Level2:Clone()
newLevel.Parent = workspace
newLevel.Pos = workspace.Level1.Position - Vector3.new(0, workspace.Level1.Size.Y, 0)
newLevel.Transparency = 1
ts:Create(newLevel, ti, {Transparency = 0}):Play()
Change the code to your liking and your hierarchy names and parenting

what is the equivelant of get_global_pos from version 2.0 in 3.0?

I want to make a turret that is shooting lazers and i watched a tutorial on it. The person in the video used (scenename).position(get.node("Position2D").get_global_pos()) in order to spawn a projectile on the potition 2d. When i run this code, the game freezes and the debugger says "Invalid call. Nonexistant function 'get_global_pos' in base 2D". In the comments someone said that the tutorial is using 2.0 godot and that in 3.0 you dont use get_ and instead of pos you put potition, so i tried changing get_global_pos to global_position but it didnt work. i am very new to this and if you want any further information please let me know
As you already found out, global_position is the equivalent to get_global_pos.
The difference is, that global_position is no function but a member.
So instead of:
(scenename).position(get.node("Position2D").get_global_pos())
you have to write:
(scenename).position = get.node("Position2D").global_position

Editing Timeline from CCB file in cocos

I did some research into this and couldn't really find anything, so if this is a repetitive question I apologize. but anyway I have made a CCB file in CocosBuilder and I would like to start the timeline, for example, at one second instead of playing from the beginning. Is there a way to do this? Thanks for the help guys.
Edit: i would like this to be done in the code.
I am using 2.2.1 Cocos2DX version. I think there is no option to play it from given interval. But you can tweak yourself to get it done. (Not simple one)
You have to go to CCBAnimationManager and there you get "mNodeSequences".
It is dictionary and you get difference properties there like "rotation position etc..."
values there.
Internally AnimationManager reads this value (These values are specified in your CCB)
and puts in runAction queue.
So you have to break it as you want.(Ex. 5 min timeline you have. But you want to start
from 1 min then you have run first 1 min Actions without delay and for remaining you
have properly calculate tween intervals.
It's long procedure and needs calculation. If you don't know any other simpler way try this. If you know pls let us know (Post it).

Adding videos to Unity3d

We are developing a game about driving awareness.
The problem is we need to show videos to the user if he makes any mistakes after completing driving. For example, if he makes two mistakes we need to show two videos at the end of the game.
Can you help with this. I don't have any idea.
#solus already gave you an answer, regarding "how to play a (pre-registered) video from your application". However, from what I've understood, you are asking about saving (and visualize) a kind of replay for the "wrong" actions, performed by the player. This is not an easy task, and I don't think that you can receive an exaustive answer, but only some advices. I will try to give you my own ones.
First of all, you should "capture" the position of the player's car, in various time periods.
As an example, you could read player's car position every 0.2 seconds, and save it into a structure (example: a List).
Then, you would implement some logic to detect the "wrong" actions (crashes, speeding...They obviously depend on your game) and save a reference to the pair ["mistake", "relevant portion of the list containg car's positions for that event"].
Now, you have all what you need to recreate a replay of the action: that is, making the car "driving alone", by reading the previously saved positions (that will act as waypoints for generating the route).
Obviously, you also have to deal with the camera's position and rotation: just leave it attached to the car (as the normal "in-game" action), or modify it during time to catch the more interesting angulations, as the AAA racing games do (this will make the overall task more difficult, of course).
Unity will import a video as a MovieTexture. It will be converted to the native Theora/Vorbis (Ogg) format. (Use ffmpeg2theora if import fails.)
Simply apply it as you would any texture. You could use a plane or a flat cube. You should adjust its localScale to the aspect ratio of your video (movie.width/(float)movie.height).
Put the attached audioclip in an AudioSource. Then call movie.Play() and audio.Play().
You could also load the video from a local file path or the web (in the correct format).
var movie = new WWW(#"file://C:\videos\myvideo.ogv").movie;
...
if(movie.isReadyToPlay)
{
renderer.material.mainTexture = movie;
audio.clip = movie.audioClip;
movie.Play();
audio.clip.Play();
}
Use MovieTexture, but do not forget to install QuickTime, you need it to import movie clip (.mov file for example).

Gamecenter Matchmaking - How do I distinguish between player 1 and 2?

I am beginning to write a game using gamecenter matchmaking. Right now, two players can connect to each other, but I am having trouble figuring out how to distinguish between player 1 and 2. For example, I want player 1 to be able to move player 1 and player 2 to be able to move player 2.
The implementation would be specific to your app so it would be hard to answer more specifically, but basically each person's instance of the app could have an object that is "local player" and an object that is "opponent"... Both of them get to move the "local player" in their local instance, and changes to their "player" are obviously mapped to the "opponent" at the other end.
Just do a random number exchance to decide who will be player1 and make the first move.
Generate a random number and store it in a variable.
Send that generated random number to opponent.
Just like this, your opponent sends his own random number to you.
When you receive it, compare with yours.
If yours is greater than his, then you are player1 and he is player2. So you will make the first move.
If yours is lesser than his, then you are player2 and he is player1. So he will make the first move.
If yours and his number are equal (a very rare case) repeat the procedure.
As a reminder, you need to distinguish message types. So use different message type headers. For example: 'R' for random, 'M' for moves.