Forum

> > CS2D > Scripts > Hudtxt for a value - NPC Kills
Forums overviewCS2D overview Scripts overviewLog in to reply

English Hudtxt for a value - NPC Kills

7 replies
To the start Previous 1 Next To the start

old Hudtxt for a value - NPC Kills

Alistaire
User Off Offline

Quote
(Old problem)
Spoiler >


1
2
3
4
5
6
7
addhook("objectkill","Collectables_objectkill_hook")
function Collectables_objectkill_hook()
	if (entity("name") == "Col2") then
		Col2_Collected = Col2_Collected + 1
		parse('hudtxt, 2, "'..Col2_Collected..'", 32, 420, 3')
	end
end

I've made another one of these scripts; this time for NPC kills.

I guess it's wrong at the entity part, idk what to write else. Info.txt says it has to be the objectid..?
edited 3×, last 05.01.12 04:34:48 pm

old Re: Hudtxt for a value - NPC Kills

Kel9290
User Off Offline

Quote
updated
1
2
3
4
5
6
7
8
9
Col1_Collected=0

addhook("break","collectables_break")
function collectables_break(x,y)
	if(entity(x,y,"name")=="Col1") then
		Col1_Collected = Col1_Collected + 1
		parse('hudtxt 1 "'..Col1_Collected..'" 32 420')
	end
end
edited 3×, last 05.01.12 01:41:42 pm

old Re: Hudtxt for a value - NPC Kills

Alistaire
User Off Offline

Quote
user Kel9290 has written
1
2
3
4
5
6
7
8
9
Col1_Collected=0

addhook("objectkill","Collectables_objectkill_hook")
function Collectables_objectkill_hook(id)
	if (entity("trigger") == "Col1") then
		Col1_Collected = Col1_Collected + 1
		parse('hudtxt 1 '"..Col1_Collected.."' 32 420')
	end
end


Lua Error has written
[13:39:08] LUA ERROR: sys/lua/Collectables.lua:7: ')' expected near '"..Col1_Collected.."'


----

user Kel9290 has written
updated
1
2
3
4
5
6
7
8
9
Col1_Collected=0

addhook("break","collectables_break")
function collectables_break(x,y)
	if(entity(x,y,"name")=="Col1") then
		Col1_Collected = Col1_Collected + 1
		parse('hudtxt 1 '"..Col1_Collected.."' 32 420')
	end
end


Same error

----

Last one worked! Thanks bro!

old Re: Hudtxt for a value - NPC Kills

Kel9290
User Off Offline

Quote
tested.
1
2
3
4
5
6
7
8
9
Col1_Collected=0

addhook("break","collectables_break")
function collectables_break(x,y)
	if(entity(x,y,"name")=="col1") then
		Col1_Collected = Col1_Collected + 1
		parse('hudtxt 1 "'..Col1_Collected..'" 32 420')
	end
end
Spoiler >

old Re: Hudtxt for a value - NPC Kills

Alistaire
User Off Offline

Quote
user Kel9290 has written
tested.
1
2
3
4
5
6
7
8
9
Col1_Collected=0

addhook("break","collectables_break")
function collectables_break(x,y)
	if(entity(x,y,"name")=="col1") then
		Col1_Collected = Col1_Collected + 1
		parse('hudtxt 1 "'..Col1_Collected..'" 32 420')
	end
end
Spoiler >


Why does it have to be col1 then 0-0

old Re: Hudtxt for a value - NPC Kills

Kel9290
User Off Offline

Quote
why the hell you putting , in parse?
and read info.txt in your counter-strike 2d folder (sys/lua), all info there.

1
2
3
4
5
6
7
8
9
Col2_Collected=0

addhook("objectkill","_o")
function _o(dynid,i)
	if object(dynid,"type") == 30 then -- 30 is any NPC
		Col2_Collected = Col2_Collected + 1
		parse('hudtxt 2 "'..Col2_Collected..'" 32 420 3')
	end
end
edited 2×, last 05.01.12 05:48:42 pm
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview