Forum

> > CS2D > Scripts > Custom damage
Forums overviewCS2D overview Scripts overviewLog in to reply

English Custom damage

8 replies
To the start Previous 1 Next To the start

old Custom damage

FishyFinThing
User Off Offline

Quote
Hi everyone!

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
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

old Re: Custom damage

DC
Admin Off Offline

Quote
CS2D damage calculation works like this with D = inflicted damage. Note that health is subtracted twice in two different ways when someone wears kevlar armor.

• set D to raw damage which is inflicted by hit
• if victim is a zombie: D * cs2d cmd mp_zombiedmg
• if victim has special armor: D * (100 - special armor value)/100 (e.g. D * 0.75 for light armor or D * 0.05 for super armor)
• if victim has kevlar points (for A 1-200):
     • ArmorCover = Min(Armor, D)
     • Armor = Armor - ArmorCover
     • Health = Health - ArmorCover * (1 - cs2d cmd mp_kevlar)
     • D = D - ArmorCover
• Health = Health - D

Moreover if multiple players are hit by a shot, you also have to take cs2d cmd mp_shotweakening into account.

... and I just found out that I explained the kevlar related damage calculation in the reference for cs2d cmd mp_kevlar.

Edit:
Now also extended the cs2d lua hook hit documentation with damage calculation information.
edited 1×, last 24.11.19 04:47:20 pm

old Re: Custom damage

FishyFinThing
User Off Offline

Quote
Thank you user DC!
I will probably trying to fix my code after the weekend.
Let's hope there is no more problem about this.

P/s: How do I know when multiple players got hit?
edited 1×, last 24.11.19 07:40:56 pm

old Re: Custom damage

FishyFinThing
User Off Offline

Quote
Maybe I will do like this:
Set hook attack1 to check if weapon is gun.
Then set hook hit to check how many people got hit if gun is true.
Then get the distance between victims and attacker.
The closest one get hit will take the most damage, then decrease as it go further.
Apply damage.
Then when attack1 hook is triggered again. Reset all damage reduction and hit list before return to step 1

But i don't know how the system works to find how many people got hit in order.

old Re: Custom damage

DC
Admin Off Offline

Quote
@user FishyFinThing: Your approach is correct but it can be simplified

• introduce a global var HitCounter
• on cs2d lua hook attack set HitCounter = 0
• on cs2d lua hook hit increase HitCounter by 1
• now you can use HitCounter to see how many players have been hit by a shot already

All hit hooks are executed in the right order so you don't have to check the order manually by doing distance checks or whatever.

Note however that this simplified approach doesn't take NPCs/hostages/Lua hitzones into account.

And yes, maybe it's safer to still have the gun check you mentioned

old Re: Custom damage

FishyFinThing
User Off Offline

Quote
Thank you again user DC !

I posted the basic damage calculation raw code here just in case someone needed.

° Please notice that:
I didn't set hook on for this code and also the gun check function is_gun is not implemented yet.
also, for some reason my code include the header zf_ . Please remove it if you don't need.

Also, if I did something wrong please give me feedback.

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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
function zf_damage_basic(victim, source, rawdamage, weapon) --basic damage calculation function.
	local damage = rawdamage --damage taken
	local armor = player(victim, "armor") --victim's armor value
	local health = player(victim, "health") --victim's health
	local shotweakening_factor = 1 --shot weakening factor
	local shotweakening = game("mp_shotweakening") --shot weakening factor setting
	
	--if victim is zombie, reduce damage taken base on the game setting
	if(player(victim,"team") == 1 and game("sv_gamemode") == 1) then
		local zombie_damage_taken = game("mp_zombiedmg") --zombie damage taken factor
		damage = damage * zombie_damage_taken
	end
	
	--if victim is wearing special armor, get special armor damage reduction
	if(armor > 200) then
		damage = damage * zf_get_armor_damage_reduction(armor)
	--if victim is wearing kevlar, calculate armor damage and health damage
	else
		local armorCover = math.min(armor, damage)
		armor = armor - armorCover
		health = health - armorCover * (1 - game("mp_kevlar"))
		
		damage = damage - armorCover
	end
	
	--apply shot weakening if victim is not the first to get hit by an attacker's gun
	if(player(source,"exists")) then --check if the attacker is a player (turret excluded)
		if(zf_player_hitcounter[source] > 0 and is_gun(weapon)) then
			for i = 1, zf_player_hitcounter[source] do
				shotweakening_factor = shotweakening_factor * (1 - shotweakening)
			end
		end
		--increase player hit counter (make sure to set this to 0 on attack 1 hook when attacker use attack 1)
	zf_player_hitcounter[source] = zf_player_hitcounter[source] + 1
	end
	
	--apply health damage
	health = health - damage * shotweakening_factor
	
	--set health after the application
	if(health > 0) then
		parse("setarmor "..victim.." "..armor)
		parse("sethealth "..victim.." "..health)
	else
		parse("customkill "..source.." "..zf_gfx_dead_get(weapon).." "..victim)
	end
	
	--return 1 after calling this function on hook hit
	--make sure let the hook return this return value to prevent default damage calculation
	return 1
