Forum

> > CS2D > Scripts > NPC Weapon Drop
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch NPC Weapon Drop

14 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt NPC Weapon Drop

Infinite Rain
Reviewer Off Offline

Zitieren
Guys i need script
I never had a work with npcs but I need help
When you kill NPC Soldier Item type 24 will appear under it
Can you please help ma?

alt Re: NPC Weapon Drop

KagamineLen
User Off Offline

Zitieren
1
2
3
4
5
6
7
addhook npc,soldier
if player('npc.soldier') == dead'
then parse('spawnitem under npc.soldier 24')
		return 100 times!~2
end
	end
		end

lol lua script

alt Re: NPC Weapon Drop

Infinite Rain
Reviewer Off Offline

Zitieren
user KagamineLen hat geschrieben
1
2
3
4
5
6
7
addhook npc,soldier
if player('npc.soldier') == dead'
then parse('spawnitem under npc.soldier 24')
		return 100 times!~2
end
	end
		end
lol lua script

emm maybe...

Stop trolling...

alt Re: NPC Weapon Drop

EnderCrypt
User Off Offline

Zitieren
omg wtf is that
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
addhook npc,soldier      
em... missing "" and () and npc hook does not exist

if player('npc.soldier') == dead'
varisable not declared, and has ' meaning its a string, and also has 3 ' signs, and checks if string is dead (unexisting variable)

then parse('spawnitem under npc.soldier 24')
under is not valid in console, its suppose to have x y cord
variable npc.soldier is not declared and missing "....", why

          return 100 times!~2
on a cs2d hook, you should return eithere 0 or 1, and times!~2 is invalid

end
     end
          end

you also missing the function "name" ("variable") after hook


edit, it CAN be made, hower not for the military NPC , however theres 1 posibility...

edit2: ok, if you want me to make a working, then contact me by pm
2× editiert, zuletzt 10.08.11 21:00:48

alt Re: NPC Weapon Drop

EnderCrypt
User Off Offline

Zitieren
EHM theres a way, to make the npc soilder drop a weapon

its slightly complicated but fully possible

alt Re: NPC Weapon Drop

EnderCrypt
User Off Offline

Zitieren
well, then all npc drops weapon, in current cs2d version its impossible to identify if its an npc, however theres (as i said,) a slightly complicated way

alt Re: NPC Weapon Drop

Kiffer-Opa
User Off Offline

Zitieren
Okay, actually it is possible. As proof I give you a tested and working Lua script which does the task. If you kill a soldier, a UMP45 spawns on the death spot:
1
2
3
4
5
6
7
8
9
if npcdrop==nil then npcdrop={} end
function npcdrop.objectkill(object_id,player_id)
	if(object(object_id,"type")==30) then
		if(object(object_id,"player")==5) then
			parse("spawnitem 24 "..object(object_id,"tilex").." "..object(object_id,"tiley"))
		end
	end
end
addhook("objectkill","npcdrop.objectkill")
A few notes on this:
A soldier is actually a NPC. And NPCs are objects with type 30. The type of the NPC itself is saved into the player value. A soldier is NPC type 5. All the code does is checking everytime after a object has been killed. If objecttype equals 30 and then if player value of the object equals 5. If both conditions are true, the object is a soldier and the script spawns an UMP45.

Well, one question remains. Is it actually an UMP45 the soldier holds? I am not sure, the fire rate seems to be a bit different. OKAY, I checked it. It actually IS an UMP45. Damage is 15, fire rate seems to be same, sound is the same, it looks like an UMP45. So I guess it IS an UMP45.
1× editiert, zuletzt 11.08.11 03:31:47
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht