I wasn't sure if i should release this because this tutorial might look a bit complicated, and i'm not sure if people even want to add this to their maps.. But in the end it's really easy to use and i had it laying around anyways, so i decided to post this. Just read carefully step by step and i hope it's understandable. Adding your own achievements just takes 2 or 3 lines of code after you followed this tut!
This script will allow you to put achievements in your map, their stats will save between games. For example when you add an achievement: "Kill 100 zombies" and a player gets 75 kills, then dies and starts a new game and get 25 kills he will earn the achievement. When a player unlocks an achievement a message shows up on screen, and you can choose to also have an icon appear, a sound play, and have points rewarded.
You can add your own achievements for your map pretty simple, anything like 'Kill X amount of zombies' or 'Kill a boss without jugg' or 'Open 50 doors' or whatever you want. For now the player will just get the message on screen once, and it will be "unlocked". There's no menu to view your achievements or anything like that ( yet, might do it depending on if people actually use this.. )
1. Lets get started, first download the files and put them in the correct folder. One goes into your \RAW\mp\ folder, and the other in your \MODS\mapname\maps\ folder.
2. Open your _zombiemode.gsc and around line 60-70 you'll see similar line's, add this one:
3. to include the stringtable-csv in your mod, add this line to the mod.csv in your mod-builder-tab on launcher;
4. if you want to use (custom) shaders for the achievement-notify's, add the materials to a .csv and make sure the images are included in your mod! They will be precached automaticly by the script, so no need to worry about that.
5. Now how to setup you own achievements: note: i left two examples in the files so its easier to understand. You can just remove / change those as you wish.
First a short explanation to clear things up: You can add multiple 'levels' for one achievement, for example you can add one for killing 10 zombies and then also one for killing 25 zombies. Obviously those are 'the same' achievement( ...they are related to the same stat -> zombie kills ) so to tell the game they are the same stat but a different achievement you'll need to add two 'names' for each achievement you add. One is called the 'name' and the other the 'ref'! * The achievement NAME, wich should be the same for all achievements that relate to the same stat! So in the example above both could be named: kills_all * The achievement REF, wich should be different for all achievements! so in the example above it could be: kills_all_1 and kills_all_2
Make sure you pay attention to that, then adding achievements is going to be easy
6. Open the file you copied to raw\mp\ named: my_achievements.csv it basicly works the same as a soundalias. This just stores stuff like strings. You need to add every achievement you want to use in your map here. this is an example of a line from that file:
In the following order ( the bold text between the braces refers to the example line above ) 0. Index ( 1 ) 1. Achievement NAME ( see explanation in the previous step ) ( kills_all ) 2. Achievement REF ( see explanation in the previous step ) ( kills_all_1 ) 3. Achievement description: The line that will show up on screen once the player unlocks the achievement, if you dont want a this fill in: none ( Kill 10 zombies ) 4. Stat number: ( 2105 )THIS ONE IS IMPORTANT: there's a few rules to follow with these You make up the numbers yourself, but keep these rules: - start counting from 2100 - increase by 5, so go from 2100 to 2105 to 2110 etc - each achievement that has the same achievement NAME should have the same stat number ( ...they are related to the same stat! ) 5. The amount needed to complete this achievement, so in the example: Kill 10 zombies. The amount will be 10. ( 10 ) 6. If you want the players to recieve points for unlocking this achievement, add the amount of points here. Otherwise fill in: none ( 250 ) 7. If you want a shader to appear on screen for this achievement add it here ( the material name ). Otherwise fill in: none ( specialty_juggernaut_zombies )
7. Next open the _blst_achievements.gsc, at the top you'll see the line's to setup the achievements. If you want a sound to play when a player unlocks an achievement, change it in this line:
Next to tell the script wich achievements to add, copy this line once for every achievement you added, and edit it: Fill in the correct achievement REF for every achievement you want to add ( "kills_all_1" in the example below )
8.
That's everything to setup the script, but now comes the hard part. You need to make the game keep track of the achievements you added. For example if you add an achievement 'Use the mystery box 5 times' you need to edit the box-script, and make the game count the stats. You can do that by adding the following line in a script:
In this line 'self' is the player! You need to fill in the correct achievement NAME ( not ref! ). The '1' tells the game to add 1 to the stat. It will automaticly check for achievement-unlocks every time you use that line so no need to add anything else.
For some people this will be the hard part to figure out, i'll try to help out if needed in the topic below. In the download i allready made the 'zombie kills' achievement work, the one for opening doors does not work! It's just an example!! If you want to make that work, you need to add the line mentioned above in _zombiemode_blockers_new for each door/debris trigger.
Last thing, in the _blst_achievements.gsc there's one level. var at the top called: level.map_testing If you set that to true, it will use prints to display your current stats so you can easily test stuff, and at game start you have the option to reset your stats.
Last Edit: May 12, 2016, 10:02:49 pm by BluntStuffy
Nice man. I love the idea of growing progress when you play. I'd like to be rewarded for continually playing a map, say better or upgraded starting pistol, or start with qr or jug, or something like that after 5000 kills or something. Maybe a perk you only get by getting the achievement like half price everything... or something that once you get it you use it every game like another player... Anyway, awesome job as always!
Maybe I'll add it and give an upgraded pistol to players at start for like 5000 or 10000 kills, or beating the map on hard or something...
Last Edit: April 28, 2016, 09:24:08 pm by MakeCents
Nice man. I love the idea of growing progress when you play. I'd like to be rewarded for continually playing a map, say better or upgraded starting pistol, or start with qr or jug, or something like that after 5000 kills or something. Maybe a perk you only get by getting the achievement like half price everything... or something that once you get it you use it every game like another player... Anyway, awesome job as always!
Maybe I'll add it and give an upgraded pistol to players at start for like 5000 or 10000 kills, or beating the map on hard or something...
Those are pretty sweet ideas, and way more rewarding for the players then just some points. Would be cool to have some of these achievements in a map!
Awesome tut man! I am sure I will find some good use for this in the future!
Thanks man, not sure if people will find this worth the trouble but if you make up some rewards like MC mentioned it's way cooler allready i suppose. Hope it comes in handy at some point
Some ideas I have include possibly rewarding players for using a certain gun for x rouns, or x rounds over x round, like if the player keeps the Magnum over Round 20 and uses it for 5-10 rounds, it'll be their starting pistol from now on, and maybe getting x pick ups of Vulture Aid ammo rewards them with temporary infinite ammo or something like that.
Some ideas I have include possibly rewarding players for using a certain gun for x rouns, or x rounds over x round, like if the player keeps the Magnum over Round 20 and uses it for 5-10 rounds, it'll be their starting pistol from now on, and maybe getting x pick ups of Vulture Aid ammo rewards them with temporary infinite ammo or something like that.
That sounds like a really cool idea.
There are so many possibilities people can do with these achievements
Last Edit: April 29, 2016, 09:48:03 pm by thezombiekilla6
great stuff man. ik the acheivements can be "saved" when restarting the map. But what about when you quit out of the game to the desktop, then reload waw/map. will they still remain? Double Post Merge: April 13, 2021, 01:17:39 am sorry to be a pain but do you think you could add a "remove_from_stat" func? and im not referring to the reset func. my stats will be fluctuating throughout the game so as you have already scripted a "add_to_stat" func, i need a "deduct_from_stat" func.
EDIT: nvm i realised i could deduct through the add func aha
EDIT2: great stuff for releasing this mod man you're a life saver!
I'll be changing the shaders to the WAW ranking icons/shaders of course. And i might edit the kills and stuff, gotta do some tweaking.
I also went into your script in *_blst_achievements.gsc* and changed the "Challenge complete" setText to "Rank up:" instead.
Now my map seems like it has an actual progression/ranking system that saves between games, i added it since some people enjoy playing with it because it adds a bit of replayability.
I'll be sure to credit you when i publish the map
Although, i wish it would show it some how on the hud what "rank" you are. Maybe i can find how to. and edit your script and do it:thumbsup-smiley: