Forum

> > CS2D > General > Zombie NPC unkillable
ForenübersichtCS2D-ÜbersichtGeneral-ÜbersichtEinloggen, um zu antworten

Englisch Zombie NPC unkillable

3 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Zombie NPC unkillable

Grulf
User Off Offline

Zitieren
Hello, I noticed that when I make my buildings invincible by the following script:

1
2
3
4
5
6
addhook("objectdamage", "on_objectdamage")
function on_objectdamage(id, damage, player)
	if ((object(id, "player") == 1) and (player ~= 1)) then
		return 1
	end
end

... other players cannot kill the zombies I spawn. However I can (same goes for my own buildings, as you can see in the script), and other NPCs are also killable as usual.

alt Re: Zombie NPC unkillable

DC
Admin Off Offline

Zitieren
yeah because that's what you scripted. NPCs are "objects" as well.
you have to check object(id,"typename") or object(id,"type") with if.

alt Re: Zombie NPC unkillable

Grulf
User Off Offline

Zitieren
user DC hat geschrieben
yeah because that's what you scripted. NPCs are "objects" as well.
you have to check object(id,"typename") or object(id,"type") with if.


But why are only the zombies invincible then?

alt Re: Zombie NPC unkillable

DC
Admin Off Offline

Zitieren
object(id,"player") is used in another way for NPCs (because NPCs do not have a player relation). it's the NPC type. and 1 = Zombie. sorry for the bad/missing documentation at this point
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antwortenGeneral-ÜbersichtCS2D-ÜbersichtForenübersicht