MakeVibrations Lua Script for OFS

Initially inspired by this thread: 11 Lua Scripts for OpenFunscripter

I wanted a script to easily add vibrations to a set of points that could be generated by @Lucifie’s AddPoints or wave generating scripts.

The script takes an amplitude input, so between the amplitude and point frequency you are using you should be able to really fine tune the speed of your vibrations. (I’ve just realised I’m incorrectly using the word amplitude, what you input is actual 2x the amplitude. Half of the number you input gets added/removed from your points to generate the vibration)

Downloads:
OFS 1.X version (add MakeVibration.lua to OFS_data/lua folder)
OFS 2.X version (add main.lua to OFS2_data/extensions/MakeVibration folder, create folder if you have to)

How to use:

Start off with a couple of points:


Add points in between (using this for OFS 1.X or this for OFS 2.X):

(Optional) Turn the points into a wave (using this for OFS 1.X):

Add vibrations:

It works by simply adding position to every second point, and subtracting position from every other point, which is a simple way of generating a vibration.

The script is a little rough around the edges, specifically the start and end of the selection, but when you’re dealing with rapid vibrations you won’t likely notice a stray point here or there.

My use case for this script is for generating smooth vibrations (does the idea of "smooth vibrations even make sense? lol) that can follow a pattern.

Hope this is helpful for someone out there! Any feedback is appreciated and I’m happy to answer questions about it, and if you take and modify this I’d appreciate a credit/mention in your post :smiley:

12 Likes

@shbek i feel like this would save you a bunch of time haha

2 Likes

ooo this might be interesting to use. thanks for sharing. hopefully this doesn’t melt anyone’s devices lol

I thought the same thing lol

Holy shit. It does. Gotta try this out thanks!

1 Like

Love your scripts @shbek ! Hope this helps :slight_smile:

I’ve updated the post to mention that it takes an amplitude as an input, hopefully no device melting :sweat_smile:

2 Likes

OMG It works like a charm.

I think it will save me at least 30~40% of my time on vibration patterns! Thank you so much!

More scripts incoming!

2 Likes

Glad to hear it! This script was very quick work so if you run into any bugs or find yourself wishing it did something more/else do let me know

1 Like

Does this work with OFS 2.0? I can’t figure out where to put it.

Good question! I can’t look at it today but from a quick look at the release notes for 2.0.0 it sounds like the API has been updated, so it may break all such extensions. I’ll install the new version soon and play around tomorrow probably!

1 Like

Yes two things were removed.
The old extension API and the even older “Custom functions” API (which you’re using in this case) was completely removed.
Sorry for the confusion.

The extension API has a little overhead when creating small functions like this but it’s worth it because once you have you can always extend it further. :wink:
The code should work with little modification as an extension you just have to wrap it in a binding.

More info: How to create an extension
And feel free to ask me questions via pm

If you want I could also add this to the extension I have here 11 Lua Scripts for OpenFunscripter - #28 by gagax123

1 Like

@gagax123 Thanks for the explanation, I think I will update my post just so that it works standalone but if you want to include my code in your extension feel free to add it in :slightly_smiling_face:

@pallokala2 I’ll make an update to the main post to support OFS 2.0 after I finish work in about 5hrs or so hopefully

1 Like

I’ve uploaded an OFS 2.X version of the extension, instructions included in the link hypertext

2 Likes

Haha, if only it worked in reverse!

1 Like