Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Godarcher said:
My question is if anybody happens to know if there is a script to manipulate faction relations

sure, it is the diplomacy related code, which defines the start of a new game relations and the events after it (when to declare wars, etc).

as you are not using Native modsys you will need to search for that code. Look for ID_scripts.py using things like diplomacy and war, like for Native "diplomacy_start_war_between_kingdoms" and "randomly_start_war_peace_new".

Keep looking until you find which code is used at game start (new game).
 
Godarcher said:
I'm fixing some bugs at a module which is not coded by me,
however i'm kinda stuck with one,
When i start the game my seventh faction (of 32) has war declared by all other factions.

so 1: i checked the factions relations in module_factions, nothing crazy there

2: i searched faction_7 troughout the module system, no strange codes tho

3: i followed the faction creation tutorial to check if something is missing but also nothing seems wrong

My best shot at this moment i think would be to manually just set the relations back to what they should be on the script game start

My question is if anybody happens to know if there is a script to manipulate faction relations, as i can only seem to find scripts to manipulate player faction relations
Hm, script_randomly_start_war_peace is responsible for the dynamic war and peace systen afaik. Maybe take a look there if you need to add your new faction there.
 
Just a quick notice that the thread title has been changed following the suggestion posted here.

I hope none of the regulars will mind (if you have further suggestions/doubts feel free to post in the previously mentioned thread or PM me).
 
Yeah, so I think I've managed to make trade with caravans possible. Problem is, when the trade menu opens, the caravan master only has like 3-5 horses, and the clothes on his back for sale (not sure if he'll lose his outfit if I buy it, but still).
Do I just add some stuff to the Caravan Master's inventory in mod_troops, or is there a smarter way to expand his inventory?
 
My mod crashes when clicked Start New Game on Linux and Mac. Trying to fix it but can't get to the root of the problem. Has anyone encountered something similar?
The brf file I put the materials in seems to be a different type. Might it be causing the crash, maybe?

unknown.png
 
Maglubiyet said:
My mod crashes when clicked Start New Game on Linux and Mac. Trying to fix it but can't get to the root of the problem. Has anyone encountered something similar?
The brf file I put the materials in seems to be a different type. Might it be causing the crash, maybe?

unknown.png
Same answer as on the modding discord ^^
TLD has an Official Mac OS X Install Guide, maybe it's giving you ideas what might cause the crashes:
https://steamcommunity.com/workshop/filedetails/discussion/299974223/361787186436486677/#forum_op_361787186436486677
 
Corbul said:
Yeah, so I think I've managed to make trade with caravans possible. Problem is, when the trade menu opens, the caravan master only has like 3-5 horses, and the clothes on his back for sale (not sure if he'll lose his outfit if I buy it, but still).
Do I just add some stuff to the Caravan Master's inventory in mod_troops, or is there a smarter way to expand his inventory?

module_troops.py, look at the difference between a store clerk (like "trp_town_1_weaponsmith") and "trp_caravan_master". Where do you think the inventory of the seller is stored? What is the difference between equipped items and items on the inventory (slot wise)?

that is why you cant trade with the caravan_master like you do with a weaponsmith. So you will need to either trade with the caravan itself (the party) or change how the leader of a caravan (the troop) works/is.
 
Is there a way to make it so that when mounted, all weapons have certain item flags (like can crush through blocks, can knock down, etc) while not having these flags when on foot?
 
Scuba Steve said:
Is there a way to make it so that when mounted, all weapons have certain item flags (like can crush through blocks, can knock down, etc) while not having these flags when on foot?
If it's the same weapon entry, no. You would need a duplicate item entry for each weapon and a script which is switching all weapons when they loose their horse or similar, which sounds a bit too much work imo.
 
Getting a really weird error having to do with store_script_param. My code still has its intended effects, but getting this one in game error. Anyone know whats going on here?

-hUT3.jpg
Dialog:
Code:
[anyone|plyr, "roderick_join",
[],
"We will do great things together, Roderick.", "close_window",
[
(setup_quest_text, "qst_find_work"),
(str_store_string, s2, "@The Warden of Loagenbrook has blamed you for the loss of his rangers, and thus exiled you from the outpost. You are now free of any bonds, to seek out adventure wherever you may find it. However, the threat of the Hernar and of the Blightlings still looms tall..."),
(call_script, "script_start_quest", "qst_find_work"),
(assign, "$g_leave_encounter", 1),
]],


Quest:
Code:
  ("find_work", "Adventure", 0,
  "The Warden of Loagenbrook has blamed you for the loss of his rangers, and thus exiled you from the outpost. You are now free of any bonds, to seek out adventure wherever you may find it. However, the threat of the Hernar and of the Blightlings still looms tall..."
  ), 


Operation:
Code:
store_script_param          =   23  # (store_script_param, <destination>, <script_param_index>),
                                    # Retrieve the value of arbitrary script parameter (generally used when script accepts more than two). Parameters are enumerated starting from 1.


