XaiJu
DillDoe
DillDoe

patreon


Disco Floor

Script to generate interactive disco style light up floor.


INCLUDED


INSTALLATION

Download into your VaM\AddonPackages directory

optional: Download & Uncompress image.rar in your VaM Directory.

Load Script in any plugin tab (ie. Scene Plugin)

Press Generate Floor.

Load Preset, you have to choose AddonPackage directory and select the DiscoFloor directory and navigate to Image folder.

optional: If you downloaded & uncompressed image.rar, you can just load from the default 'Custom\Image' directory.

Follow script description on the functions or watch the video above.

Move the whole thing by selecting the Cube atom.

Online Paint Program (jspaint.app)

DISCLAIMER : The video shows how to create pattern in online paint, but VaM will not allow you to save the file.  The video is mainly a demo, you have to create the pattern either in mspaint or via an external webbrower (ie. Chrome)


KNOWN ISSUES

As stated above, you can't create pattern in game via the webpanel because VaM will not allow you to save (security reasons?)  You have to do it on a regular webbrowser or any paint program.

Diagonal patterns do not work or work well with both Horizontal & Vertical scrolling, just like how Vertical scroll won't work if the top & bottom color are the same. (same for Horizontal if left & right colors are the same)  

Remove Floor will freeze the game until all the generated atoms are gone, so don't freak out thinking the game crashed.

Make sure you don't have more than one CyberPunkLight in scene or script won't work.  If you must, remember to rename them totally different.  Same with any cube shapes, don't have any named 'Cube' to avoid conflicts.



NOTES

I did say I was working on this in the Mirror Ball post, so here it is.

Pretty satisfied on the outcome.  I wanted this to be a simple as possible to use and as simple as possible to create patterns, think I accomplished both.

Originally I had planned on doing the default save/load preset, where you create the pattern in game and then save it as a json preset, since I have used the same code before to do that.  But that is painfully slow and you can't save screenshot like regular saves, SO had the bright idea to load an image and scan the pixel to color the corresponding light.

I wanted to used the Bitmap function in unity, but I kept getting reference error using the System.Drawing dll (VaM new security?) so I had to scrap it.  Was planning to use that function to do a save preset, not sure really how to do it another way in VaM.  Kinda moot now since it so much easier to create a pattern in paint than manually doing it in game.

I had to base the loading image code from MacGruber's postmagic since the method read the image by byte (and then load as texture) is not allowed due to VaM's new security feature that disable file access.  I think I used it right since it works.

Load Preset defaults to the 'Custom\Image' folder, so to access the included presets, you'll have to choose the AddOnPackage link and Choose the Image folder in the Disco_Floor package folder.  OR you can unrar the included preset into your 'Custom\Image' folder to bypass that hassle.  Also when creating your own pattern remember to save to that folder.

I ran into an issue with trigger actions for the lights.  It lights up when the collision trigger is active, but to do that I had set trigger action.  I did not know how to do that in script (or know if it was possible)  The only method I know was to save each light as a preset, then load those preset after generating the lights.  Now I didn't really do it for each light.  I just did one and wrote a script to generate 70 more, replacing the light number.  This made it much simpler code wise cause I can now rescale all the lights in one line of code instead of a few.  It also solve the issue of setting the diffuse texture to NULL, which it refuse to do via script. 

This script will also work in the Mirror Ball scene since it has the same naming convention and layout.  


Credits

Uses code based on HSThrowaway5's loading Preset, MacGruber's load image code & VAMDeluxe's code for spawning atoms



Please, don't share this publicly until the early access expires.

     



Disco Floor

More Creators