English cs2d npc HP

6 replies
Goto Page
To the start Previous 1 Next To the start
09.10.13 10:58:52 pm
Up
pbeloto
User
Offline Off
Hii all , Plz help me give hp for npc .

Example,


addhook("second","_second")
function _second(id)
     parse ("spawnnpc "..type.." "..x.." "..y) -- no have hp npc '-'
end


spawn npc solied 1000 HP .

plz help '-'

sorry me inglish.
09.10.13 11:20:51 pm
Up
MikuAuahDark
User
Offline Off
you can't spawn NPC with custom health. But if you only gonna spawn NPC on that position(no more NPC gonna spawn twice at that position) you can use cs2d cmd damageobject to set NPC health
Hello? Are you there, Tae Hanazono?
10.10.13 08:02:19 pm
Up
pbeloto
User
Offline Off
user MikuAuahDark has written:
you can't spawn NPC with custom health. But if you only gonna spawn NPC on that position(no more NPC gonna spawn twice at that position) you can use cs2d cmd damageobject to set NPC health


Code:
1
2
3
4
5
6
7
8
addhook("damageobject","_damageobject")
function _damageobject(id,dmg,pl)
     if object(id,"type") == 30 then
          if object(id,"player") == 1 then
               ..ZzZzZz
          end
     end
end


help me
11.10.13 01:33:08 am
Up
omg
User
Offline Off
-.-

u obviously didnt get the point of what 0x4 was saying
will code for food
11.10.13 02:09:43 am
Up
pbeloto
User
Offline Off
I did not understand until now, could make a command for me?


Code:
1
2
3
4
5
6
7
8
9
10
11
addhook("objectdamage","_objectdamage")
function _objectdamage(id_o,dmg,id_pl)
     if id_o > 0 then
          if object(id_o,"type") == 30 then
               if object(id_o,"player") == 1 then     
               parse("damageobject "..id_o.." 1 "..id_pl)
               return 1
               end
          end
     end
end


#Error : LUA ERROR: C stack overflow
edited 1×, last 11.10.13 04:26:39 am
11.10.13 05:05:41 am
Up
EP
User
Offline Off
stack overflow for the win
11.10.13 08:24:30 am
Up
Necr0
User
Offline Off
what user MikuAuahDark was trying to tell you was:
when an npc spawns you can heal it by using cs2d cmd damageobject with a negative amount as parameter to increase it's health.
To the start Previous 1 Next To the start