Jump to content

AManager: A Sub-Module Adding Events and Achievement Tracking [WIP]


Nycidian

Recommended Posts

Amanager_icon.png

 

The idea behind AManager (Achievement Manager) is to create a sub module that is easily added to other mods without conflict.

 

Very simply when finished you may down load AManager and simply add two component files and the "amanager" folder to your mod the only other thing you will have to do is add the following code to your modmain file at the top.

modimport("amanager/start.lua")

What Does It Do..?

 

AManager does a few things...

 

It coordinates with other versions of itself installed by other mods so only the most recent version is loaded for all mods. This means as a modder you have no fear of using AManager and other modders using old version of it and causing you problems.

 

Now for what it's functionality outside of regulating itself is the following.

 

  • Expands some events that currently exist but are not visible at the character level, such as "growfrombutterfly," these events now are visible at the character level as well as their respective prefabs.
  • Adds some new events at the character level such as: "playerHounded," this event triggers when a hound is released to attack players; "playerignite" this even tracks what the player has lit on fire with a torch and all the secondary fires that happen from that.
  • Tracks how much of each creature a player kills.
  • Tracks how long a player has survived.
  • Tracks how many winters a player has survived
  • Tracks much more...
  • Weighs these statistics and stores new metrics based on these weights.
  • Functions to access all of this.

Most repetitive metrics use a variation of this formula

for key,value in pairs(self.killed) do     local count = 0    for x=1, value.amount, 1 do         count = count + (1/x)        if math.floor((count*value.worth)+0.5) == (2*value.worth) then            break        end    end    merit = merit + (math.floor((count*value.worth)+0.5)*self.KILL_MULT)end

What this means is the first event recorded is worth the base score then the next is worth half again then the next is worth 1/4 more and so on, meaning eventually you can get double the base score (The formula averages the max you can get). Some things have a static score other things such as killed creatures have a dynamic score (creatures are calculated by using the creatures health, damage, damage period, and range of attack).

 

 

I plan on also releasing a simple mod that shows a score on the screen as an example of the submods use when I release the first release version. 

 

Another example of a mod that this submod might be useful for creating is a mod that tracks and displays achievements or a mod that unlocks harder content as your score increases.

 

Here is a list of the current things that the submod tracks or is planned to track (It may be missing items).

 

  • Creatures killed.
  • How much of each tech level you have unlocked.
  • Survived:
    • Total days.
    • Grue attacks.
    • Winters.
    • Hounds released.
    • *Deaths (Resurrected).
  • World Explored
  • Number times catching a boomerang in a row.
  • Fish caught.
  • Unique food eaten.
  • harvested items.
  • Butterflies planted.
  • Trees planted.
  • Amount of animals trapped.
  • Unique followers
  • How much wood chopped
  • Bugs caught.
  • *Times struck by lightning.
  • *Times you have starved.
  • *Times you have started to freeze.
  • *Items broke.
  • *Times player slept
  • *items player burned
* items that will be worth no score or negative score.
 
If you have any suggestions or requests please feel free to post.

 

Link to comment
Share on other sites

For those who may be watching or who read this thread I have a question. 

 

Because of how the submod has to be built to be able to be self updating across versions the component with the working functions will have its name change across versions

  • amanager_1.lua
  • amanager_2.lua
  • amanager_3.lua
  • etc...

The way I have found to access these function currently is through a secondary component that already does the saving an loading to access it you would do something like this.

GLOBAL.GetPlayer().components.amanager:Get():FunctionName()

The amanager:Get() handling the work of finding which amanager_# component is installed .

 

My question is is this simple enough use?

 

its possible I might be able to find a way to make it work without the GEt() function but I'm not sure the effort is worth it considering the Get() function already works fine its just not similar to how you normally access a component but not really confusing.

 

So what are your thoughts on this as because of how the mod works once I release it  this functionality will not be changed easily if at all.

 

 

squeek Helped me to figure out how to do what I wanted, actually he basically rewrote that part of the code so never mind the question as its irrelevant.

 

Big shoutout to @squeek for the help.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...