ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
Function to kill by name... not working

Posted by/on
Question/AnswerMake Oldest Up Sort by Ascending
  13:07:30  3 April 2013
profilee-mailreply Message URLTo the Top
insanelazarez
Yeah, Good Luck With That...
(Resident)

 

 
On forum: 01/31/2009
Messages: 1070

---QUOTATION---
you need the client (online) object for method "kill"
function kill_name(actor, npc, p)
	if p[1] then
		local se_obj = alife():object(p[1])
		if se_obj then
			local obj = level.object_by_id(se_obj.id)
			if obj and obj:alive() then
				obj:kill(obj)
			end
		end
	end
end


---END QUOTATION---




Thanks Vintar, it works ok.
  22:12:51  2 April 2013
profilee-mailreply Message URLTo the Top
Vintar
a bit of this and a lot of that
(Resident)

 

 
On forum: 08/08/2008
Messages: 6349
you need the client (online) object for method "kill"
function kill_name(actor, npc, p)
	if p[1] then
		local se_obj = alife():object(p[1])
		if se_obj then
			local obj = level.object_by_id(se_obj.id)
			if obj and obj:alive() then
				obj:kill(obj)
			end
		end
	end
end

  09:34:23  31 March 2013
profilee-mailreply Message URLTo the Top
insanelazarez
Yeah, Good Luck With That...
(Resident)

 

 
On forum: 01/31/2009
Messages: 1070
Function to kill by name... not working

Hello i need a function to kill any npc by name (Not the story id). The function can be used anywhere, npc logic, or a space restrictor.

In this case the test was executed in cordon helicopter space restrictor... and the target to kill is the stupid Tolik (all.spawn name is 'esc_vagon_wounded')

The logic for SR:


---QUOTATION---


[sr_idle@wait]
on_info = {+esc_heli_direct} sr_sound_act@attack %=kill_name(esc_vagon_wounded)%


---END QUOTATION---



Function in xr_effects.script:


---QUOTATION---


function kill_name(actor, npc, p)
local se_obj = alife() bject(p[1])
if se_obj then
se_obj:kill(p[1]) -- THIS IS LINE 2450
end
end


---END QUOTATION---



Log error:


---QUOTATION---


FATAL ERROR

[error]Expression : fatal error
[error]Function : CScriptEngine::lua_error
[error]File : E:\stalker\patch_1_0004\xr_3da\xrGame\script_engine.cpp
[error]Line : 73
[error]Description : <no expression>
[error]Arguments : LUA error: ...adow of chernobyl\gamedata\scripts\xr_effects.script:2450: attempt to call method 'kill' (a nil value)


stack trace:


---END QUOTATION---



So, any idea how to fix this?

Thanks in advance.
 
Each word should be at least 3 characters long.
Search:    
Search conditions:    - spaces as AND    - spaces as OR   
 
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
 

All short dates are in Month-Day-Year format.


 

Copyright © 1995-2020 GSC Game World. All rights reserved.
This site is best viewed in Internet Explorer 4.xx and up and Javascript enabled. Webmaster.
Opera Software products are not supported.
If any problem concerning the site functioning under Opera Software appears apply
to Opera Software technical support service.