ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Clear Sky Forum » Mod discussion
Questions about modding the faction wars

1 2 | Next 10 events »| All Messages
Posted by/on
Question/AnswerMake Newest Up Sort by Descending
  11:54:39  25 January 2013
profilee-mailreply Message URLTo the Top
Decane
Senior Resident
 

 
On forum: 04/04/2007
Messages: 1690
Questions about modding the faction wars

Hi,

(1) Does anyone know if it is possible to make target smart terrains assigned through the precondition_target_eliminate parameter not get cancelled on loading a savegame? Currently, if I set Clear Sky to eliminate some target smarts x, y and z at the swamps and then save the game; when I load this savegame, all the aforementioned target smarts will get cancelled, almost as if the game has "forgotten" that they were supposed to be targets.

(2) Is it possible to make squads less fickle about their preferred smart terrain targets? It seems that the task to clear the road to the Lookout Tower at the swamps always gets cancelled before I even get there.

Thank you for your time.
  17:04:35  25 January 2013
profilee-mailreply Message URLTo the Top
smoq2
Forklift operator
(Resident)

 

 
On forum: 09/08/2008
Messages: 2433
1. I believe the problem runs somewhere deeper than the task itself. Tasks do not get canceled by themselves, instead they are interconnected with alife. Most likely issues are:

A. The squad that was present at the smart terrain marked for "eliminate" task simply left it and the crappy CS script logic failed to mark ownership as "none".

B. The squad that was present at the smart terrain was killed off by a third party and the crappy CS script logic failed to mark ownership as "none".

C. Smart terrain ownership flag got messed up for some other reason during saving/loading due to crappy CS script logic.


2. Same reasons as above. Although I don't get this one:


---QUOTATION---
Is it possible to make squads less fickle about their preferred smart terrain targets
---END QUOTATION---



Do you want to prioritize which smarts should get attention from a given faction first? If so, then there is no simple way to do that. A complete overhaul of the faction "brain" would be required, as in Faction Commander or The Faction War.

Actually, if you want factions to work properly, you'll need a complete overhaul anyway.

You must know that this aspect of the game got the least attention from developers (at least it seems so when reading the code), and is simply broken at its core. You can patch it up, but it will always be the same at its core - broken.
  23:51:53  26 January 2013
profilee-mailreply Message URLTo the Top
Decane
Senior Resident
 

 
On forum: 04/04/2007
 

Message edited by:
Decane
01/26/2013 23:57:35
Messages: 1690
Thank you for your reply.

Concerning point #1: the smarts get cancelled as eliminate targets only for a couple seconds after loading a savegame. They get automatically re-assigned after a while. Furthermore, this effect only happens with eliminate targets; if I set the smarts through precondition_target (capture) instead of precondition_target_eliminate (eliminate) then the targets 'stick' and do not get cancelled. Still more puzzling is the fact that if the eliminate targets were received as a consequence of the precondition_power parameter, then despite being eliminate targets, they do not get cancelled on loading a savegame.

Concerning point #2: yes, I want squads to stick to the smart terrain that they are attempting to capture until either (a) they have captured it or (b) the enemy has left the smart. Presently, some targets like the Lookout Tower at the swamps seem to get cancelled randomly without either of the above conditions being met; although I suppose it is possible that the patrol path of the reference NPC at the smart terrain occasionally leads outside of the smart, causing the game to mistakenly register the smart as empty -- but this is mere speculation on my part.

Anyway, I am convinced by what you wrote that making this stuff work properly would require an overhaul so I will not pursue these things any further. I do, however, have one other issue that you might just be the guy to help me with, smoq2: I am trying to write a script that bypasses the problem where Freedom refuses to take the Garbage exit points because of their neutrality toward the bandits. So far I have tested the following code:


local board = sim_board.get_sim_board()

if xr_conditions.squad_in_zone_all(nil, nil, {"gar_smart_terrain_8_3", "gar_robbery_bandit_blockpost_8_3"}) then
--if xr_conditions.smart_captured_by_faction(nil, nil, {"gar_smart_terrain_8_3", "bandit"}) then -- this also works
	if board.squads["gar_bandit_smart_terrain_8_3_squad_1"] then
		set_faction_goodwill_to_squad("gar_bandit_smart_terrain_8_3_squad_1", "freedom", "enemy")
	end
end



But the above code depends on the fact that the squad which is presently controlling the smart is in fact precisely gar_bandit_smart_terrain_8_3_squad_1 (the default spawn squad) and not any other; it will, to my understanding, fail to work in cases where some non-default bandit squad is controlling the smart. Thus, I need code that assigns Freedom to hate the bandit squad controlling that smart terrain which does not directly reference the target squad name. How do I do this?
  15:01:10  27 January 2013
profilee-mailreply Message URLTo the Top
smoq2
Forklift operator
(Resident)

 

 
On forum: 09/08/2008
Messages: 2433

local board = sim_board.get_sim_board()
local target_smart = board.smarts_by_names["gar_smart_terrain_8_3"]
local target_smart_info = board.smarts[target_smart.id]


if target_smart.player_name == "bandit" then
	for k,squad in pairs (target_smart_info.squads) do
		if squad.player_id == "bandit" then
			set_faction_goodwill_to_squad(squad.squad_id, "freedom", "enemy")
		end
	end
end



Off the top of my head. Best to test it yourself.
  19:48:49  27 January 2013
profilee-mailreply Message URLTo the Top
Decane
Senior Resident
 

 
On forum: 04/04/2007
Messages: 1690
Smoq2, you have been just as great a help as in old times; thanks.

Your code worked beautifully, but I am curious about why this line is needed:

if squad.player_id == "bandit" then


Doesn't this part:

if target_smart.player_name == "bandit" then


... already check that the smart owners are bandits? If so, why the need for a second check? Forgive me if my question is silly; I have not done this for a while and the syntax can be pretty daunting with sim_boards and squad_ids all over the place.
  13:16:37  28 January 2013
profilee-mailreply Message URLTo the Top
smoq2
Forklift operator
(Resident)

 

 
On forum: 09/08/2008
Messages: 2433
The checked smart terrain may be owned by bandits, but the line in question makes sure that only bandit squads will be set as hostile for freedom, just in case any other faction happen to somehow end up on that point.
  22:03:50  28 January 2013
profilee-mailreply Message URLTo the Top
Decane
Senior Resident
 

 
On forum: 04/04/2007
 

Message edited by:
Decane
01/29/2013 0:58:02
Messages: 1690

---QUOTATION---
The checked smart terrain may be owned by bandits, but the line in question makes sure that only bandit squads will be set as hostile for freedom, just in case any other faction happen to somehow end up on that point.
---END QUOTATION---


That makes sense; thanks for the clarification.

¯¯¯¯¯¯¯¯¯¯
One more question:

I want to make it so that a parameter in the faction_.ltx files excludes certain smarts from being assigned as targets for a given expansion. Thus far, I have defined the parameter precondition_restr in sim_faction.script by listing it under function se_sim_faction:read_params() as follows:

t.precondition_restr = utils.parse_names(utils.cfg_get_string
(self.setting_ini, section, "precondition_restr", self, false, "", ""))

I then altered the function get_sim_targets_advance in sim_faction_brain_human.script like this:

function faction_brain_human:get_sim_targets_advance(expansion)

 local restr_smrt

 for k, v in pairs (expansion.precondition_restr) do
   restr_smrt = self.faction.board.smarts_by_names[v]
 end

 for k,v in pairs(expansion.precondition_target) do
   local smart_obj = self.faction.board.smarts_by_names[v]
    if smart_obj ~= restr_smrt then
      self:register_target_point(smart_obj, true)
    end
 end

 for k,v in pairs(expansion.precondition_target_optional) do
   local smart_obj = self.faction.board.smarts_by_names[v]
    if smart_obj ~= restr_smrt then
      self:register_target_point(smart_obj, true)
    end
  end

  for k,v in pairs(expansion.precondition_target_eliminate) do
    local smart_obj = self.faction.board.smarts_by_names[v]		
    local smart_owner = smart_obj.player_name
    if smart_owner ~= "none" and smart_obj ~= restr_smrt then
      if game_relations.is_factions_enemies(self.faction.player_name, smart_owner) then
        self:register_target_point(smart_obj, false, true)
      end
    end
  end
end

But alas, my code does not seem to have any effect. I still keep getting the Southern Farmstead as an eliminate target in the swamp faction war when I set these parameters for expansion_0 in faction_csky.ltx:

precondition_restr = mar_smart_terrain_10_5, mar_smart_terrain_11_11, mar_smart_terrain_12_2
; 10_5 = Machine Yard, 11_11 = Southern Farmstead, 12_2 = Northern Farmstead
precondition_power = 0.9

Any ideas on how I might make this work? I have thought about entering the restrict condition directly into the function register_target_point but that would just crash the game on attempting to parse "expansion" since it is not a defined parameter of that function.

EDIT: Reduced the width of the code to stretch the page less.
  11:56:04  29 January 2013
profilee-mailreply Message URLTo the Top
smoq2
Forklift operator
(Resident)

 

 
On forum: 09/08/2008
Messages: 2433
http://pastebin.com/9gqm9sxt

See if this does the trick.
  21:10:45  30 January 2013
profilee-mailreply Message URLTo the Top
Decane
Senior Resident
 

 
On forum: 04/04/2007
Messages: 1690
Smoq2, thank you for trying to help me but that code is a no-go. I have tried many potential solutions but none have worked so far. At this point, I will put this on hold and concentrate on other things; this faction war stuff is taking up way too much of my time.

Again, many thanks for assisting me -- you always were the best at this stuff.
  10:27:57  31 January 2013
profilee-mailreply Message URLTo the Top
smoq2
Forklift operator
(Resident)

 

 
On forum: 09/08/2008
Messages: 2433
The code is ok, it just doesn't affect you getting a capture/eliminate task. It just prevents squads from attacking those places. I'll give it a look later, and see which part is responsible for tasking the player.
 
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.: Clear Sky Forum » Mod discussion
 

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


 

Copyright © 1995-2019 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.