English Achievements v1.0 icon

8 comments
13.11.13 11:50:42 am
like 7 like it!
4 kb, 113 Downloads
MikuAuahDark
User
Offline Off
Achievements script by user MikuAuahDark

∗ Table of Contents ∗
1. Table of Contents
2. Description
3. Features
4. How to Install
5. Reserved Global Variables
6. Configuration
7. Limitations
8. Information
9. Addtional Information
10. Bit Code
11. More Achievements
12. Functions
13. Notes
14. Rules
15. Another MikuAuahDark Scripts

∗ Description ∗
This LUA allows you to add a mission-like script. So it's similar of this file cs2d Mission system V.0.1 (3) lua, but this LUA is better. Because you can simply add new achievements

∗ Features ∗
• Can trigger on 32 events/hooks
• Stand-alone functions
• file cs2d table.uneval (6)
• Events/Hooks are bit encoded
• Can save/load achievements progress
• Just the functions, you need to integrate it to your scripts
• Easy to add new achievements

∗ How to Install ∗
° It's different than another scripts °
1. Extract only achievements.txt to desired folder
2. Edit your code(NOT the achievements.txt) so it integrated to the script. Check achievements_int.txt for more information to link it
3. Make sure that the integrated code is loaded on server start. Add it to dofile list at server.lua
4. Run the script

∗ Reserved Global Variables ∗
• Achievements
• HOOK_*
• SaveDir
• DefaultSuccessMessage
• Unsigned_4
• BitEnc_4
• DiscoverActualName(*)
• OR
• AND
(*) - This function is used internally for achievement script. Don't use it for your another scripts

∗ Configuration ∗
Configuration variable is located at achievements.txt
> SaveDir - Save directory, where the player achievements status should be saved. Default is sys/lua/achievements
> DefaultSuccessMessage - Default success message that shown when specific achievements is complete. Default is Achievement '%s' complete!

∗ Limitations ∗
• You can't know if the specific achievements is complete without hardcoding the complete limit

∗ Information ∗
> Hooks: depending on achievements list(max 32)
> Size(achievements.txt): 7574 bytes

∗ Addtional Information ∗
This LUA Uses a bitwise system for the hook system. See Bit Code below
You can add more achievements by just using table.insert. See More Achievements below

∗ Bit Code ∗
This LUA uses a bitwise system to do some work, specially for the hook system. It only create new hook and function if the hook is not added.
List of Bit Code of Hooks >


∗ More Achievements ∗
Here is the format of the achievements
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
table.insert(Achievements.List,{     -- Simply use table.insert to Achievements.List table
     Name="Achievement Name",
     Desc="Achievement Description",
     Success="Message that shown when achievement is done",
     Variable="Table_name_to_use",
     CounterVariable="Variable_name_to_used_on_Variable",
     DefaultValue="Default value of CounterVariable",
     Used_Hooks=HOOK_BIT_VALUE, -- To use hook join, leave, and kill, then the value is "HOOK_KILL+HOOK_JOIN+HOOK_LEAVE"(without quotes)
     Hooks={
          -- This is list of function to executed when specific event/hooks is triggered
          -- For example, we are using "HOOK_ATTACK and HOOK_DIE" on this achievements
          -- NOTE that the function doesn't handle return values.
          [HOOK_ATTACK]=function(aid,id)     -- The first parameter is always the achievement ID itself, to used on "Achievements.Functions.Done(aid,id)" function. The rest of the parameter is hook-specific
               -- Do something
          end,
          [HOOK_KILL]=function(aid,id,pl,wpn,x,y)     -- Remember, the first parameter always the achievement id itself.
               -- Do something
          end,
     }
}

More example can you found on achievements.txt and achievements_int.txt

∗ Functions ∗
> Achievements.Functions.Init()
> • Info: It initialize all achievement system, also this function is returned by calling dofile to this lua
> ∗ Returns: none
> Achievements.Functions.List(id{number})
> • Info: Returns list of message about the current player achievements.
> • Parameters:
> • id - The player ID that you want to see the achievement status
> ∗ Returns: List of message that have this index: [1]=Achievement name, [2]=Achievement Description{table}
> Achievements.Functions.Save(id{number})
> • Info: Save player achievements status
> • Note: Anything is handled by the function so just call it without any USGN>0 checks
> • Parameters:
> • id - The player ID that you want to save
> ∗ Returns: none
> Achievements.Functions.Load(id{number})
> • Info: Load player achievement status
> • Note: Anything is handled by the function so just call it without any USGN>0 checks
> • Parameters:
> • id - Player id that gonna load the achievement status
> ∗ Returns: none
> Achievements.Functions.Done(aid{number},id{number})
> • Info: Show the complete message and save
> • Note: Calling this function always calling Achievements.Functions.Save function
> • Parameters:
> • aid - The achievement ID. It's always the first parameter on event functions.
> • id - The player ID who complete the achievement
> ∗ Returns: none

∗ Notes ∗
1. You should know it. The first place is always about feedbacks, bugs, post at comments.
2. It may need to set specific variable to allows it able to detecting if specific achievement is complete.
3. achievements_int.txt contains two example achievements. That file just used for testing only.

∗ Rules ∗
√ You can use it for your server
√ You can edit it. Edit with your own risk
√ You can upload at another website, say user MikuAuahDark made it
× You can't say this is yours
× You can't upload on another website without put me on credits

∗ Version History ∗
> V1.0
> > ADDED Initial Release

∗ Another MikuAuahDark Scripts
> file cs2d Timer Extra function(timerEx) v4.0 (12)
> file cs2d [UNUSED] Get Player Rank v1.4 (14)
> file cs2d Weapon Hudtxt v1.0 (7)
> file cs2d Animated Image v2.0 (5)
image
ok This file has been reviewed and approved by Seekay (04.12.15 01:08:28 pm)

Comments

8 comments
Goto Page
To the start Previous 1 Next To the start

Log in!

You need to log in to be able to write comments!Log in
01.03.14 06:37:41 am
like I like it!
Up
-RZ-
User
Offline Off
Ok, take my like. õ/ √
03.01.14 02:39:29 pm
like I like it!
Up
Loli-
User
Offline Off
Nice achievements lua,easier to edit and use, better than achievements from file cs2d EngiN33R's TF2 mod (BETA 3.3.1) (87):
16.11.13 09:37:20 am
like I like it!
Up
Ace Howl
User
Offline Off
This is the script I want.
15.11.13 03:03:01 pm
like I like it!
Up
71
COMMUNITY BANNED
Offline Off
You have most biggest description for every file I have ever seen
Well, that's not the main point, good job!
14.11.13 08:12:39 pm
like I like it!
Up
Avo
User
Offline Off
Seriously, use more-tags, please.

Btw, reminds me file cs2d Quest System v2.0 (23). Anyway, good piece of code, and what's very important - it's easy to add custom achievments.
13.11.13 12:59:17 pm
like I like it!
Up
Joni And Friends
User
Offline Off
hahaha... lol
edited 1×, last 13.11.13 01:13:12 pm
13.11.13 12:58:37 pm
like I like it!
Up
hacked
User
Offline Off
Mother of description.
13.11.13 12:33:44 pm
like I like it!
Up
Joni And Friends
User
Offline Off
need to trying it
To the start Previous 1 Next To the start