end

------------------------------------
-- OTHER DAMAGE RELATED FUNCTIONS --
------------------------------------
--get special armor damage reduction
function zf_get_armor_damage_reduction(armor)
	if(armorID == 201) then
		return 0.75
	elseif(armorID == 202) then
		return 0.5
	elseif(armorID == 203) then
		return 0.25
	elseif(armorID == 204) then
		return 0.5
	elseif(armorID == 205) then
		return 0.05
	elseif(armorID == 206) then
		return 1
	else
		return nil
	end
end

--DEAD ICON
zf_gfx_dead_usp				= "USP,gfx/weapons/usp_k.bmp"
zf_gfx_dead_glock			= "Glock,gfx/weapons/glock_k.bmp"
zf_gfx_dead_deagle			= "Deagle,gfx/weapons/deagle_k.bmp"
zf_gfx_dead_p228			= "P228,gfx/weapons/p228_k.bmp"
zf_gfx_dead_elite			= "Elite,gfx/weapons/elite_k.bmp"
zf_gfx_dead_fiveseven		= "Five-Seven,gfx/weapons/fiveseven_k.bmp"
zf_gfx_dead_m3				= "M3,gfx/weapons/m3_k.bmp"
zf_gfx_dead_xm1014			= "XM1014,gfx/weapons/xm1014_k.bmp"
zf_gfx_dead_mp5				= "MP5,gfx/weapons/mp5_k.bmp"
zf_gfx_dead_tmp				= "TMP,gfx/weapons/tmp_k.bmp"
zf_gfx_dead_p90				= "P90,gfx/weapons/p90_k.bmp"
zf_gfx_dead_mac10			= "MAC10,gfx/weapons/mac10_k.bmp"
zf_gfx_dead_ump45			= "UMP45,gfx/weapons/ump45_k.bmp"
zf_gfx_dead_ak47			= "AK-47,gfx/weapons/ak47_k.bmp"
zf_gfx_dead_sg552			= "SG552,gfx/weapons/sg552_k.bmp"
zf_gfx_dead_m4a1			= "M4A1,gfx/weapons/m4a1_k.bmp"
zf_gfx_dead_aug				= "Aug,gfx/weapons/aug_k.bmp"
zf_gfx_dead_scout			= "Scout,gfx/weapons/scout_k.bmp"
zf_gfx_dead_awp				= "AWP,gfx/weapons/awp_k.bmp"
zf_gfx_dead_g3sg1			= "G3SG1,gfx/weapons/g3sg1_k.bmp"
zf_gfx_dead_sg550			= "SG550,gfx/weapons/sg550_k.bmp"
zf_gfx_dead_galil			= "Galil,gfx/weapons/galil_k.bmp"
zf_gfx_dead_famas			= "Famas,gfx/weapons/famas_k.bmp"
zf_gfx_dead_fnf2000			= "FNF2000,gfx/weapons/fnf2000_k.bmp"
zf_gfx_dead_m249			= "M249,gfx/weapons/m249_k.bmp"
zf_gfx_dead_laser			= "Laser,gfx/weapons/laser_k.bmp"
zf_gfx_dead_flamethrower	= "Flamethrower,gfx/weapons/flamethrower_k.bmp"
zf_gfx_dead_rpglauncer		= "RPGLauncher,gfx/weapons/rpglauncher_k.bmp"
zf_gfx_dead_rocketlauncher	= "RocketLauncher,gfx/weapons/rocketlauncher_k.bmp"
zf_gfx_dead_grenadelauncher	= "GrenadeLauncher,gfx/weapons/grenadelauncher_k.bmp"
zf_gfx_dead_m134			= "M134,gfx/weapons/m134_k.bmp"
zf_gfx_dead_knife			= "Knife,gfx/weapons/knife_k.bmp"
zf_gfx_dead_machete			= "Machete,gfx/weapons/machete_k.bmp"
zf_gfx_dead_wrench			= "Wrench,gfx/weapons/wrench_k.bmp"
zf_gfx_dead_claw			= "Claw,gfx/weapons/claw_k.bmp"
zf_gfx_dead_chainsaw		= "Chainsaw,gfx/weapons/chainsaw_k.bmp"
zf_gfx_dead_he				= "HE,gfx/weapons/he_k.bmp"
zf_gfx_dead_gasgrenade		= "Gas Grenade,gfx/weapons/gasgrenade_k.bmp"
zf_gfx_dead_molotov			= "Molotov,gfx/weapons/molotovcocktail_k.bmp"
zf_gfx_dead_snowball		= "Snowball,gfx/weapons/snowball_k.bmp"
zf_gfx_dead_airstrike		= "AirStrike,gfx/weapons/airstrike_k.bmp"
zf_gfx_dead_gutbomb			= "GutBomb,gfx/weapons/gutbomb_k.bmp"
zf_gfx_dead_satchelcharge	= "Satchel Charge,gfx/weapons/.bmp"
zf_gfx_dead_mine			= "Mine,gfx/weapons/mine_k.bmp"
zf_gfx_dead_lasermine		= "LaserMine,gfx/weapons/lasermine_k.bmp"

zf_gfx_dead_entities		= "Environment"

zf_gfx_dead_deadly 			= "DeadlyTile"
zf_gfx_dead_explosive 		= "Explosion"
zf_gfx_dead_toxic 			= "Toxic"
zf_gfx_dead_abyss 			= "Abyss"

zf_gfx_dead_npc 			= "NPC"
zf_gfx_dead_creature 		= "Creature"
zf_gfx_dead_nomsg 			= "Died"
zf_gfx_dead_explosion 		= "Explosion"
zf_gfx_dead_notcount 		= "Despawned"
zf_gfx_dead_turret			= "Turret"
zf_gfx_dead_gatefield 		= "GateField"
zf_gfx_dead_barberdwire 	= "BarbedWire"

--DEAD ICON ACCESSOR
function zf_gfx_dead_get(weapon)
	if(weapon == 1) then
		return zf_gfx_dead_usp
	elseif(weapon == 2) then
		return zf_gfx_dead_glock
	elseif(weapon == 3) then
		return zf_gfx_dead_deagle
	elseif(weapon == 4) then
		return zf_gfx_dead_p228
	elseif(weapon == 5) then
		return zf_gfx_dead_elite
	elseif(weapon == 6) then
		return zf_gfx_dead_fiveseven
	elseif(weapon == 10) then
		return zf_gfx_dead_m3
	elseif(weapon == 11) then
		return zf_gfx_dead_xm1014
	elseif(weapon == 20) then
		return zf_gfx_dead_mp5
	elseif(weapon == 21) then
		return zf_gfx_dead_tmp
	elseif(weapon == 22) then
		return zf_gfx_dead_p90
	elseif(weapon == 23) then
		return zf_gfx_dead_mac10
	elseif(weapon == 24) then
		return zf_gfx_dead_ump45
	elseif(weapon == 30) then
		return zf_gfx_dead_ak47
	elseif(weapon == 31) then
		return zf_gfx_dead_sg552
	elseif(weapon == 32) then
		return zf_gfx_dead_m4a1
	elseif(weapon == 33) then
		return zf_gfx_dead_aug
	elseif(weapon == 34) then
		return zf_gfx_dead_scout
	elseif(weapon == 35) then
		return zf_gfx_dead_awp
	elseif(weapon == 36) then
		return zf_gfx_dead_g3sg1
	elseif(weapon == 37) then
		return zf_gfx_dead_sg550
	elseif(weapon == 38) then
		return zf_gfx_dead_galil
	elseif(weapon == 39) then
		return zf_gfx_dead_famas
	elseif(weapon == 91) then
		return zf_gfx_dead_fnf2000
	elseif(weapon == 40) then
		return zf_gfx_dead_m249
	elseif(weapon == 45) then
		return zf_gfx_dead_laser
	elseif(weapon == 46) then
		return zf_gfx_dead_flamethrower
	elseif(weapon == 47) then
		return zf_gfx_dead_rpglauncer
	elseif(weapon == 48) then
		return zf_gfx_dead_rocketlauncher
	elseif(weapon == 49) then
		return zf_gfx_dead_grenadelauncher
	elseif(weapon == 90) then
		return zf_gfx_dead_m134
	elseif(weapon == 50) then
		return zf_gfx_dead_knife
	elseif(weapon == 69) then
		return zf_gfx_dead_machete
	elseif(weapon == 74) then
		return zf_gfx_dead_wrench
	elseif(weapon == 78) then
		return zf_gfx_dead_claw
	elseif(weapon == 85) then
		return zf_gfx_dead_chainsaw
	elseif(weapon == 51) then
		return zf_gfx_dead_he
	elseif(weapon == 72) then
		return zf_gfx_dead_gasgrenade
	elseif(weapon == 73) then
		return zf_gfx_dead_molotov
	elseif(weapon == 75) then
		return zf_gfx_dead_snowball
	elseif(weapon == 76) then
		return zf_gfx_dead_airstrike
	elseif(weapon == 86) then
		return zf_gfx_dead_gutbomb
	elseif(weapon == 89) then
		return zf_gfx_dead_satchelcharge
	elseif(weapon == 77) then
		return zf_gfx_dead_mine
	elseif(weapon == 87) then
		return zf_gfx_dead_lasermine
		
	elseif(weapon == 239) then
		return 	zf_gfx_dead_entities
	elseif(weapon == 240) then
		return zf_gfx_dead_deadly
	elseif(weapon == 241) then
		return zf_gfx_dead_explosive
	elseif(weapon == 242) then
		return zf_gfx_dead_toxic
	elseif(weapon == 243) then
		return zf_gfx_dead_abyss
	elseif(weapon == 248) then
		return zf_gfx_dead_npc
	elseif(weapon == 249) then
		return zf_gfx_dead_creature
	elseif(weapon == 250) then
		return zf_gfx_dead_nomsg
	elseif(weapon == 251) then
		return zf_gfx_dead_explosion
	elseif(weapon == 252) then
		return zf_gfx_dead_notcount
	elseif(weapon == 253) then
		return zf_gfx_dead_turret
	elseif(weapon == 254) then
		return zf_gfx_dead_gatefield
	elseif(weapon == 255) then
		return zf_gfx_dead_barberdwire
	else
		return "Unknown"
	end
end
edited 5×, last 26.11.19 08:29:07 am

old Re: Custom damage

The Superman
User Off Offline

Quote
@user FishyFinThing: What is that?
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
function zf_gfx_dead_get(weapon)
     if(weapon == 1) then
          return zf_gfx_dead_usp
     elseif(weapon == 2) then
          return zf_gfx_dead_glock
     elseif(weapon == 3) then
          return zf_gfx_dead_deagle
     elseif(weapon == 4) then
          return zf_gfx_dead_p228
     elseif(weapon == 5) then
          return zf_gfx_dead_elite
     elseif(weapon == 6) then
          return zf_gfx_dead_fiveseven
     elseif(weapon == 10) then
          return zf_gfx_dead_m3
     elseif(weapon == 11) then
          return zf_gfx_dead_xm1014
     elseif(weapon == 20) then
          return zf_gfx_dead_mp5
     elseif(weapon == 21) then
          return zf_gfx_dead_tmp
     elseif(weapon == 22) then
          return zf_gfx_dead_p90
     elseif(weapon == 23) then
          return zf_gfx_dead_mac10
     elseif(weapon == 24) then
          return zf_gfx_dead_ump45
     elseif(weapon == 30) then
          return zf_gfx_dead_ak47
     elseif(weapon == 31) then
          return zf_gfx_dead_sg552
     elseif(weapon == 32) then
          return zf_gfx_dead_m4a1
     elseif(weapon == 33) then
          return zf_gfx_dead_aug
     elseif(weapon == 34) then
          return zf_gfx_dead_scout
     elseif(weapon == 35) then
          return zf_gfx_dead_awp
     elseif(weapon == 36) then
          return zf_gfx_dead_g3sg1
     elseif(weapon == 37) then
          return zf_gfx_dead_sg550
     elseif(weapon == 38) then
          return zf_gfx_dead_galil
     elseif(weapon == 39) then
          return zf_gfx_dead_famas
     elseif(weapon == 91) then
          return zf_gfx_dead_fnf2000
     elseif(weapon == 40) then
          return zf_gfx_dead_m249
     elseif(weapon == 45) then
          return zf_gfx_dead_laser
     elseif(weapon == 46) then
          return zf_gfx_dead_flamethrower
     elseif(weapon == 47) then
          return zf_gfx_dead_rpglauncer
     elseif(weapon == 48) then
          return zf_gfx_dead_rocketlauncher
     elseif(weapon == 49) then
          return zf_gfx_dead_grenadelauncher
     elseif(weapon == 90) then
          return zf_gfx_dead_m134
     elseif(weapon == 50) then
          return zf_gfx_dead_knife
     elseif(weapon == 69) then
          return zf_gfx_dead_machete
     elseif(weapon == 74) then
          return zf_gfx_dead_wrench
     elseif(weapon == 78) then
          return zf_gfx_dead_claw
     elseif(weapon == 85) then
          return zf_gfx_dead_chainsaw
     elseif(weapon == 51) then
          return zf_gfx_dead_he
     elseif(weapon == 72) then
          return zf_gfx_dead_gasgrenade
     elseif(weapon == 73) then
          return zf_gfx_dead_molotov
     elseif(weapon == 75) then
          return zf_gfx_dead_snowball
     elseif(weapon == 76) then
          return zf_gfx_dead_airstrike
     elseif(weapon == 86) then
          return zf_gfx_dead_gutbomb
     elseif(weapon == 89) then
          return zf_gfx_dead_satchelcharge
     elseif(weapon == 77) then
          return zf_gfx_dead_mine
     elseif(weapon == 87) then
          return zf_gfx_dead_lasermine
     elseif(weapon == 239) then
          return      zf_gfx_dead_entities
     elseif(weapon == 240) then
          return zf_gfx_dead_deadly
     elseif(weapon == 241) then
          return zf_gfx_dead_explosive
     elseif(weapon == 242) then
          return zf_gfx_dead_toxic
     elseif(weapon == 243) then
          return zf_gfx_dead_abyss
     elseif(weapon == 248) then
          return zf_gfx_dead_npc
     elseif(weapon == 249) then
          return zf_gfx_dead_creature
     elseif(weapon == 250) then
          return zf_gfx_dead_nomsg
     elseif(weapon == 251) then
          return zf_gfx_dead_explosion
     elseif(weapon == 252) then
          return zf_gfx_dead_notcount
     elseif(weapon == 253) then
          return zf_gfx_dead_turret
     elseif(weapon == 254) then
          return zf_gfx_dead_gatefield
     elseif(weapon == 255) then
          return zf_gfx_dead_barberdwire
     else
          return "Unknown"
     end
end
That's ugly, How many hours did you spend on it.

You can try another way to do that faster.

I don't have time now, I'll tell you the second way(which is faster, doesn't take a long time) tomorrow.

old Re: Custom damage

Hajt
User Off Offline

Quote
It should works but not tested though.
1
2
3
4
5
6
function zf_gfx_dead_get(weapon)
	local name = itemtype(weapon, "name")
	local file = string.gsub(string.lower(name), "%s+", "")
	local path = "gfx/weapons/"..file.."_k.bmp"
	return name..","..path
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview