Forum

> > CS2D > Scripts > N>somebody to make lua i want
Forums overviewCS2D overview Scripts overviewLog in to reply

English N>somebody to make lua i want

4 replies
To the start Previous 1 Next To the start

old N>somebody to make lua i want

dustin5
User Off Offline

Quote
hi all i need some help to make a lua when every times we kill NPC we get EXP and the NPC can drop random items when *DEAD* (just normal items not crazy items) + each level can make us get +5 max HP
PM me for the lua ok guys
thx for anybody wanna make the lua for me
a little bad in english sry T_T

old Re: N>somebody to make lua i want

Alistaire
User Off Offline

Quote
That's pretty easy.

You'll need an objectkill hook with npctype 30 and a math.random(_table(itemsuwannaspawn)) for what items they can drop.

Also you'll need a table with player id's and experience, and probably a function for levelling up.

old Re: N>somebody to make lua i want

Infinite Rain
Reviewer Off Offline

Quote
SO firstly you need make a weapons table that you want to be dropped.

after this on objectkill make randomization

1
2
3
4
5
6
7
8
9
weapons = {12, 15, 16} --weapon IDs

addhook('objectkill', 'npcdead')
function npcdead(id, player)
	if not object(id, 'type') == 30 then return end
	math.randomseed(os.time)
	local d = weapons[math.random(1, #weapons)]
	parse('spawn blanblabla
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview