Jump to content

Open Community  ·  46 members

Valheim

[Mod Request] Maypole range increase


lizardsoul

Recommended Posts

Hi guys,

 

I am aware an extra point of comfort is not really that big of a deal, especially if linked to a POI that is not even generated in every map, and hard to find to begin with, but if anyone has the time and skill to edit the comfort bonus effect range of the Maypole, it would made it a bit more worth it to be found.

 

At the moment the Maypole seems to have the same range of campfires, if not a bit shorter, which would force the player to build their house, or at the very least their bedroom, right next to it, ruining in a way it's beauty, as it clearly meant to be a center piece of villages, with a wide circle of fence around it.

 

The range of its comfort bonus should, in my opinion, cover at least the size of the entire village that usually spawns around it.

That should mean a radius around 2 or 3 times that of a workbench, so between 40 or 60 meters.

 

Let me know if it is feasible.

Link to comment
Share on other sites

I'm just learning the basics of Valheim 'Code Modding'.. its brain melting but with Unity Explorer 3.1.12 (other versions wont work)

https://github.com/sinai-dev/UnityExplorer/releases/tag/3.1.12

 

values.png

 

You can inspect objects and change their values in realtime while the game is running , once you know what the values are then you can use them in a code script and create a plugin.dll for bepinex, I found the value to increase the comfort level ,

 

mayI.png

 

but I cant find the value for its effect radius ... its probabally called something other than effect radius, The warmth radius of a fire was easy to change..

 

longfire.jpg

 

I will keep looking and im sure someone will release the mod before I do :)

.. if not I will keep trying and hopefully be able to add custom options for a config file so you can choose the comfort level and effect distance yourself.

Link to comment
Share on other sites

I think what you want to use is ILSpy (or something like it) in Visual Studio. Looking at the code using ILSpy, it looks as if the comfort distance is a hard coded value of 10. It applies to all items in that radius that could provide comfort, not just the maypole.

 

This is the line where it is hard coded:

private static List<Piece> GetNearbyPieces(Vector3 point)

{
m_tempPieces.Clear();
Piece.GetAllPiecesInRadius(point, 10f, m_tempPieces);
return m_tempPieces;
}

 

Seems possible to change that, although it could have all kinds of side affects for other places where it might be called other than from CalculateComfortLevel.

 

So I think you could change the radius of all items that add to the player comfort.

 

If you somehow know how to compare a piece to see if it is a maypole, I suppose you could then code in a wider radius value for just that piece in this function:

public static void GetAllPiecesInRadius(Vector3 p, float radius, List<Piece> pieces)
{
if (ghostLayer == 0)
{
ghostLayer = LayerMask.NameToLayer("ghost");
}
foreach (Piece allPiece in m_allPieces)
{
if (allPiece.gameObject.layer != ghostLayer && Vector3.Distance(p, allPiece.transform.position) < radius)
{
pieces.Add(allPiece);
}
}
}

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...