Forum

> > CS2D > General > Zombie NPC unkillable
Forums overviewCS2D overviewGeneral overviewLog in to reply

English Zombie NPC unkillable

3 replies
To the start Previous 1 Next To the start

old Zombie NPC unkillable

Grulf
User Off Offline

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

old Re: Zombie NPC unkillable

DC
Admin Off Offline

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

old Re: Zombie NPC unkillable

Grulf
User Off Offline

Quote
user DC has written
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?

old Re: Zombie NPC unkillable

DC
Admin Off Offline

Quote
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
To the start Previous 1 Next To the start
Log in to replyGeneral overviewCS2D overviewForums overview