Forum

> > CS2D > Scripts > Need to sort out something about Die hook.
Forums overviewCS2D overview Scripts overviewLog in to reply

English Need to sort out something about Die hook.

6 replies
To the start Previous 1 Next To the start

old Need to sort out something about Die hook.

Rainoth
Moderator Off Offline

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

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

Rainoth
Moderator Off Offline

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

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

Rainoth
Moderator Off Offline

Quote
user Starkkz has written
@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.
edited 1×, last 13.04.13 10:40:39 pm
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview