PRODUCTS
EXPERIENCES
APPS & GAMES
SUPPORT
Meta accounts are here: you can create a Meta account to log into VR devices.
Learn more
META HORIZON WORLDS
LEARN TO CREATE
INTRO TO CREATION
INTRO TO HAND TOOLS
INTRO TO GIZMOS
INTRO TO SCRIPTING
PUBLISHING
LOCAL SCRIPTING
EVENTS
MOTION
ACTIONS
RESOURCES
BROWSE TUTORIALS
INTRO TO SCRIPTING
INTRO TO SCRIPTING
INTRO TO SCRIPTING
…
Welcome to Scripting in Horizon Worlds! In this series we are going to learn the fundamentals of the Script Gizmo, and then we will dive deeper into the tools and build a mini game.
…
SCRIPT GIZMO
…
The Script gizmo allows you to create dynamic and unique experiences. Seen below is the script gizmo, which can be opened by putting your pointer inside, and pressing forward on your thumbstick, similar to opening a property panel on other objects and gizmos.
…
EVENTS
…
When you plan your script, ask yourself, when does the thing you want to happen occur? This is where events come into play.
…
MOTION
…
The Motion tab allows you to move objects and players in your world. Objects have motion options that are both instant and over time.
…
ACTIONS
…
Actions offer an incredible way to interact with your world and players, often connecting to visual effects, sounds, text, and other gizmos. You can also reset the world, play haptic feedback, and adjust a player's voice settings.
…
OPERATORS
…
Operators are extremely powerful.
…
VALUES
…
The Values tab allows you to interact with variables using the SetTo codeblock. You can also interact with Player Variables, and get all types of value inputs to use in your scripts.
…
VARIABLES
…
Variables have a lot of uses, they are great for changing values like a timer, or durability.
…
CODEBLOCK TYPES
…
You may have started to notice there are a few different colors and shapes to the codeblocks.
…
SCRIPTING COMPONENTS
…
In the bottom right of the scripting panel, you’ll see a capacity meter.
…
CAPTURE THE FLAG SCRIPTS
WHEN TRIGGER IS ENTERED BY OBJECT
…
In this section we will be displaying a trophy when a flag enters a trigger.
…
COUNT OBJECTS IN TRIGGER
…
What if we want three flags in unique positions, before showing the trophy?
…
FIX COUNTING BUG
…
You might have noticed that our flags can be counted twice, causing the trophy to display early.
…
GAMIFYING WATER BALLOONS
OBJECT RESPAWN SCRIPT
…
Remember that water balloon we made in the Gizmos series? We are going to turn it into a game mechanic.
…
PERSISTENT PLAYER VARIABLES
…
Persistent Player Variables are an incredible tool for keeping track of player stats.
…
TRACK PLAYERS HIT
…
Now let’s use our score variable to track how many times a player has hit another player with a water balloon.
…
SCOREBOARD SCRIPT
TRACKING PLAYERS IN THE WORLD
…
Now that we are tracking player scores, we can build a scoreboard.
…
DISPLAYING SCORES
…
In our scoreboard, we need to create a display loop. Bring over When World is Started, and When Event is Received.
…
CREATING GAME LOOP
RANDOM SPAWN POINTS
…
This next script is not necessary, but if you are up to it, will add an awesome element of fun.
…
WORLD RESET OPTIONS
…
There are two ways to reset your world, either manually moving objects back to their original position and states, this is called a soft reset because you are in control of what’s changed.
…
RESET WORLD TROPHY
…
Back on our Trophy script, let’s add two lines to allow the players to reset the world. Bring over the Index Trigger event, and from Actions, grab Reset World. Now when the players win the trophy, they can reset the world.
…
THANK YOU FOR WATCHING
…
You have done absolutely wonderful and are well on your way to mastering scripting, great work! We have a lot of tutorials in and out of Horizon. Be sure to experiment in this world playing with these new tools, try out different ideas and combinations.
…
QUEST 3
QUEST PRO
QUEST 2
ACCESSORIES
RIFT S
APPS & GAMES
SUPPORT
DEVELOPERS
VR FOR WORK
ALL PRODUCTS
Quest 3
Quest Pro
Quest 2
Quest 2 (Refurbished)
Rift S
Accessories
Quest
Go
Rift
Compare Headset
MORE META QUEST
Forums
Blog
Referrals
VR for Good
Creators
Download SDKs
ABOUT
Careers
Meta Connect
Research
ALL PRODUCTS
Quest 3
Quest Pro
Quest 2
Quest 2 (Refurbished)
Rift S
Accessories
Quest
Go
Rift
Compare Headset
MORE META QUEST
Forums
Blog
Referrals
VR for Good
Creators
Download SDKs
ABOUT
Careers
Meta Connect
Research
Privacy
Legal
© Meta 2024