 |
 |
 |
|
 |
 |
 |
|
 |
 |
Questions about modding the faction wars |
|
1 2 | Next 10 events »| All Messages |
|
|
23:51:53 26 January 2013 |
|
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?
• Sky Reclamation Project v1.1.2: http://www.moddb.com/mods/srp/downloads/srp-v112
• Sky Reclamation Project v1.1.3 WIP: https://github.com/Decane/SRP
|
22:03:50 28 January 2013 |
|
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.
• Sky Reclamation Project v1.1.2: http://www.moddb.com/mods/srp/downloads/srp-v112
• Sky Reclamation Project v1.1.3 WIP: https://github.com/Decane/SRP
|
|
1 2 | Next 10 events »| All Messages |
|
|
|
» » |
|
All short dates are in Month-Day-Year format. |
 |
|
 |
|
|
|
 |
 |
 |