Apparently, my new mod is almost finished, except for the custom damage formula.
I added a few more rules to the thing and it become a mess. If only I know for detail how CS2D damage is calculated, it would be easier.
Basically the rule is like this:
-In zombie mode if the player is a survivor:
+If attacker successfully roll a critical hit, the raw damage will double
+If attacker's weapon have bonus damage, it will add that bonus damage percentage to his raw damage
+If attacker's status effect include another bonus damage, it will also added as above
+If victim is not a zombie, he/she will have an armor value from 0% to 95%. But on top of that is the Kevlar layer. Whenever they get hit, the Kevlar took normal damage, and the armor value will absorb the remain damage penetrated the Kevlar.
+Zombie have no such skill so they don't get bonus damage or damage reduction except the damage taken reduction they get form server setting. But they still have to take extra damage form survivor attacker's skill/stats effects.
-Thing I have to consider:
+How the extra raw damage should be added?
+What should be implemented if victim is wearing Kevlar?
+What should be implemented if victim is wearing special armor?
+What should be implemented if victim is a zombie?
+What should be implemented if victim is not a zombie?
If I can't solve all of this in a week. I will properly have to scrap the idea of extra damage and add something else to the content.
So far the formula works when zombie attack survivor. However, in the reverse case, the zombie take no noticeable damage.
I haven't tested what happen when survivor attack survivor though.
Here's my code for the damage application - sorry for the long and boring text, if you don't feel like reading it, please help me learn the damage formular:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
function zf_damage(victim, source, weapon, rawdamage)
	local health = player(victim,"health")
	local armor = player(victim,"armor")
	local dmg_reduction
	local zombie_damage_taken
	
	--if zf_skill_resist(victim) check is true (by percentage), ignore the damage from molotov and gas grenade
	if(weapon == 73 or weapon == 72) then
		return zf_skill_resist(victim)
	end
	
	--skill check for survivors
	if(not_zombie(source)) then
		--roll for dodge chance
		if(zf_skill_dodge(victim)) then return 1 end --if dodge succesful, ignore the damage
		
		--weapon damage modify
		rawdamage = rawdamage + rawdamage * zf_skill_weapon_damage_plus_check(source) /100 --extra damage from skill by percentage
		--critical damage modify
		if(zf_skill_critcal_check(source)) then --if critcal check works, double the rawdamage
			rawdamage = rawdamage * 2
			zf_gfx_hit_indicate(player(victim,"x"),player(victim,"y"),1) --pop the hud text at the victim to show everyone that he got a critical hit
		else
		
			rawdamage = rawdamage * ((rawdamage / 100) * zf_player_damage_boost[source]) --there a hidden value which boost damage by a percentage
		end
		
		local health = player(victim,"health") --get the player health and determine whenever or not they survive the extra damage
		health = health - zf_player_damage_boost[source] / 10
		if(health > 0) then
			parse("sethealth "..victim.." "..health)
		elseif(health == 0) then
			parse("customkil "..source.." Beserk "..victim)
		end
	end
	
	if(not_zombie(victim) ~= true) then --add the zomble damage reduction form the server setting
		zombie_damage_taken = game("mp_zombiedmg")
		
		rawdamage = rawdamage * zombie_damage_taken
	end
	
	if(armor <= 200) then --if the victim wearing kevlar
		--attempting to calculate the armor damage and the rawdamage reduction by armor
		local temp = rawdamage
	
		rawdamage = rawdamage - armor * kevlarDmgReduction
		armor = armor - temp
		
		if(rawdamage < 0) then rawdamage = 0 end
		
		if(armor < 0) then armor = 0 end
		if(not_zombie(victim)) then --if victim is not a zombie
			if(zf_player_level[victim] > 0 and player(victim,"bot") ~= true) then --if the victim have armor value beneath the kevlar is not a bot
				dmg_reduction = zf_player_stats_armor[victim] + zf_survivor_armor[zf_player_class_survivor[victim]]
				temp = rawdamage / 100
				temp = temp * dmg_reduction
				rawdamage = rawdamage - temp
			elseif(zf_player_level[victim] == 0 and player(victim,"bot") ~= true) then --if the victim have no armor value beneath the kevlar
				return 0
			elseif(player(victim,"bot")) then --if the victim have armor value beneath the kevlar and is a bot
				dmg_reduction = zf_player_stats_armor[victim] + zf_survivor_armor[zf_player_class_survivor[victim]]
				temp = rawdamage / 100
				temp = temp * dmg_reduction
				rawdamage = rawdamage - temp
			end
		else --if the victim is a zombie
			local extradamage = ((rawdamage / 100) * zf_player_damage_boost[source]+ rawdamage * zf_skill_weapon_damage_plus_check(source) /100) * zombie_damage_taken
			
			local critical_dmg = 0
			if(zf_skill_critcal_check(source)) then
				local critical_dmg = rawdamage * zombie_damage_taken
			end
			
			health = health - extradamage - critical_dmg
			
			if(health <= 0) then
				parse("customkill "..source.." "..zf_gfx_dead_get(weapon).." "..victim)
			else
				parse("setarmor "..victim.." "..armor)
				parse("sethealth "..victim.." "..health)
			end
			
			return 0
		end
		
		--PERFORM THE DAMAGE
		health = health - rawdamage
		
		if(health <= 0) then
			parse("customkill "..source.." "..zf_gfx_dead_get(weapon).." "..victim)
		else
			parse("setarmor "..victim.." "..armor)
			parse("sethealth "..victim.." "..health)
		end
		
		zf_hud2_pop(source,1000,4,(rawdamage.." DMG"),423,243,0,0,16)
		return 1
	else --IF ZOMBIE IS WEARING SPECIAL ARMOR (HAVEN'T TESTED YET)
		if(not_zombie(victim)) then
			return 0
		else
			local extradamage = ((rawdamage / 100) * zf_player_damage_boost[source]+ rawdamage * zf_skill_weapon_damage_plus_check(source) /100) * zombie_damage_taken
			local armor_dmg_reduction = zf_size_armor_dmgReduction[zf_zombie_armor[zf_player_class_zombie[victim]] - 199]
			extradamage = extradamage * armor_dmg_reduction
			
			local critical_dmg = 0
			if(zf_skill_critcal_check(source)) then
				local critical_dmg = rawdamage * zombie_damage_taken
			end
			
			health = health - extradamage - critical_dmg
			
			if(health <= 0) then
				parse("customkill "..source.." "..zf_gfx_dead_get(weapon).." "..victim)
			else
				parse("sethealth "..victim.." "..health)
			end
		end
		
		return 0
	end
end
Custom damage
1 
Offline
set D to raw damage which is inflicted by hit
DC
Please notice that: