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 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
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.
More Achievements
Here is the format of the achievements
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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, 	} }
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 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
Initial Release
Another MikuAuahDark Scripts
Timer Extra function(timerEx) v4.0 (12)
[UNUSED] Get Player Rank v1.4 (14)
Weapon Hudtxt v1.0 (7)
Animated Image v2.0 (5)
Approved by Seekay
Download
4 kb, 445 Downloads