Forum

> > CS2D > Scripts > Need to sort out something about Die hook.
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Need to sort out something about Die hook.

6 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Need to sort out something about Die hook.

Rainoth
Moderator Off Offline

Zitieren
What is it's trigger action ? Death or Being Dead ?

I kinda get a problem. I made a script that makes player have a thing if he choose it in menu, the thing resets when player dies and a menu pops out (when player dies) to select from a list of things again. The problem is that since everything's reset on death then later picked again it should work, but if it were that the hook triggers when player is Being Dead then no wonder why that part of script doesn't work. So my question is : Is Die hook action - Being Dead or Dying ?

alt Re: Need to sort out something about Die hook.

Rainoth
Moderator Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function die_hook(id,killer,weapon,x,y)
parse("effect \"flare\" "..x.." "..y.." 50 50 "..math.random(100,255).." "..math.random(100,255).." "..math.random(100,255).." ")
menu(id,"Monster Upgrades,Health,Armor,Speed,Other")
Player[id].hp = 0
Player[id].ap = 0
Player[id].spdp = 0
Player[id].dlove = 0
Player[id].noesc = 0
Player[id].sshot = 0
Player[id].lwish = 0
Player[id].db = 0
Player[id].regen = 0
Player[id].lorb = 0
Player[id].frush = 0
local lastwish = {51,52,53,54,72,73,75,76,86}
	if Player[id].lwish == 1 then
		for i= 1,16 do
			parse("spawnprojectile "..id.." "..lastwish[math.random(1, #lastwish)].." "..x.." "..y.." "..math.random(1,1000).." "..math.random(1,360))
		end
	end

I get no errors but this isn't working Any idea why ?

alt Re: Need to sort out something about Die hook.

Rainoth
Moderator Off Offline

Zitieren
user Starkkz hat geschrieben
@user Rainoth: Because you reseted the value "lwish" just before the conditional, it will not work unless you put the conditional at the top of the function.


Ah this is some good information I didn't know
Thanks I'll try this out
Edit : Works like a charm. Thanks.
1× editiert, zuletzt 13.04.13 22:40:39
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht