Forum

> > CS2D > Scripts > Hudtxt for a value - NPC Kills
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Hudtxt for a value - NPC Kills

7 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Hudtxt for a value - NPC Kills

Alistaire
User Off Offline

Zitieren
(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..?
3× editiert, zuletzt 05.01.12 16:34:48

alt Re: Hudtxt for a value - NPC Kills

Kel9290
User Off Offline

Zitieren
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
3× editiert, zuletzt 05.01.12 13:41:42

alt Re: Hudtxt for a value - NPC Kills

Alistaire
User Off Offline

Zitieren
user Kel9290 hat geschrieben
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 hat geschrieben
[13:39:08] LUA ERROR: sys/lua/Collectables.lua:7: ')' expected near '"..Col1_Collected.."'


----

user Kel9290 hat geschrieben
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!

alt Re: Hudtxt for a value - NPC Kills

Kel9290
User Off Offline

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

alt Re: Hudtxt for a value - NPC Kills

Alistaire
User Off Offline

Zitieren
user Kel9290 hat geschrieben
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

alt Re: Hudtxt for a value - NPC Kills

Kel9290
User Off Offline

Zitieren
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
2× editiert, zuletzt 05.01.12 17:48:42
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht