Forum

> > CS2D > Scripts > Lua Request: After player dies 'x' times...
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Lua Request: After player dies 'x' times...

5 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Lua Request: After player dies 'x' times...

8Ball
User Off Offline

Zitieren
Basically need a lua that will 'count' the number of x player's deaths every time he dies and if his death number exceeds x deaths then a trigger (as in the map editor entity) will be activated.

All help greatly appreciated.

alt Re: Lua Request: After player dies 'x' times...

_oops
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
10
11
12
13
14
deathc=0;
addhook("die","_die")
addhook("startround","resdeath")

function _die(id)
deathc=deathc+1
	if (deathc == x ) then -- change x to the number
	parse("trigger blahblah")
	end
end

function resdeath()
deathc=0
end

alt Re: Lua Request: After player dies 'x' times...

Rainoth
Moderator Off Offline

Zitieren
1
2
3
4
5
6
7
limit = 10
addhook("die","_die")
function _die(id)
	if player(id,"deaths") == limit then
		parse("trigger nameoftrigger")
	end
end

Change 'limit' to how many deaths need to be completed before the trigger works. Mind that this will not reset deaths of a player so the next round when the player dies, he'll have 11 deaths and will no longer trigger. If you want it to work differently, use
1
parse("setdeaths "..id.." 0")
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht