Workshop Tutorial: Implementing Logic

Overwatch9 - Workshop Tutorial: Implementing Logic

Hey, my name is Lym. I've made some weird stuff in the workshop like Torbjörn wallclimbing, a raycast, a line renderer, custom turret ability, Symmetra ball lightning ultimate, and even Navi from Zelda.

I'm making this post to show you guys how you can use some core fundamentals of programming to improve your scripts in the Workshop, since the workshop is not your typical programming language.

This tutorial is intended for beginners, but could be useful for some of you who are a bit more familiar with the workshop as well.

Let's begin!

If Statement

An If statement is a piece of code which runs only if a condition is true. Normally how this is done is by encapsulating the code you want to run if the condition is true. But in workshop, we can only Skip code. So what we can do is skip the code if our condition is NOT true. The following code will play an explosion at the player if 2 == 2

fkHsosm - Workshop Tutorial: Implementing Logic

If Statement

If / Else Statement

Sometimes you want two seperate outcomes in your code depending on a condition. Such as "If my target is an ally, do X, but if my target is an enemy, do Y." This can be done with an if / else statement. The way this works is if the if statement runs, we make sure it doesn't run the code intended for the other condition by using a skip. The following code will play a Team 1 colored explosion on the player if he's part of team 1, otherwise it uses a team 2 color.


9tvTZZ0 - Workshop Tutorial: Implementing Logic

If / Else Statement

While loop

If you want your code to run over and over until a condition is true, you can use what's known as a while loop. There are several ways of doing this, but here's one example. The following code will play an effect on the player every 0.25 seconds as long as they are alive.

pi1mQuz - Workshop Tutorial: Implementing Logic

While Loop

For Loop

Sometimes you want a loop which only runs a certain number of times. This can be useful if you want to for example loop through every player in the match and do something with them. The for loop works similar to the while loop in that it keeps running if its condition is true. But the difference is that its condition is based off a counter which you increment each time you loop. The following code will play an explosion at your position 3 times, each explosion going 1 step higher in the air compared to the last one.

aoo64ZS - Workshop Tutorial: Implementing Logic

For Loop

I've use all of these concepts for what I've made in the workshop so far. Keep in mind there may be more than one way of doing these techniques, the important thing is the result of it.

If you guys want a more advanced tutorial I could maybe look into that later, but I'm hoping this helps some of you guys out there make way cooler stuff!

Source: Original link

© Post "Workshop Tutorial: Implementing Logic" for game Overwatch.

Top 10 Most Anticipated Video Games of 2020

2020 will have something to satisfy classic and modern gamers alike. To be eligible for the list, the game must be confirmed for 2020, or there should be good reason to expect its release in that year. Therefore, upcoming games with a mere announcement and no discernible release date will not be included.

Top 15 NEW Games of 2020 [FIRST HALF]

2020 has a ton to look forward to...in the video gaming world. Here are fifteen games we're looking forward to in the first half of 2020.

You Might Also Like

Leave a Reply

Your email address will not be published. Required fields are marked *