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.
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
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.
If / Else Statement
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.
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.
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 Best Video Games of 2018 So Far
2018 has been a stellar year for video game fans, and there's still more to come. The list for the Best Games of So Far!
Top-10 Most Anticipated Video Games of 2019
With 2018 bringing such incredible titles to gaming, it's no wonder everyone's already looking forward to 2019's offerings. All the best new games slated for a 2019 release, fans all over the world want to dive into these anticipated games!