World Objects

Show off your mod creations or just a work in progress.
Post Reply
User avatar
Uncanny_Valley
Posts: 221
Joined: Mon Mar 23, 2015 5:47 pm

World Objects

Post by Uncanny_Valley »

Name: World Objects
Made by: Uncanny_Valley
For: DaggerFall Tools For Unity (1.3.8)
Version: 1.00

Image

This mod allows you to place any object on any terrain on any place in the world. The Objects placements are saved in a special made file format (that I dubbed .ObjData).
This version comes with a few example files and objects created from the free asset bundle "Viking Village", which you can find on the Unity asset Store.
Overall I see this mod as a concept to develop a modding tool that will allow for much more advanced mods in the future. You can in theory use this to add any type of object in the game, bundled with scripts and/or anything else your heart might desire.


Known Issues:
None that I'm aware of but the implementation and functionality of this mod might be greatly changed or overhauled in the future.

How to use:
1.Add the WorldObjects prefab in the scene

2. Add the following code in DaggerFallTerrain.cs

Somwehere in Start(),

#if UNITY_EDITOR
gameObject.AddComponent<WorldObjectSaver>();
#endif

At the bottom of PromoteTerrainData()

if (worldObjects == null)
worldObjects = GameObject.Find("Prefab_WorldObjects").GetComponent<WorldObjects>();

worldObjects.LoadObjects(gameObject);


How to add new Objects:

Adding new prefab object
1.All prefabs that you want to add needs to be located in a folder callsed "Resources", this is a standard Unity folder that the WorldObjects script can access to read your prefabs
2.The name of the prefab needs to start with "_", for example "_myPrefab"

Placing objects in the world
1. Start the game in the editor
2. Find a location that you like, drag your object(s) to the scene and position them (placement, rotation and scale) were you want them in the world.
3. Make sure that your scene object has the same name as the prefab object in your Resource folder, (object names can change if you for example copy paste objects in the unity window)
4. All placed objects needs to be a child object for the terrain on which they are placed.
5. Add, move or remove as many objects that you like.6
6. Select the terrain object were you wish to save your objects, there you will find the script "Word Object Saver", press the button that says "Save Changes".
7.Done. When you start the game again you will now see your objects appear were you placed them.

Link
http://www.filedropper.com/worldobjects100

User avatar
Uncanny_Valley
Posts: 221
Joined: Mon Mar 23, 2015 5:47 pm

Re: World Objects

Post by Uncanny_Valley »

Added a few more objects. Here are two images taken from the same location, with and without the added objects.

Image

Image

User avatar
Interkarma
Posts: 7247
Joined: Sun Mar 22, 2015 1:51 am

Re: World Objects

Post by Interkarma »

This is great! I was thinking of something similar when I got around to mod support for blocks, but I think your solution is much neater than mine would have been. Really awesome work!

User avatar
LypyL
Posts: 512
Joined: Sun Mar 22, 2015 3:48 am

Re: World Objects

Post by LypyL »

I can't wait to try this out! You're absolutely killing it with these mods :D

This will be perfect for adding a controllable boat...that's been on my to-do list for a long time

User avatar
Uncanny_Valley
Posts: 221
Joined: Mon Mar 23, 2015 5:47 pm

Re: World Objects

Post by Uncanny_Valley »

Glad you like it. Creating this kind of mod has been on my mind for quite a while, mostly because there are a few mod ideas that I have that require that I can add objects to the world.

I'm still thinking about whether not this is the best way to implement this kind of feature, both as a whole and the individual parts of it. There is a lot to consider since this could potentially be used as a base for many different kind of mods made by many different people. It needs to be easy to use, flexible and have an error-tolerant design (make it as hard as possible for creators and users to do something wrong). I also believe that this is something that works best if it can be integrated and be a part of the core toolset, rather than be a separate mod or extension, and that is the direction that I would like to take this "project", with your (Interkarma) permission and approval of course. What do you think?

User avatar
Interkarma
Posts: 7247
Joined: Sun Mar 22, 2015 1:51 am

Re: World Objects

Post by Interkarma »

Yes, of course. :) You have made some excellent contributions and I have no problems with this. I'll PM you some details in a moment.

User avatar
Uncanny_Valley
Posts: 221
Joined: Mon Mar 23, 2015 5:47 pm

Re: World Objects

Post by Uncanny_Valley »

Here is a slightly updated version of my world objects mod. There is no big changes, the code is a bit cleaner and the documentation is a bit clearer. There is no example file in this version, so the download is much much smaller.

I still see this as a proof of concept more than anything else, and I honestly don't know how to improve or continue on this. But if someone has a good idea or wish to continue to work on it, I fully support that.
Attachments
WorldObjects_1.01.zip
(4.78 KiB) Downloaded 426 times

User avatar
LypyL
Posts: 512
Joined: Sun Mar 22, 2015 3:48 am

Re: World Objects

Post by LypyL »

I don't know if you tried out the laser in the demo sans jet - I'm currently working on separating it from my jet project entirely. Currently it can be used to teleport the player, place an explosion particle effect, or spawn an enemy (due to floating origin issues this is disabled when not in the jet). My end goal with this is to also use it to place "things" in the game...the idea was the player would open up a menu, select from different categories what they want (sound/models/flats/enemies/effects etc.), and then select a specific item to spawn, which would be placed at the player's pointer.

I was thinking it could eventually serve as a basis for creating a settlement building mod like the ones in some of the later ES games & FO3/NV down the line.

Anyways, I don't know if I'll ever tackle all that, but something like that might be a way to grow this further. :)

TrevTheDev
Posts: 4
Joined: Sat Oct 01, 2016 2:03 am

Re: World Objects

Post by TrevTheDev »

Assets/Scripts/Terrain/DaggerfallTerrain.cs(267,8/268,5/270,4): error CS0103: The name `worldObjects' does not exist in the current context

I copied exactly as you said to do. Do you know whats wrong? There isn't a variable called "worldObjects". Even after creating one it had issues. So, what do I do? :D

Post Reply