Releases: ItsDeltin/Overwatch-Script-To-Workshop
OSTW v0.3.15
OSTW v0.3.15
Import support.
// Top of file
import "HUD.del";
import "TrackerClass.del";
import "ZombieClass.del";
// Absolute paths work too.
import "../Extras.del";
rule: "my rule"
...
New methods
Workshop:
EventHealing()Healee()Healer()HostPlayer()
Custom by @TrueCP6 :
OptimisedBlendedIndex()OptmisedRangeOfArray()OptimisedSortedMedian()OptimisedUnsortedMedian()OptimisedEyeCastHitPosition()OptimisedHorizontalDistance()IsAIUnintrusive()IsAIAccurate()OptimisedIsOnScreen()OptimisedLinearInterpolate()OptimisedLinearInterpolateDistance()ToRadians()ToDegrees()SetHealth()OptimisedSphereHitbox()
Fixed bugs
Fixed ServerLoad(), ServerLoadAverage(), and ServerLoadPeak().
Player.Genji event restriction typo fixed.
Icon.Asterisk typo fixed.
VSCode extension v0.0.7
Now supports diagnostics for multiple files. The vscode extension must be updated to work with v0.3.15.
OSTW v0.3.14
Added StopChasingVariable(variable).
Fixed crash when rule names are longer than 128 characters.
Fixed ChaseVariable looper rule setting variable to 0 if the destination was not yet set.
New event types (PTR only):
Event.OnHealingDealt
Event.OnHealingTaken
Event.OnPlayerJoin
Event.OnPlayerLeave
New custom methods by @TrueCP6 :
BlendedIndex(array, index)
Allows you to get a value from an array using a non-integer index. Only works on data types that can have math operation performed upon them.
MinOfArray(array)
The lowest value of an array.
MaxOfArray(array)
The highest value of an array.
RangeOfArray(array)
The highest value of an array subtracted by its lowest value.
SortedMedian(array)
The median of an array that has already been sorted.
UnsortedMedian(array)
The median of an array that has not been sorted yet.
Destination(startingPoint, direction, distance)
Calculates a destination given a starting point, distance and direction.
EyeCastHitPosition(player, range)
Casts a ray in the direction the player is facing with a certain range.
FOVTakenUpBySphere(distanceToSphereCenter, sphereRadius)
The midpoint between 2 vectors.
HorizontalDistance(vector1, vector2)
The distance between 2 points as if they were on the same Y level.
IsOnScreen(player, point, fovOfPlayer)
Whether a point is visible on a players screen or not.
LinearInterpolate(point1, point2, fraction)
A point a fraction along the distance between 2 points.
LinearInterpolateDistance(point1, point2, distance)
A point a distance along a straight line between 2 points.
Midpoint(point1, point2)
The midpoint between 2 vectors.
Pythag(side1, side2)
Calculates the length of the longest side (hypotenuse) of a right angled triangle.
PythagConverse(side1, hypotenuse)
Calculates the missing side of a right angled triangle.
SphereHitbox(player, spherePosition, sphereRadius)
Whether the given player is looking directly at a sphere with collision.
TallnessOfPlayer(player)
The height of the player measured from feet to eyes.
ToKPH(metersPerSecond)
Converts from meters per second to kilometers per hour.
ToMPH(metersPerSecond)
Converts from meters per second to miles per hour.
ToFt(meters)
Converts from meters to feet.
ToYards(meters)
Converts from meters to yards.
ToInches(meters)
Converts meters to inches.
OSTW v0.3.13
OSTW v0.3.12
- Fixed number output. (#32, #33)
HealthPercent()renamed toNormalizedHealth(). (#31)- Fixed
StopHoldingButtonparameters. (#35) - Fixed operator precedence.
- Fixed non-workshop methods in if statements being evaluated after the block.
- Added
AngleBetweenVectors(). - Added
ServerLoad(),ServerLoadAverage(),ServerLoadPeak().
Multidimensional array manipulation
The Overwatch workshop inspector won't show multidimensional arrays correctly.
Example
define myArray;
myArray[2][6] = 5;
SmallMessage(EventPlayer(), myArray[2][6]); // Output is 5
Struct support
These can contain variables and methods.
Example
TeleportSphere playervar spheres;
define playervar wasCreated;
rule: "Create sphere"
Event.OngoingPlayer
if (IsButtonHeld(EventPlayer(), Button.Interact))
{
if (!wasCreated)
{
spheres = new TeleportSphere(EventPlayer(), PositionOf(EventPlayer()));
spheres.Create();
}
}
rule: "Destroy"
Event.OngoingPlayer
if (IsButtonHeld(EventPlayer(), Button.PrimaryFire))
{
spheres.Destroy();
}
rule: "Return"
Event.OngoingPlayer
if (IsButtonHeld(EventPlayer(), Button.SecondaryFire))
{
spheres.Return();
}
struct TeleportSphere
{
define location;
define owner;
define radius = 5;
define initialRadius = radius;
define effectID;
define wasDestroyed = false;
public TeleportSphere(owner, location)
{
this.owner = owner;
this.location = location;
owner.wasCreated = true;
}
private method Create()
{
CreateEffect(AllPlayers(), Effect.Sphere, Color.Red, this.location, radius, EffectRev.VisibleToPositionAndRadius);
effectID = LastCreatedEntity();
ApplyImpulse(EventPlayer(), Vector(0, 10, 0), 10);
}
private method Destroy()
{
if (wasDestroyed) return;
ChaseVariable(radius, 0, 10);
// Wait for the effect to be destroyed
CreateEffect(AllPlayers(), Effect.BadAura, Color.Red, location, radius + 1);
define sparkEffect = LastCreatedEntity();
while (radius != 0);
DestroyEffect(sparkEffect);
ChaseVariable(radius, 0, 0);
// Play an explosion
PlayEffect(AllPlayers(), PlayEffect.BadExplosion, Color.Red, location, 3);
// Damage nearby players
foreach 6 (define player in AllPlayers())
if (IsInRange(player))
Damage(player, owner, 50);
DestroyEffect(effectID);
wasDestroyed = true;
owner.wasCreated = false;
}
private method IsInRange(player)
{
return DistanceBetween(PositionOf(player), location) < initialRadius;
}
private method Return()
{
if (wasDestroyed) return;
Teleport(owner, location);
PlayEffect(AllPlayers(), PlayEffect.GoodExplosion, Color.Blue, location, radius - 1);
}
}
Public, private, and static support will come later.
New keywords
If you have any variables named one of these, be sure to change it to prevent conflicts.
newthisstruct
These are registered keywords that aren't functional yet, but they will be later:
publicprivatestatic
VSCode extension
Updated for new keywords.
OSTW v0.3.11
Updated foreach.
- Uses one less variable and action.
- Now takes an optional repeater parameter. Makes the
foreachfaster, but uses more actions. For example:
rule: "Repeater test."
Event.OngoingPlayer
if (IsButtonHeld(EventPlayer(), Button.Interact))
{
define start = TotalTimeElapsed();
foreach 5 (define player in AllPlayers()) // 5 is the repeater count
{
SmallMessage(player, "hello!");
}
define finished = TotalTimeElapsed();
SmallMessage(EventPlayer(), <"time finished: <0>", finished - start>);
}
| Repeater count | Time to Complete | Actions |
|---|---|---|
| 1 | 19 ms | 12 |
| 2 | 10 ms | 14 |
| 3 | 6 ms | 16 |
| 4 | 5 ms | 18 |
| 5 | 3 ms | 20 |
The number of actions scale with the number of statements in the foreach.
Added Pi()
Fixed Rounding.Nearest (#30)
Fixed VerticalFacingAngleOf() (#27)
Fixed semantic predicate priority. (#26)
VSCode extension updates
- Is now much, much faster.
- Extension must be updated for this release to work with the language server.
OSTW v0.3.10
Variables defined in methods can now use a specific workshop variable.
Fixed special symbol output. (#25)
Fixed variables named 'array' not working.
Fixed the {0} + {1} string.
Improved local variable autocomplete.
Improved recursive methods.
- Variables defined in recursive methods now work properly.
- Removed the
-allowrecursionargument. Recursive methods are now declared likerecursive method myRecursiveMethod().
Methods can now have documentation which will show up in the autocomplete:
# My Method does something.
method myMethod()
New methods:
- Added
RemoveFromArrayAtIndex(). - Added
InsertValueInArray()
VSCode extension:
- Updated syntax to work with method changes.
- Changed default ports to
9145and9146
OSTW v0.3.9
ChaseVariable() now works with vectors and player variables.
Added ternary conditionals.
OSTW v0.3.8
Added ChaseVariable(), which will work with named variables.
Fixed AngleOfVectors() parameters.
AngleOfVectorsCom() will return the angle instead of the res now.
OSTW v0.3.7
Added new workshop strings
Removed underscores from strings.
Added EventDamage(), EventWasCriticalHit(), and DestroyAllInworldText().
Fixed Left() return type.
Fixed Dva, Torbjorn, and Lucio enums.
OSTW v0.3.6
Fixed loops running despite the condition.
Added foreach(define var in array) { ... } (Actual value instead of index now)
Added increment var++ and decrement var-- (You can do for (define i = 0; i < 10; i++) instead of i+=1)
Removed for (var in array)