Forum

> > CS2D > Scripts > NPC's Parametres
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch NPC's Parametres

8 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt NPC's Parametres

tos12345678
User Off Offline

Zitieren
I have question.
Whether there is a script which:
Will drop others money from each other npc's (after kill npc) e.g.
Zombies:
1
parse("spawnitem 66 "..object(id,"tilex").." "..object(id,"tiley"))
Soliders:
1
parse("spawnitem 68 "..object(id,"tilex").." "..object(id,"tiley"))
Please help me with this script if it's possible. Thanks!

alt Re: NPC's Parametres

Quattro
GAME BANNED Off Offline

Zitieren
there is lua hook for kill and death.
get npc's coordinates of the victim using function for one of these hooks and spawn gold with the parse line you wrote

alt Re: NPC's Parametres

Avo
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
addhook('objectkill', 'onObjectKill')
function onObjectKill(oid, pid)
	if object(oid, 'player') == 1 then -- zombie
		parse("spawnitem 66 "..object(oid,"tilex").." "..object(oid,"tiley"))
	elseif object(oid, 'player') == 5 then -- soldier
		parse("spawnitem 68 "..object(oid,"tilex").." "..object(oid,"tiley"))
	end
end

I don't really remember if object's position is available at the moment of being destroyed, so the above might not work. In that case try this one:

1
2
3
4
5
6
7
8
9
10
addhook('objectdamage', 'onObjectDamage')
function onObjectKill(oid, dmg, src)
	if dmg >= object(oid, 'health') then
		if object(oid, 'player') == 1 then -- zombie
			parse("spawnitem 66 "..object(oid,"tilex").." "..object(oid,"tiley"))
		elseif object(oid, 'player') == 5 then -- soldier
			parse("spawnitem 68 "..object(oid,"tilex").." "..object(oid,"tiley"))
		end
	end
end

cs2d lua cmd object, cs2d lua hook objectkill, cs2d lua hook objectdamage
1× editiert, zuletzt 18.12.18 16:42:16

alt Re: NPC's Parametres

Quattro
GAME BANNED Off Offline

Zitieren
yeah it should work, I was using these commands in aim challenge script too. my image object was called HUD:

1
2
parse('sv_soundpos "/2DMasters/training/splash.ogg" '..object(HUD,'x')..' '..object(HUD,'y')..'')
    parse('sv_soundpos "/2DMasters/training/'..name..'" '..object(HUD,'x')..' '..object(HUD,'y')..'')
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht