malkuth

KSP Achievements (1.9.4.2) (KSP 1.4.1) 3/14/2018

Recommended Posts

This plugin was formally known as Blizzy's Achievements and is a continuation of that plugin with Blizzys Consent and permission. As requested license information has remained the same.

 

I will not provide support if you don't follow these simple instructions.  To many mods out for KSP for me to be chasing things that might not be related to KSP Achievements. 

Li3Y3P4.png

This plugin brings Kerbal Space Program a Steam Like Achievement System. Currently as of this release there are about 145 Achievements in the following categories.

 

  • Crew Operations
  • General Flight
  • Ground Operations
  • Landing
  • Research and Development
  • SpaceFlight
  • Contracts
  • Funds
  • Reputation
  •  

 

This plugin uses Blizzy's Tool bar. The tool bar icon takes you to the Achievements window. This window shows you every single achievement available to you in the game. Achievements tracks your progress through the game and notifies you with a little chime and onscreen prompt when you accomplish one of the Achievements.. The Achievement window updates and shows you what you have accomplished and ones you still have to work on.

As I Learn more about how blizzy wrote the code for Achievements I will add many more Achievements to the system. As of this version I added the new contracts, funds, and reputation achievements. As I dig deeper into the code I will update and add more interesting things as time goes on.

All Achievements are saved to your Persistent file, and its recommended that you delete any old Achievement folder before updating to a new version. You will not lose your Achievements if you do this.

How to Install.

1. Download the zip file.

2. Open the zip file with whatever program you use to open compressed .zip files. (7Zip)

3. Inside zip file find a folder called GameData. Place the folder in your C:\kerbal\ directory and your good to go.

4. Load up Kerbal Space Program and start unlocking those Achievements!

Things to do.

 

  • Option for KSP ToolBar
  • Settings option to turn off sound if wish
  • Add more Achievements any ideas?
  • update the UpdateChecker
  • use the API to add Mission Controller Contract Achievements.
  • Check to make sure the API for other mods can access this plugins still works as intended. (looks good so far)
  • Many small updates as time goes on.
  •  

 

Gx6sE4C.png

ChangeLog

 

 
1.9.4.2
1.Updated for KSP 1.4.1 Just to get it back up. 
2.Removed AVC for now.

Version 1.9.4
1. Udpdate for KSP 1.2

Version 1.92 For KSP 1.12
1. Recompiled for KSP 1.12 and AVC Updates.

Version 1.91 For KSP 1.11
1. Fixed AVC version check for KSP 1.11.

Version 1.9 for KSP 1.1 Release.
No more dependency for Blizzy Tool bar.. Been wanting to transfer to default KSP tool bar for awhile now.
2.Updated for 1.1 PreRelease.
3.Added MiniAVC for version checking.


Version 1.8.0 Pre Release for KSP 1.1 PreRelease.
1. No more dependency for Blizzy Tool bar.. Been wanting to transfer to default KSP tool bar for awhile now.
2. Updated for 1.1 PreRelease.
3. No longer has version checkers at this time.  Removed all code for this old code.

Version 1.8.0
1. updated to KSP .90 Beta Than Ever
2. Please note this is packed with a older version of ToolBar.  Seems to work fine in .90 so far.  When toolbar updates to .90 suggest updating it manually.

Version 1.7.1

1. Fixed an issue where science, reputation, and refund checks would cause lots of debug spam in Non Campaign Games.  (Sandbox Safe now)

Version 1.7.0

1. Updated for kerbal Space Program .25
2. Added new Funds Achievements.
3. Added new Contract Achievements.
4. Added new Reputation Achievements.
5. Malkuth took over project from Blizzy.

This mod includes version checking using MiniAVC. If you opt-in, it will use the internet to check whether there is a new version available. Data is only read from the internet and no personal information is sent. For a more comprehensive version checking experience, please download the KSP-AVC Plugin.

Download from Curse (Version 1.4.1 of KSP)

Download From GitHub (Version 1.4.1 of KSP)

The Achievements Plugin is licensed under the GNU GPL v3.

Source file located on my GitHub Page.

Edited by malkuth

Share this post


Link to post
Share on other sites

For Plugin Authors That Wish to add Achievements to their own mod.

From Blizzy's Original Development Thread.

Requirements

To contribute new achievements, you only need the Achievements.dll from the plugin, starting with version 1.4.6. You need to reference that in your project.

Note that you probably don't want to make the Achievements.dll a direct dependency of your mod's DLL. Because of that, it is best to start a new DLL project that has dependencies on both your mod's DLL and the Achievements.dll. If the player doesn't have the Achievements Plugin installed, only your achievements DLL will fail to load, but your base mod DLL will run fine.

Code

To add a new achievement, you need to write a bit of code. Don't worry, it's not that much. Most of it goes into checking for achievement requirements, such as "is landed" or "is in orbit", and things like that.

Please consider the following complete and annotated example. It should readily compile and be usable in the game.

Note: The following example source code is hereby placed into the public domain, for obvious reasons. Feel free to use it as you wish. I do not reserve any rights to it whatsoever.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;

// This is an achievements factory. It is used to create actual achievement instances and to provide
// information about the category of those achievements.
//
// Achievements factory classes are searched for in all assemblies. When found, an achievements factory
// is instantiated automatically using its no-args constructor.
//
// You can have as many achievements factories as you like, but in general, you need at least one per
// category.
class NorthPoleFactory : AchievementFactory {
// Returns the actual achievements.
public IEnumerable<Achievement> getAchievements() {
return new Achievement[] {
new NorthPole()
};
}

// Returns the category of the achievements returned by getAchievements().
public Category getCategory() {
return Category.LANDING;
}
}


// An actual achievement.
//
// While achievements must only implement the Achievement interface, it is best to subclass from
// the AchievementBase class. This class provides several helper functions to register event
// callbacks.
//
// An achievement is basically a finite state machine. The main method being used is check(), which
// will be invoked in a specific interval. In this method, you should check for any requirements
// that your achievement has. If check() returns true, this means that the player has earned the
// achievement, and the method will never be invoked again. As long as it returns false, the method
// will be invoked again at a later time.
//
// Other interesting classes to look at (check the Achievement Plugin's source code):
//
// - Body (celestial bodies, also try Vessel.getCurrentBody() from Extensions)
// - Category (achievement categories)
// - CountingAchievement (base class for achievements that count up)
// - Extensions (various extension methods)
// - Location (surface locations)
class NorthPole : AchievementBase {
// You can register event callbacks in the constructor. Most of the time, this will be
// registerOnVesselChange() to reset achievement state when the player changes the vessel
// being actively controlled.
//
// See the AchievementBase class for other event handling methods.
public NorthPole() {
registerOnVesselChange(onVesselChange);
}

// While check() is invoked in specific intervals, update() will be invoked every frame.
// You can use this method to check for achievement requirements, too.
//
// USE ONLY IF check() DOESN'T ABSOLUTELY MEET YOUR NEEDS.
public override void update() {
}

// This is the main method to check for achievement requirements. If check() returns true,
// this means that the player has earned the achievement, and check() will never be invoked again.
//
// vessel is the actively controlled vessel. Note that this can be null, for instance if the
// player is in the tracking station. You should always check for null if you need the current
// vessel.
public override bool check(Vessel vessel) {
return (vessel != null) && vessel.isOnSurface() && (vessel.horizontalSrfSpeed < 1d) &&
Location.KERBIN_NORTH_POLE.isAtLocation(vessel);
}

// The vessel change event callback that was registered in the constructor.
private void onVesselChange(Vessel vessel) {
// reset achievement state here
}

// Initialize achievement state from the achievements save file, as saved earlier in save().
//
// node is a config node specific to this achievement. You can't accidentally interfere with
// other achievements.
public override void init(ConfigNode node) {
}

// Save achievement state to the achievements save file. State can be loaded again in init().
//
// node is a config node specific to this achievement. You can't accidentally interfere with
// other achievements.
//
// Note that the config node values "flight" and "time" are reserved. If you set them, they will
// be overwritten.
public override void save(ConfigNode node) {
}

// Returns this achievement's title. Keep short so that it fits into the "toast" texture.
// Always use "Headline Style".
public override string getTitle() {
return "North Pole Landing";
}

// Returns this achievement's text. Keep short (two lines of text) so that it fits into the
// "toast" texture.
public override string getText() {
return "Land at Kerbin's north pole.";
}

// Returns this achievement's key. The key must be unique across all achievements.
//
// This key MUST NOT change once an achievement has been made public. It is used to check if
// the player has already earned the achievement. If the key changes, the achievement will need to
// be earned again by the player, which makes them unhappy.
//
// It is best to use some sort of ad-hoc categories, for example: landing.kerbin.surface.northPole
public override string getKey() {
return "landing.northPole";
}
}

Title and Text Guidelines

Titles should always use "Headline Style". Keep them rather short and memorable, preferably humorous, but related to the achievement and its text. If you can't come up with something neat, ask someone else! Most people will love to toss ideas at you.

- Good example: I See What You Did There

- Bad example: I see what you did there

Achievement text must not exceed two lines of text, or it will be longer than the "toast" texture. Always check with the achievements list in the game to see if your text is short enough.

Also, the text should not be too verbose. Try to keep the list of requirements short. You can leave out obvious requirements, even though your achievement code is checking for them.

Spell out acronyms, such as "Kerbal Space Center" instead of "KSC".

To keep the player immersed, do not use real-world names and phrases. Bad example: Send a probe on a Voyager mission.

Note that the Sun's name is not Kerbol in the game, is is "Sun".

- Good example: Land on the Kerbal Space Center runway from an altitude of at least 10000 m.

- Bad example: Launch, get up to 10000 m, then land on the KSC runway, not crashing and no parts breaking off.

