Forum

> > CS2D > Scripts > NPC Random Drops (REQUEST)
Forums overviewCS2D overview Scripts overviewLog in to reply

English NPC Random Drops (REQUEST)

4 replies
To the start Previous 1 Next To the start

old NPC Random Drops (REQUEST)

JohnLOL
User Off Offline

Quote
Hello people, I'm making a Single Player Mod inspired in Counter Strike Deleted Scenes, however,the game became very easy if I just let weapons and ammunition on the map.
Because I could run to the checkpoints without make one shot at the NPC, so I would like someone make a script that makes the NPCs drop item (Ammunition, weapons, Armors) to encourage the player to kill NPCs and make the mod more challenging.

In short:
  ∗ -Please Create a script that makes the NPC drop various items (or items established by id)

  ∗ -Establish A frequency of drop (not always the NPCs drop items)

-The Item appears where the NPC was killed

From already, thanks for read this post or not,you guys are cool !!!

* Sorry my bad English

old Re: NPC Random Drops (REQUEST)

omg
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
math.randomseed(os.time())
math.random()

droptable={61,62,64,58}
droprate={i61=15,i62=15,i64=5,i58=5}

addhook("objectkill","badidea")
function badidea(obj,id)
	if id>0 and id<33 then
		if object(obj,"type")==30 then
			for _,item in pairs(droptable) do
				local getitem="i"..item
				if math.random(100)<=droprate[getitem] then
					parse("spawnitem "..item.." "..object(obj,"tilex").." "..object(obj,"tiley"))
				end
			end
		end
	end
end
looking for anything more specific?
edited 4×, last 24.08.15 11:52:44 pm
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview