ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
Function to make gulag enemy to npc works, but...

Posted by/on
Question/AnswerMake Newest Up Sort by Descending
  22:41:18  10 March 2013
profilee-mailreply Message URLTo the Top
insanelazarez
Yeah, Good Luck With That...
(Resident)

 

 
On forum: 01/31/2009
Messages: 1071
Function to make gulag enemy to npc works, but...

In xr_effects.script

function set_gulag_enemy_npc( actor, npc, p )
if p[1] then
xr_gulag.setGulagEnemy(p[1], npc)
-- npc:set_relation(game_object.enemy, (p[1])
end
end

So the stalker at some point calls the function(in his logic) and the gulag becomes hostile. That is the idea, but i want the npc to become hostile to the gulag too. And this is the problem:

The function is commented because it is not working


---QUOTATION---


-- npc:set_relation(game_object.enemy, (p[1])


---END QUOTATION---



If i remove the '--'...

Gives me an error in console (state manager ... whatever), no ctd... but the game ai is all broken. Sooner or later the game will crash.

Seems obvious that the game doesn't know what 'npc' is. I know i am very close... but for now, no luck.


Btw, my logic is...



---QUOTATION---


[camper@wait]
radius = 1
no_retreat = true
path_walk = test_npc_spawn_walk
path_look = test_npc_spawn_look
combat_ignore_cond = always
danger = danger@his_danger
meet = no_meet
on_info = {+esc_tutorial_start} remark@aim_to_actor %=set_gulag_enemy_npc(esc_lager)%

;etc


---END QUOTATION---



So any idea?

Thanks in advance...
  05:35:45  11 March 2013
profilee-mailreply Message URLTo the Top
Alundaio
Sad Clown
(Resident)

 

 
On forum: 04/05/2010
 

Message edited by:
Alundaio
03/11/2013 5:42:37
Messages: 2230
Is that the exact copy&paste of that function? Because there is a typo there with a parenthesis which would cause the script not to load:

npc:set_relation(game_object.enemy, (p[1])


But anyway, try this:


function set_gulag_enemy_npc( actor, npc, p )
	if p[1] then
		xr_gulag.setGulagEnemy(p[1], npc)
		local gulag = xr_gulag.get_gulag(p[1])
		npc:set_relation(game_object.enemy, gulag)
	end
end




Though I don't see why it's necessary because xr_gulag.setGulagEnemy does set NPC enemy to gulag and visa versa.
  08:03:51  11 March 2013
profilee-mailreply Message URLTo the Top
insanelazarez
Yeah, Good Luck With That...
(Resident)

 

 
On forum: 01/31/2009
 

Message edited by:
insanelazarez
03/11/2013 8:05:12
Messages: 1071

---QUOTATION---
Is that the exact copy&paste of that function? Because there is a typo there with a parenthesis which would cause the script not to load:

npc:set_relation(game_object.enemy, (p[1])


But anyway, try this:


function set_gulag_enemy_npc( actor, npc, p )
	if p[1] then
		xr_gulag.setGulagEnemy(p[1], npc)
		local gulag = xr_gulag.get_gulag(p[1])
		npc:set_relation(game_object.enemy, gulag)
	end
end




Though I don't see why it's necessary because xr_gulag.setGulagEnemy does set NPC enemy to gulag and visa versa.
---END QUOTATION---




Alundaio, i had a typo but after fixing it ... it didn't work. I also tried your function... but ctd, and no log. Btw, when you say:


---QUOTATION---


Though I don't see why it's necessary because xr_gulag.setGulagEnemy does set NPC enemy to gulag and visa versa.


---END QUOTATION---



... Well in stalker shadow of chernobyl, this is not true. The npc becomes a target for the gulag... but the gulag doesn't become a target for the npc.

I tried this in several maps with 'neutral gulags' versus 'custom neutral npc' in 3 maps... and the poor bastard always gets killed by the gulag... without doing shit... lol.

One way or another, thanks for trying Alundaio.
  08:13:21  11 March 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
Try this one, a bit overkill but yeah...
function set_enemies(actor, npc, p)
   if p[1] then  
     local gulag = xr_gulag.get_gulag(p[1])
       if gulag then
         for k, v in pairs(gulag.Object) do
            local npc1 = level.object_by_id(v)
            if npc1 and npc1:alive() then
               npc:set_relation(game_object.enemy, npc1)
               npc1:set_relation(game_object.enemy, npc)
	    end
         end
       end
   end
end

  09:10:29  11 March 2013
profilee-mailreply Message URLTo the Top
insanelazarez
Yeah, Good Luck With That...
(Resident)

 

 
On forum: 01/31/2009
Messages: 1071

---QUOTATION---
Try this one, a bit overkill but yeah...
function set_enemies(actor, npc, p)
   if p[1] then  
     local gulag = xr_gulag.get_gulag(p[1])
       if gulag then
         for k, v in pairs(gulag.Object) do
            local npc1 = level.object_by_id(v)
            if npc1 and npc1:alive() then
               npc:set_relation(game_object.enemy, npc1)
               npc1:set_relation(game_object.enemy, npc)
	    end
         end
       end
   end
end


---END QUOTATION---




Ok, vintar... you got me on this one... but i am sure it was not on purpuse... i mean the bastard turns against me... aha... But i don't see anything in the function explaining this outcome. Lol.
 
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.