Hidden Achievements

Achievements are usually visible in the achievements list window, even if the player has not earned them yet. But you can "hide" an achievement, so that it remains hidden unless the player has earned it. After that, it will stay visible.

Please use hiding of achievements only sparingly, if at all. It should remain reserved for special "surprise" achievements that are not obvious. For example, an achievement that is rewarded for extracting Kethane from the ground of another celestial body should not be hidden because the act of doing so is pretty obvious.

Edited by malkuth

Share this post


Link to post
Share on other sites

You set the version on kerbalstuff to "Version_1.7.0". Could I ask you to kindly change this to "1.7.0"? Or ask the admins at kerbalstuff to do so for you if it is not possibly via the GUI?

It would make packaging via CKAN tremendously easier :cool:

Share this post


Link to post
Share on other sites
You set the version on kerbalstuff to "Version_1.7.0". Could I ask you to kindly change this to "1.7.0"? Or ask the admins at kerbalstuff to do so for you if it is not possibly via the GUI?

It would make packaging via CKAN tremendously easier :cool:

Hope that helps. ;)

Share this post


Link to post
Share on other sites

Planet factory sentience.

One of the issues I am having with your mod is that it seems to assume I have Joker installed. I don't for deep historical reasons relating to my install. I like Joker but I just don't have it installed right now. I do, however, have a dozen other planets installed... If the game could handle resources properly, I would cheerfully have three or four starsystems installed with fully functional suns and extensive planetary systems, etc... So your mod should do some checking around to see what is actually installed in the current game and has less than 5 Gs of gravity, escape velocity less than a large fraction of the speed of light, and then generate trophies accordingly.

Share this post


Link to post
Share on other sites

this throws a ton of continuous log spam when its run under Science Sandbox mode because it does a check for funds and reputation and comes up empty.

Share this post


Link to post
Share on other sites
this throws a ton of continuous log spam when its run under Science Sandbox mode because it does a check for funds and reputation and comes up empty.

Thanks for the info. I take a look at it for next version.

Share this post


Link to post
Share on other sites

Version Update.

Since the above bug was pretty serious I released a small hotfix for it. Version 1.7.1.

1. Fixed an issue where science, reputation, and refund checks would cause lots of debug spam in Non Campaign Games. (Sandbox Safe now)

Available on front page.

Share this post


Link to post
Share on other sites

I might be misremembering this but, didn't the original version use to give you science when you achieved something?

Doesn't seem to be happening any more.

Share this post


Link to post
Share on other sites
I might be misremembering this but, didn't the original version use to give you science when you achieved something?

Doesn't seem to be happening any more.

If it did, it was removed long before I got my hands on it.

Share this post


Link to post
Share on other sites
If it did, it was removed long before I got my hands on it.

I might be wrong, I'll have to look at my 0.24.2 install but I'm sure it gave something as a reward.

Share this post


Link to post
Share on other sites
I might be wrong, I'll have to look at my 0.24.2 install but I'm sure it gave something as a reward.

I would not really support the idea anyway. If it did exist I'm glad Blizzy Removed it. Science is already way to easy with the new Admin Building basically making it easy mode.

Share this post


Link to post
Share on other sites

Don't get me wrong I'm not asking for it to return, I just wasn't sure if I had a bad install.

Share this post


Link to post
Share on other sites
Don't get me wrong I'm not asking for it to return, I just wasn't sure if I had a bad install.

Have not gone to deep into the code but I'll keep an eye out to see if I can see remnants of it someplace.

Share this post


Link to post
Share on other sites

Is it normal not to be able to activate the toolbar button in the space center scene?? I can access it anywhere else but it doesnt show up on blizzys toolbar in the space center scene even though I have it selected to be visible.

Share this post


Link to post
Share on other sites
I might be misremembering this but, didn't the original version use to give you science when you achieved something?

I had changed it so that it would give reputation instead. Don't know if malkuth removed that, though.

Share this post


Link to post
Share on other sites
I had changed it so that it would give reputation instead. Don't know if malkuth removed that, though.

That actually makes a lot more sense than rewarding funds

Share this post


Link to post
Share on other sites
I had changed it so that it would give reputation instead. Don't know if malkuth removed that, though.

That has not changed. :).

Share this post


Link to post
Share on other sites
Is it normal not to be able to activate the toolbar button in the space center scene?? I can access it anywhere else but it doesnt show up on blizzys toolbar in the space center scene even though I have it selected to be visible.

Yes, not sure why this is the case. Not asked blizzy about it yet.

I might add it back and see what happens.

Share this post


Link to post
Share on other sites
Is it normal not to be able to activate the toolbar button in the space center scene?? I can access it anywhere else but it doesnt show up on blizzys toolbar in the space center scene even though I have it selected to be visible.

I've removed it from the space center scene because the window would not behave there. Nothing to do with the Toolbar itself, though.

Share this post


Link to post
Share on other sites
This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.