I didn't modify script_start_quest, beginning still looks like this:
Code:
  ("start_quest",
    [(store_script_param, ":quest_no", 1), #error here??? No other quest gets an error other than this one.
     (store_script_param, ":giver_troop_no", 2),

     (quest_get_slot, ":quest_target_center", ":quest_no", slot_quest_target_center),
	 (try_begin),
... etc
 
I'm not sure it's the cause or not but you're passing one parameter to a script that takes two parameters.
[anyone|plyr, "roderick_join",
[],
"We will do great things together, Roderick.", "close_window",
[
(setup_quest_text, "qst_find_work"),
(str_store_string, s2, "@The Warden of Loagenbrook has blamed you for the loss of his rangers, and thus exiled you from the outpost. You are now free of any bonds, to seek out adventure wherever you may find it. However, the threat of the Hernar and of the Blightlings still looms tall..."),
(call_script, "script_start_quest", "qst_find_work"),
(assign, "$g_leave_encounter", 1),
]],
  ("start_quest",
    [(store_script_param, ":quest_no", 1), #error here??? No other quest gets an error other than this one.
    (store_script_param, ":giver_troop_no", 2),

    (quest_get_slot, ":quest_target_center", ":quest_no", slot_quest_target_center),
(try_begin),
... etc

Also you can use these two for the first two parameters.
Code:
store_script_param_1        =   21  # (store_script_param_1, <destination>),
                                    # Retrieve the value of the first script parameter.
store_script_param_2        =   22  # (store_script_param_2, <destination>),
                                    # Retrieve the value of the second script parameter.

EDIT: I wrote a faulty code to check line indexes. As i thought, line indexes are zero-based. Line 1 is the next line.
  ("start_quest",
    [(store_script_param, ":quest_no", 1), #error here??? No other quest gets an error other than this one. #Line No: 0
    (store_script_param, ":giver_troop_no", 2), #Line No: 1

    (quest_get_slot, ":quest_target_center", ":quest_no", slot_quest_target_center),
(try_begin),
... etc
 
Can you store an agent's level? I know you can store a character's level, but I think that's for the campaign, not in-battle. Or does the function work for both?

It's this function;
(store_character_level, ":cur_level", ":cur_troop"),
 
Woyeyeh said:
Can you store an agent's level? I know you can store a character's level, but I think that's for the campaign, not in-battle. Or does the function work for both?

It's this function;
(store_character_level, ":cur_level", ":cur_troop"),
Use this to get agent's troop id.
agent_get_troop_id                    = 1718 # (agent_get_troop_id,<destination>, <agent_id>),
        (try_for_agents, ":cur_agent"),
          (agent_is_human, ":cur_agent"),
          (agent_is_alive, ":cur_agent"),
          (agent_set_slot, ":cur_agent", slot_agent_is_alive_before_retreat, 1),#needed for simulation

          (agent_get_troop_id, ":cur_troop", ":cur_agent"),
          (store_character_level, ":cur_level", ":cur_troop"),

          (val_add, ":cur_level", 5),
          (try_begin),
            (troop_is_hero, ":cur_troop"),
            (val_add, ":cur_level", 5),
          (try_end),
          (try_begin),
            (agent_is_ally, ":cur_agent"),
            (val_add, ":players_side_strength", ":cur_level"),
          (else_try),
            (val_add, ":enemy_side_strength", ":cur_level"),
          (try_end),
        (try_end),
 
Woyeyeh said:
Can you store an agent's level? I know you can store a character's level, but I think that's for the campaign, not in-battle. Or does the function work for both?

It's this function;
(store_character_level, ":cur_level", ":cur_troop"),

like said above you need to reference the "recipe".

Template = TROOP
Instance = AGENT

same goes for party_template x party; item x item instance; prop item x prop instance. For NPCS inside the mission/scene you are using the instance created based on the template, just like you dont eat a cake recipe, you eat the cake  :mrgreen:. If you make 100 cakes, they all still use the same recipe. So all 100 agents of a certain troop are all instances of that troop.
 
kalarhan said:
Woyeyeh said:
Can you store an agent's level? I know you can store a character's level, but I think that's for the campaign, not in-battle. Or does the function work for both?

It's this function;
(store_character_level, ":cur_level", ":cur_troop"),

like said above you need to reference the "recipe".

Template = TROOP
Instance = AGENT

same goes for party_template x party; item x item instance; prop item x prop instance. For NPCS inside the mission/scene you are using the instance created based on the template, just like you dont eat a cake recipe, you eat the cake  :mrgreen:. If you make 100 cakes, they all still use the same recipe. So all 100 agents of a certain troop are all instances of that troop.
When we have gone from examples with cars, illustrated in most programming languages, such as python, to cakes? Kalarhan always innovating...  :grin: :party:
 
Status
Not open for further replies.
Back
Top Bottom