Forum

> > CS2D > Scripts > Money from kill NPC?
Forums overviewCS2D overview Scripts overviewLog in to reply

English Money from kill NPC?

4 replies
To the start Previous 1 Next To the start

old Money from kill NPC?

KabirDuy
User Off Offline

Quote
When killing an NPC (such zombie ...), the money will fall out of it. 500-5000 money. I hope someone help me!

old Re: Money from kill NPC?

Cure Pikachu
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
addhook("objectkill","moneynpc")
function moneynpc(oid)
	if object(oid,"type") == 30 then
		local a = math.random(1,10)
		for i = 1, a do
			parse("spawnitem 67 "..object(oid,"tilex").." "..object(oid,"tiley"))
		end
	end
end
EDIT: So you want to make it drop money. But I don't know whether it will work.
edited 2×, last 30.12.12 02:50:23 pm

old Re: Money from kill NPC?

Dynamite07
User Off Offline

Quote
pikachu code work,

1
2
3
4
5
6
7
8
9
addhook("objectkill","k")
function k(id)
       if object(id,"type") == 30 then
          local z = math.random(-1,3)
                for i = 1, z do
                    parse("spawnitem 66 "..object(id,"tilex").." "..object(id,"tiley"))
                end
       end
end

old Re: Money from kill NPC?

Xirot
User Off Offline

Quote
I'm pretty sure that this code here
1
2
3
4
5
6
7
8
9
addhook("objectkill","k")
function k(id)
       if object(id,"type") == 30 then
          local z = math.random(-1,3)
                for i = 1, z do
                    parse("spawnitem 66 "..object(id,"tilex").." "..object(id,"tiley"))
                end
       end
end
Is working.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview