Forum

> > CS2D > Scripts > spawnprojectile in hit hook
Forums overviewCS2D overview Scripts overviewLog in to reply

English spawnprojectile in hit hook

6 replies
To the start Previous 1 Next To the start

old spawnprojectile in hit hook

Carnivohra
User Off Offline

Quote
hey us,

my problem is simple...
i want to add a stun effect for a snowball projectile which i spawned with spawnprojectile like this

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
function attack2hook(id, weapon)
	if (weapon == 50) then
		parse("spawnprojectile " .. id .. " 75 " .. player(id,"x") .. " " .. player(id,"y") .. " 500 " .. player(id, "rot"))
	end
end

function hithook(id, weapon)
	if (weapon == 75) then
		parse("speedmod " .. id .. " " .. player(id, "speedmod") - 15)
		msg("weapon hit found")
	end
end

addhook("attack2", "attack2hook")
addhook("hit", "hithook")

...but it doesnt work

the attack2 hook works fine, but the hit hook cant find a hit of a snowball...
i tested it with a message "weapon hit found" but this message wasnt triggered.
my theory is that this projectile has another weapon id, but which?

thanks for answers

old Re: spawnprojectile in hit hook

Cure Pikachu
User Off Offline

Quote
Check the parameters for cs2d lua hook hit. Try this:
function hithook(id,source,weapon)

What your parameters mean currently is that it will speed debuff the victim if the source player's ID is 75, which obviously cannot exist (one server can only fit 32 players tops).
edited 1×, last 28.05.20 03:23:13 am

old Re: spawnprojectile in hit hook

Rainoth
Moderator Off Offline

Quote
@user Carnivohra: It's not unusual. It provides all parameters and you can name them at your own convenience. Thus, the pc needs another way to figure out which parameter is which, cause you could technically name source id as "weapon" and weapon as "source", so it uses the order as a way to figure out which parameter is which. It's pretty nice, I'd hate having to write every param in a specific way.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview