[SOLVED] [ACS] Achievement/reward system is borked

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
User avatar
MFG38
Posts: 414
Joined: Sun Apr 14, 2019 8:26 am
Graphics Processor: nVidia (Modern GZDoom)
Location: Finland
Contact:

[SOLVED] [ACS] Achievement/reward system is borked

Post by MFG38 »

Over the past couple days, I've been trying to program a "feat" system in ACS for a gameplay mod I started developing the other day. Essentially, upon having killed a certain number of a specific enemy, the player would unlock an achievement of sorts and get a reward. For the sake of avoiding clutter in the script itself, it uses a switch/case structure, which admittedly may already be making it harder than it needs to be.

Anyway, I've made about a dozen different versions of the script at this point, but none of them seem to work. I even programmed in a rudimentary debugging system, and judging by the few tests I ran with it, the script that "tracks" the "achievements" never gets activated. I did manage to compile it without errors (after some time and effort), and it is being loaded by a LOADACS lump, but it just doesn't do anything. And I'm running out of ideas as to what I could be doing wrong.

See attached PK3 for the latest version of the system.
Attachments
featsys.pk3
(4.85 KiB) Downloaded 36 times
Last edited by MFG38 on Wed Jun 12, 2019 2:09 pm, edited 1 time in total.
Blue Shadow
Posts: 4949
Joined: Sun Nov 14, 2010 12:59 am

Re: [ACS] Achievement/reward system is borked

Post by Blue Shadow »

You need to make sure the player and killed monster are running the scripts and functions they're meant to run. For example, it's the monster that calls PlayerNumber() function in the FeatChecker script, not the player.
User avatar
MFG38
Posts: 414
Joined: Sun Apr 14, 2019 8:26 am
Graphics Processor: nVidia (Modern GZDoom)
Location: Finland
Contact:

Re: [SOLVED] [ACS] Achievement/reward system is borked

Post by MFG38 »

So I managed to make it work by editing the FeatTracker script slightly and making it loop in a weapon's Ready state. Might not be the cheapest method resource-wise, but it works, so whatever.
Post Reply

Return to “Scripting”