Closed vlasooff closed 5 years ago
Don't wanna be that guy but there is a reason to why scripts are banned after all. If there was a way around that I would love to see that though.
I have already added component Landscape this way to the game, and not any problems.
Oh, wait I think it's limited on workshop only? Maybe it's changed, not sure.
OnEnterVehicle -> Add KillVolume -> OnVehicleExploded -> OnPlayerDied -> Profit
there may be many. OnDay OnNight etc.
1) You can not export scripts with asset bundles. 2) This would be very dangerous
You can use a copy of the script from the game by adding it asset bundles!
No, you can not export scripts.
I personally attached the script component Landscape and added it from the objects to the game, your inexperience.
You cannot have any custom script in assetbundles but you can reference scripts in game through a bug
You can attach scripts that already exist in game. But there's not many useful ones
It's not a bug just the way that Unity works
Thus, if a developer adds a script and throws us an example, we will be able to use it.
And I'm talking about events that will be useful for modding.
The other comments are correct that you unfortunately cannot export scripts inside asset bundles. If you open the asset bundle file you can see that they're serialized as numeric IDs of components included with vanilla Unity so that you can bundle components like meshes, landscapes, lights, etc.
I believe I saw a blog post (maybe from Facepunch?) recently about how they extended this list of IDs to include their own code, however that would still be limited to components from the game's dlls.
For the most part these sorts of events are currently possible by hooking events in the base game using Rocket or the modules feature.
As an example here's the header for 4's headlights component (picked random recent bit of code), much better documentation coverage and designed for modded components to hook events or inherit from.
https://gist.github.com/SDGNelson/0e6057ec280b0eb302879d459b5814ff
https://steamcommunity.com/sharedfiles/filedetails/?id=1086881979&searchtext=script Read, here is what I mean, UnityEvent with game events. Add separate scenarios with events and call these events, and we attach scripts to objects and listen to events. And send the scripts to us so that we add them to the gameobject. Sorry for my english please.
You are talking about modules, but if I'm not mistaken, players will not be able to load them (for example, as mods). I use some tricks to fundamentally change the logic of the game on the server (and these are not modules or plugins), but this is not enough for me. For example, not so long ago I made endless ammunition for turrets
Interesting, I wonder if Unity hashes the attached script and then the game recognizes the hash is the same as one in the assembly. (I imagine that's why the script has to be identical.)
From your original example it looks like you want delegates for existing scripts, in which case do they even need to be attached? Rocket plugins already hook delegates from the vanilla scripts for many things.
It doesn't have to be identical. It just needs to have same entry points. Moreover, only those you need
@SDGNelson We are waiting for the event system for mods.)))
Lolz, "we are waiting" sounds so wrong. At least provide some use cases
@aviadmini This is just a contraction, and developer support, and I once again apologize for my English.
And yet you forgot to provide some use cases
In general, I can make events myself, send scripts to the developer, and the developer simply adds them to the game and initiates the events?
Hi, I created an example.
I can implement various event systems and provide samples to the developer, can I do it or not? =\
Interesting, thank you for the example. I wasn't aware unity events let you control properties like that. (they're not used in the game anywhere) Not sure when the next update will be, but as an experiment I'll add a bunch of events for vehicles similarly to what you requested + more, and we'll see how it goes.
Always happy to help ... =)
"+ more" was an overstatement, for the next update here's the hook: https://gist.github.com/SDGNelson/61b5f598cbe3553ba53c04b074577d7f These scripts will be kept in the Bundles/Sources/ModHooks/ folder.
Once the update is out let me know if it works correctly for you, and from there you can let me know other events needed!
You probably know that you can add scripts to a file with a mod (.unity3d). Of course, if these scripts are in the game. I have an idea. Simple example: