Forum

> > CS2D > Scripts > spawnprojectile in hit hook
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch spawnprojectile in hit hook

6 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt spawnprojectile in hit hook

Carnivohra
User Off Offline

Zitieren
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

alt Re: spawnprojectile in hit hook

Cure Pikachu
User Off Offline

Zitieren
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).
1× editiert, zuletzt 28.05.20 03:23:13

alt Re: spawnprojectile in hit hook

Rainoth
Moderator Off Offline

Zitieren
@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.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht