Hunt Locations and Natural Resources: Difference between revisions

From PSwiki
Jump to navigation Jump to search
Created page with "We have two different ways to configure locations where players can gather materials. == Natural Resources == Used when we need invisible items to be harvested, example a min..."
 
 
(8 intermediate revisions by the same user not shown)
Line 5: Line 5:


So we configure a location on the map, defined by a center (in x/y/z coordinates) and a radius, where the player will be able to harvest. We also define the tool to be used (example a rock pick), the difficulty, and the resulting item.
So we configure a location on the map, defined by a center (in x/y/z coordinates) and a radius, where the player will be able to harvest. We also define the tool to be used (example a rock pick), the difficulty, and the resulting item.
* [[natural_resourcesTable|natural_resources]]
* The table [[natural_resourcesTable|natural_resources]] is holding this information


Hunt Locations
 
* [[hunt_locationsTable|hunt_locations]]
 
For '''wood harvesting''', we created a different system, based on the mesh name you right click on. To have one type of tree being recognized for harvesting you need to do the following:
 
1) Set Collision = "Custom" and "Query Only". Set all channels to "Ignore" except "InteractMouseTrace" to Block.
 
2) In the mesh object (Example oak_03) set the "Collision Complexity" to "Use Simple as Complex", this is because when we LineTrace we use Complex.
 
3) Save the level again
 
4) Set the mesh name in [[natural_resourcesTable|natural_resources]].trace_mesh. This name can be set just with the first part of the name, example "oak_", so that all trees with name "oak_*" will be picked up, like oak_01, oak_02, .....
 
5) In [[natural_resourcesTable|natural_resources]] set the location and sector to 0, as it will be ignored anyway.
 
 
 
For '''flowers/plants''', the engine is spawning a mesh on the location of the natural resources, line tracing down to the ground, remember to:
 
1) Remove the collision from the mesh in Unreal
 
2) set the mesh name in [[natural_resourcesTable|natural_resources]].spawn_mesh.
 
3) If you want the plant to ALWAYS be available, then do not add any children to it
 
4) If you want to use the new random spawn system, then add a new child resource in natural_resources_items . This will make the main resource just a container (nothing will spawn there) and the system will select at random X locations to spawn, where X is defined by  [[natural_resourcesTable|natural_resources]].active_locations. Then  [[natural_resourcesTable|natural_resources]].amount will define how many times you can harvest that resource before its depleted. When it's depleted it will disappear and the game will wait  [[natural_resourcesTable|natural_resources]].interval +  [[natural_resourcesTable|natural_resources]].max_random milliseconds before spawning a new one in a non active location.
 
 
 
For '''fishing''' we created a linked table natural_resource_items and [[natural_resourcesTable|natural_resources]].item_group points to natural_resource_items.group_id . This table contains the characteristics of the group.
 
== Hunt Locations ==
Used when we want a visual 3d object to be spawned as a pickupable item. When the player picks up the item, a new item is scheduled to be spawn later on based on configured interval.
 
* The table [[hunt_locationsTable|hunt_locations]] is holding this information

Latest revision as of 21:51, 18 March 2025

We have two different ways to configure locations where players can gather materials.

Natural Resources

Used when we need invisible items to be harvested, example a mine will be modeled in 3d, but the individual ore are not 3d objects in the world.

So we configure a location on the map, defined by a center (in x/y/z coordinates) and a radius, where the player will be able to harvest. We also define the tool to be used (example a rock pick), the difficulty, and the resulting item.


For wood harvesting, we created a different system, based on the mesh name you right click on. To have one type of tree being recognized for harvesting you need to do the following:

1) Set Collision = "Custom" and "Query Only". Set all channels to "Ignore" except "InteractMouseTrace" to Block.

2) In the mesh object (Example oak_03) set the "Collision Complexity" to "Use Simple as Complex", this is because when we LineTrace we use Complex.

3) Save the level again

4) Set the mesh name in natural_resources.trace_mesh. This name can be set just with the first part of the name, example "oak_", so that all trees with name "oak_*" will be picked up, like oak_01, oak_02, .....

5) In natural_resources set the location and sector to 0, as it will be ignored anyway.


For flowers/plants, the engine is spawning a mesh on the location of the natural resources, line tracing down to the ground, remember to:

1) Remove the collision from the mesh in Unreal

2) set the mesh name in natural_resources.spawn_mesh.

3) If you want the plant to ALWAYS be available, then do not add any children to it

4) If you want to use the new random spawn system, then add a new child resource in natural_resources_items . This will make the main resource just a container (nothing will spawn there) and the system will select at random X locations to spawn, where X is defined by natural_resources.active_locations. Then natural_resources.amount will define how many times you can harvest that resource before its depleted. When it's depleted it will disappear and the game will wait natural_resources.interval + natural_resources.max_random milliseconds before spawning a new one in a non active location.


For fishing we created a linked table natural_resource_items and natural_resources.item_group points to natural_resource_items.group_id . This table contains the characteristics of the group.

Hunt Locations

Used when we want a visual 3d object to be spawned as a pickupable item. When the player picks up the item, a new item is scheduled to be spawn later on based on configured interval.