Code Monkey home page Code Monkey logo

psychengine-lua-achievements's Introduction

PSYCH ENGINE 0.6.1+ REQUIRED!!

hi what is this

psych engine lua achievements: what the devs could never do

how add achievement1!?1?1?1?1?1?1!!!?1?1?!1!?

in your mod's folder (so PsychEngine/mods/Your Mod), make a folder called achievements

then make a file called achievements.txt

the file follows this format:

Name|Image/Save Data Tag|Description|Hidden (true/false)

each line is another achievement

you can name everything whatever you want except for hidden, which is either true or false

if hidden is true, the achievement will not be visible until you unlock it

images time

now, make a folder in images, also called achievements

inside this folder, you can make an image file and name it the same as the tag you put into achievements.txt

if you need a base for your image, you can use this template.

now you've made an achievement, and-

image

oh. right. it's locked.

unlocking achievements

to unlock an achievement, use callOnLuas('unlockAchievement', {"achievement-tag", getPropertyFromClass('Paths', 'currentModDirectory'), false})

if you want to unlock an achievement at the end of a song, use this template

and boom, your achievement should be unlocked!

image

psychengine-lua-achievements's People

Contributors

8bitosc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

psychengine-lua-achievements's Issues

Achievements Don't Show

Hey! I've been waiting for something like this for a LONG time. Sadly though when I put the entire mod into my MODS folder for psych (PsychEngine/Mods) the awards song doesn't do anything. I go to freeplay and hit awards and everything shows except the achievements. I went into the code and saw it was also supposed to play music which that isn't working either. Sorry to be a bother!

No actual issue here, just wanted to share something

So, I think the code for unlocking an achievement at the end of the song says that only one can be unlocked at once.
However, I've discovered a way to get past that.

local allowEnd = false

function onEndSong()
    if (not botPlay) then
        if (not allowEnd) then
            setProperty('inCutscene', true);
			callOnLuas('unlockAchievement', {"achievement-tag", getPropertyFromClass('Paths', 'currentModDirectory'), false})
			runTimer('checkForFC', 4)
            return Function_Stop;
        end
    end
    return Function_Continue;
end

function onTimerCompleted(tag, loops, loopsLeft)
	if tag == 'checkForFC' then
		allowEnd = true;
		if (misses == 0) then
			callOnLuas('unlockAchievement', {"achievement-tag-2", getPropertyFromClass('Paths', 'currentModDirectory'), false})
			runTimer('endSongFromAchievement', 4) --Delete this line if you have end song dialogue
		else --Delete this line if you have end song dialogue
			endSong() --Delete this line if you have end song dialogue
		end
	end
    if tag == 'endSongFromAchievement' then --Delete this line if you have end song dialogue
        endSong() --Delete this line if you have end song dialogue
    end --Delete this line if you have end song dialogue
end

This basically gives the player the achievement for beating the song (you can change the conditions if needed), checks if it's an FC, and if it is, then that achievement is given too.

Theoretically, for more achievements, you'd need more timers. I haven't tested that part yet.

Incorrect Documentation

Contrary to what is written in the documentation, the custom achievements only show up for me if I add my achievements into mods/awards/achievements/achievements.txt, and not mods/[mod]/achievements/achievements.txt.

I'm not sure if they're connected, but I also cannot unlock any of my achievements with the code provided.

I've even deleted the mods/[mod]/achievements folder, and they show up when in mods/awards/achievements

Large achievement list

I've got a huge achievement list for my mod, and the icons go off-screen. Is there a way to add implementation for a thing where the awards menu scrolls down?

Other Songs have the Achievements menu

First of all, thank you for making this! It's awesome and I added an achievement for beating one of my songs, which shows in the menu!
I then wanted to play that song, but when I pressed enter to start the song, the achievements menu music was playing, and it played during the countdown. When the music of the song started, the achievements menu music stopped.
And, if we don't include the bg, all of the menu assets were here, and worked. I could switch achievements by pressing left and right, and it even made the sound effect.
image_2022-08-02_134850455
Song was still playing completely fine behind that and I could still control the notes. I then tried launching another song, Bonedoggle Psych Port.
This song worked as intended, no music or menu assets of the achievements menu were here. I then realised that the Bonedoggle chart is in mods\BONES\data\bonedoggle\bonedoggle.json, as the Nightmare Cup song (the first song I talked about, the first screenshot) was in mods\data\nightmare-cup\nightmare-cup-150cc.json (custom difficulty for the song)

After that, I tried other songs in main mods folder, and in their own, and came with the same relusts ; main mods folder do that, as those in their own folder work perfectly fine
I asked myself what would happen if I played a song from the OG game, and when I played Week 5, it did the same thing as in Nightmare Cup or any other main mods folder song

This is a screenshot of a song with classic difficulties on notmal and it still does the thing
image_2022-08-02_135349248

Quick question

So I managed to get it working by putting it in my mod's folder and changing up a few things in the code. Even fixed the achievement list problem. Now I'm wondering if there's a way to reset achievements. Is there? It's perfectly fine if there isn't btw

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.