Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Gess1t said:
My second quick question will be:  can i force a certain party to besiege a town even if this one isn't a member of a kingdom?

Like i can force bandit to besiege a town, and then enter instantly in battle with the party when behind the wall

yes and no. Yes you can control the AI flags of any party to give a command like "go attack that town", no as Native bandits are not suppose to siege places (so you will need to modify that as well to then make it possible).

you will need to learn more about AI and how to use flags like "ai_bhvr_travel_to_point".

from the script that controls NPCs behaviour

Code:
(else_try),
            (eq, ":new_ai_state", spai_besieging_center),
            
            (party_get_position, pos1, ":new_ai_object"),
            (map_get_random_position_around_position, pos2, pos1, 2),
            (party_set_ai_behavior, ":party_no", ai_bhvr_travel_to_point),
            (party_set_ai_target_position, ":party_no", pos2),
            (party_set_ai_object, ":party_no", ":new_ai_object"),
            (party_set_flags, ":party_no", pf_default_behavior, 0),
            (party_set_slot, ":party_no", slot_party_follow_me, 1),
            (party_set_slot, ":party_no", slot_party_ai_substate, 0),
            
            (try_begin),
              (gt, ":party_is_in_town", 0),
              (neq, ":party_is_in_town", ":new_ai_object"),
              (party_detach, ":party_no"),
            (try_end),
            
            (assign, ":aggressiveness", 1),
            (assign, ":courage", 9),
            (assign, ":initiative", 20),
            #(assign, ":initiative", 100),
 
kalarhan said:
Gess1t said:
My second quick question will be:  can i force a certain party to besiege a town even if this one isn't a member of a kingdom?

Like i can force bandit to besiege a town, and then enter instantly in battle with the party when behind the wall

yes and no. Yes you can control the AI flags of any party to give a command like "go attack that town", no as Native bandits are not suppose to siege places (so you will need to modify that as well to then make it possible).

you will need to learn more about AI and how to use flags like "ai_bhvr_travel_to_point".

from the script that controls NPCs behaviour

Code:
(else_try),
            (eq, ":new_ai_state", spai_besieging_center),
            
            (party_get_position, pos1, ":new_ai_object"),
            (map_get_random_position_around_position, pos2, pos1, 2),
            (party_set_ai_behavior, ":party_no", ai_bhvr_travel_to_point),
            (party_set_ai_target_position, ":party_no", pos2),
            (party_set_ai_object, ":party_no", ":new_ai_object"),
            (party_set_flags, ":party_no", pf_default_behavior, 0),
            (party_set_slot, ":party_no", slot_party_follow_me, 1),
            (party_set_slot, ":party_no", slot_party_ai_substate, 0),
            
            (try_begin),
              (gt, ":party_is_in_town", 0),
              (neq, ":party_is_in_town", ":new_ai_object"),
              (party_detach, ":party_no"),
            (try_end),
            
            (assign, ":aggressiveness", 1),
            (assign, ":courage", 9),
            (assign, ":initiative", 20),
            #(assign, ":initiative", 100),

in that case, i'll study those script and try to understand what line does and when.
Ths you for  answering my question!

EDIT1: when creating the dialogs for the quest, for some reason, i'm having this appearing in cmd :
Code:
Error: Unrecognized tag:%gin object:%g_talk_troop
ERROR: Illegal Identifier:%g_talk_troop
Error: Unrecognized tag:%gin object:%g_talk_troop
ERROR: Illegal Identifier:%g_talk_troop


with this code :

Code:
[trp_npc_quest_1_survivor_warrior, "start", [
 (troop_slot_eq, "%g_talk_troop", slot_troop_met_previously, 0),
 ], "Hello Sire, i have a problem that you can probably solve.", "warrior_survivor_d_1",[]],
 [trp_npc_quest_1_survivor_warrior|plyr, "warrior_survivor_d_1", [], "What's the problem ?", "warrior_survivor_d_2", [
  (troop_set_slot, "%g_talk_troop", slot_troop_met_previously, 1),
  ]],
  [trp_npc_quest_1_survivor_warrior|plyr, "warrior_survivor_d_1", [], "Got other problems on the hand .", "close_window",[]],
  [trp_npc_quest_1_survivor_warrior, "warrior_survivor_d_2", [], "Well, our problem is big, sticky and have eaten all my friends.\
 He's probably on the way to our actual position.", "warrior_survivor_d_3",[]],
  [trp_npc_quest_1_survivor_warrior|plyr, "warrior_survivor_d_3", [], "How can i help you ?", "warrior_survivor_d_4",[]],
  [trp_npc_quest_1_survivor_warrior|plyr, "warrior_survivor_d_3", [], " (censored) .", "close_window",[]],
  [trp_npc_quest_1_survivor_warrior,"warrior_survivor_d_4", [], "Killing this 'thing' is probably\
 the best way to help me, we'll have to wait for it here", "warrior_survivor_d_5",[]],
  [trp_npc_quest_1_survivor_warrior|plyr, "warrior_survivor_d_5", [], "Alright, i'll help you", "warrior_survivor_d_6",[]],
  [trp_npc_quest_1_survivor_warrior|plyr, "warrior_survivor_d_5", [], "I've to do other things before i can help you", "close_window",[]],
  [trp_npc_quest_1_survivor_warrior, "warrior_survivor_d_6", [], "Thanks you sire, the 'thing' will be here in about 3 days", "close_window",[]],

there is no reason that this error appear as "%g_talk_troop" appear more than 1000 times in this script.
 
I need help with a specific thing. I want to give the fake houses a texture on the back. Im working on a large town and I plan to use alot of theese fake houses since they really capture the medieval city feeling. But the problem is that on the back of them there is a ugly mirrorish mess. I tried opening the texture for the houses but There is nothing there to edit the back. How would I go about doing this? I want to simply ad a brick stone texture or something to the back.
 
Lokameister said:
I need help with a specific thing. I want to give the fake houses a texture on the back. Im working on a large town and I plan to use alot of theese fake houses since they really capture the medieval city feeling. But the problem is that on the back of them there is a ugly mirrorish mess. I tried opening the texture for the houses but There is nothing there to edit the back. How would I go about doing this? I want to simply ad a brick stone texture or something to the back.

I hope that you realise that fake houses are designed to be seen from a distance. They lack collision meshes so the player can walk right through their walls. They are normally only deployed in the non-playable areas of a scene - behind ai barriers. They're just there to optimise performance in surrounding areas.
 
Another quick question.  :facepalm:
Where would I find the code which makes factions hostile against each other (if there is one). I would like three of my new factions to be at war with each other when the game starts.
Thanks - Max
 
For bandits, the player faction, and any new factions you add without them owning any locations, module_factions.py defines factions relations with eachother.

However, if you are talking about major factions with towns, castles, villages, castles, and lords, you should look to script_randomly_start_war_peace_new in module_scripts.py. From there you can cause the factions to declare war, or add a check to prevent those factions from ever declaring peace with eachother (search in the script where it calls the declare peace script and add an neq statement making sure your factions arent involved). You can also go straight in script_game_start and call the script diplomacy_start_war_between_kingdoms.
 
NPC99 said:
Lokameister said:
I need help with a specific thing. I want to give the fake houses a texture on the back. Im working on a large town and I plan to use alot of theese fake houses since they really capture the medieval city feeling. But the problem is that on the back of them there is a ugly mirrorish mess. I tried opening the texture for the houses but There is nothing there to edit the back. How would I go about doing this? I want to simply ad a brick stone texture or something to the back.

I hope that you realise that fake houses are designed to be seen from a distance. They lack collision meshes so the player can walk right through their walls. They are normally only deployed in the non-playable areas of a scene - behind ai barriers. They're just there to optimise performance in surrounding areas.

Well other than them there only seems to be small houses and huts. Do you know of any good pack I can download that contains some more buildings for making a town? Most native scenes are made using fake houses I think? I have went into edit mode and flown over some native towns and behind all the buildings is just the lack of textures. But I want to make a actual town that you can walk around in more freely and fly over and see in detail.
 
gsanders said:
Mike12096 said:
Hello,
I started to get back to modding my warband mod via using Rubik's Custom Commander's source codes as my base mod when after I implemented JRider's Nobility Titles I stumbled upon a problem. Every lord have incorrect titles that aren't even their own factions titles but also are female ones...

57al3ehy85fytyozg.jpg
ranr61pfjexrlr1zg.jpg

All I did was simply use both Floris Expanded source code and lazeras KAOS Political source code as a way to guide me on how to better install and understand how JRider's titles work and what-not.

  KAOS Political also implements titles.  Especially if you have added even 1 new faction, be concerned about getting titles changed twice, once by the change you think YOU added, and again by KAOS, in two different places.  KAOS is extremely difficult to work with if you have more factions than native, as it creates up to 3 times as many factions to account for rebellions and so on, and this will impact your data model as well.  You could use W.R.E.C.K. to warn you of duplicate script names and then hunt down the conflicting definitions via "find in files" the last part of the script name (leave off  script_  in your search and just use the last part of the script name so it can find all uses of the script).  If you have for example 7 factions but you defined only 6 titles, the 7th title will be whatever string followed the 6th title as defined in module_strings.  Its likely both KAOS and your other custom titles code point to different strings for titles, so you see a mix from each.

Oh man. You're not off on the factions. You see, I'm using Custom Commander Rebellion and Restoration and that is somewhat like Kaos but without the nice heir and becoming a king features. One thing I noticed is that in Kaos the vanilla factions are under the rebel factions which basically led the titles to be like the ones in my screenshots. Anyways after a hugeload of hours editing constants, factions, strings, and a script or two with trial and error I finally got it to work for now. I'll have to further test to see how the titles respond with claimants randomly taking a portion of a faction and see if they screw up or not.

Thank you for pointing out where to begin man.
 
How do I make the player join a siege defense?

This is my current code:
Code:
	(try_begin),
		(eq, "$current_town", "p_town_2"),
		(check_quest_active, "qst_protect_blackmyre"),
		(jump_to_menu, "mnu_blackmyre_hernar_prepare_attack"),
	(try_end),

Code:
    ("blackmyre_hernar_prepare_attack",0,
   "The Hernar prepare their attack on Blackmyre...",
   "none",
   [
          (set_background_mesh, "mesh_pic_town1"),
        (party_get_battle_opponent, ":besieger_party", "$current_town"),
        (store_faction_of_party, ":encountered_faction", "$g_encountered_party"),
        (store_relation, ":faction_relation", ":encountered_faction", "fac_player_supporters_faction"),
        (try_begin),
          (gt, ":besieger_party", 0),
          (ge, ":faction_relation", 0),
          (store_faction_of_party, ":besieger_party_faction", ":besieger_party"),
          (store_relation, ":besieger_party_relation", ":besieger_party_faction", "fac_player_supporters_faction"),
          (lt, ":besieger_party_relation", 0),
          (assign, "$g_defending_against_siege", 1),
          (assign, "$g_siege_first_encounter", 1),
          (jump_to_menu, "mnu_siege_started_defender"),
        (try_end),
		],
    [
      ("continue",[], "Continue...",
       [
    (set_spawn_radius,15),
    (spawn_around_party,"p_castle_4","pt_hernar_attackers"),
    (assign, ":spawned_party_id", reg0),
	(party_add_members, ":spawned_party_id", "trp_vaegir_skirmisher", 20),
	(party_add_members, ":spawned_party_id", "trp_vaegir_guard", 20),
	(party_add_members, ":spawned_party_id", "trp_hernar_gothi", 20),
	(party_add_members, ":spawned_party_id", "trp_vaegir_infantry", 20),
	(party_add_members, ":spawned_party_id", "trp_vaegir_archer", 20),
	(party_add_members, ":spawned_party_id", "trp_vaegir_recruit", 80),
       (party_get_position,pos1,"p_town_2"),
       (map_get_random_position_around_position,pos2,pos1,2),
       (party_set_ai_behavior,":spawned_party_id",ai_bhvr_travel_to_point),
       (party_set_ai_target_position,":spawned_party_id",pos2),
       (set_camera_follow_party,":spawned_party_id"),
       (change_screen_return),
	   (assign, "$knightswillshowthemselves", 16),
	   (rest_for_hours, 24*7, 1, 0),
	   
	   ]),
      ]
  ),

Code:
  (5, 0, ti_once,
  [
  (is_currently_night),
  (eq, "$story", 1),
  (eq, "$knightswillshowthemselves", 16), 
  (assign, ":continue", 0),
  (try_for_parties, ":partyonmap"),
	(party_get_template_id, ":template_do", ":partyonmap"),
	(eq, ":template_do", "pt_hernar_attackers"),
	(store_distance_to_party_from_party, ":distan", ":partyonmap", "p_town_2"),
	(lt, ":distan", 3),
	(assign, ":continue", 1),
  (try_end),
  (eq, ":continue", 1),
  ],
  [
  (try_for_parties, ":partyonmap1"),
		(party_get_template_id, ":template_do1", ":partyonmap1"),
		(eq, ":template_do1", "pt_hernar_attackers"),
        (party_set_ai_behavior,":partyonmap1",ai_bhvr_attack_party),
        (party_set_ai_object,":partyonmap1","p_town_2"),
        (party_set_faction,":partyonmap1","fac_kingdom_2"), #so they dont get ganged up on by lords until they reach the town
  (try_end),
  ]),

They do attack the town, but the player does not get prompted to join the defense. At the top of the new menu you can see my attempt to fix this, yet it still does not work. How should I fix this?
 
Having some issues with this code. It is one I had help with some time ago. The main idea is that when a player walks through/behind this type of prop it deals damage to them. Only issue is, sometimes when a player walks behind it, it decides to loop through all or most of the players, dealing damage to them even if they aren't behind. Would appreciate any help on this.

(7, 0, 0, [], [
(multiplayer_is_server),

(assign, ":num_pos", 1),#reserve pos 0 for agents
(try_for_prop_instances, ":instance", "spr_glow_b", somt_object),#if the prop isnt placed via the scene editior, use somt_temporary_object
(prop_instance_get_variation_id_2,":var_2", ":instance"),
(eq, ":var_2", 0),
(prop_instance_get_position, ":num_pos", ":instance"),#stores the current prop position
(val_add, ":num_pos", 1),#sum up positions/props
(try_end),

(gt, ":num_pos", 1),#only continue if there are damaging props on the scene
(try_for_agents, ":agent"),
(agent_is_alive,":agent"),
(neg|agent_is_non_player, ":agent"),#only players
(agent_get_position, pos0,":agent"),
(assign, ":end", ":num_pos"),
(try_for_range, ":pos", 1, ":end"),
(neg|position_is_behind_position, pos0, ":pos"),#found a prop/position that matches the condition
(agent_deliver_damage_to_agent, ":agent", ":agent", 80, itm_admin_kill_dummy),
(assign, ":end", -1),#break loop, agent is already dead
(try_end),
(try_end),
]),
 
Hey!

What is the base speed number for bows, crossbows and throwing weapons and how is the final speed calculated?
I'm not asking for missile speed assigned to every single bow, crossbow and throwing weapon. I need to know what are the base speed numbers that are used later to calculate friction to determine how far will missile fly after being shot/thrown and how is the final speed calculated.
 
Lokameister said:
NPC99 said:
Lokameister said:
I need help with a specific thing. I want to give the fake houses a texture on the back. Im working on a large town and I plan to use alot of theese fake houses since they really capture the medieval city feeling. But the problem is that on the back of them there is a ugly mirrorish mess. I tried opening the texture for the houses but There is nothing there to edit the back. How would I go about doing this? I want to simply ad a brick stone texture or something to the back.

I hope that you realise that fake houses are designed to be seen from a distance. They lack collision meshes so the player can walk right through their walls. They are normally only deployed in the non-playable areas of a scene - behind ai barriers. They're just there to optimise performance in surrounding areas.

Well other than them there only seems to be small houses and huts. Do you know of any good pack I can download that contains some more buildings for making a town? Most native scenes are made using fake houses I think? I have went into edit mode and flown over some native towns and behind all the buildings is just the lack of textures. But I want to make a actual town that you can walk around in more freely and fly over and see in detail.

Instead of using fake_houses.brf use town_houses.brf, town_houses_b.brf, town_houses_c.brf, town_houses_d.brf, town_houses_e.brf etc. They have collision meshes and are fully textured.

pete99 said:
Having some issues with this code. It is one I had help with some time ago. The main idea is that when a player walks through/behind this type of prop it deals damage to them. Only issue is, sometimes when a player walks behind it, it decides to loop through all or most of the players, dealing damage to them even if they aren't behind. Would appreciate any help on this.

(7, 0, 0, [], [
(multiplayer_is_server),

(assign, ":num_pos", 1),#reserve pos 0 for agents
(try_for_prop_instances, ":instance", "spr_glow_b", somt_object),#if the prop isnt placed via the scene editior, use somt_temporary_object
(prop_instance_get_variation_id_2,":var_2", ":instance"),
(eq, ":var_2", 0),
(prop_instance_get_position, ":num_pos", ":instance"),#stores the current prop position
(val_add, ":num_pos", 1),#sum up positions/props
(try_end),

(gt, ":num_pos", 1),#only continue if there are damaging props on the scene
(try_for_agents, ":agent"),
(agent_is_alive,":agent"),
(neg|agent_is_non_player, ":agent"),#only players
(agent_get_position, pos0,":agent"),
(assign, ":end", ":num_pos"),
(try_for_range, ":pos", 1, ":end"),
(neg|position_is_behind_position, pos0, ":pos"),#found a prop/position that matches the condition
(agent_deliver_damage_to_agent, ":agent", ":agent", 80, itm_admin_kill_dummy),
(assign, ":end", -1),#break loop, agent is already dead
(try_end),
(try_end),
]),

For a start, I'd limit try_for_agents to those in close proximity.

try_for_agents    = 12 # (try_for_agents, <destination>, [<position_no>], [<radius_fixed_point>]), #avoid using pos0

Check that you're using the latest header_operations.py.
 
Masterancza said:
What is the base speed number for bows, crossbows and throwing weapons and how is the final speed calculated?
I'm not asking for missile speed assigned to every single bow, crossbow and throwing weapon. I need to know what are the base speed numbers that are used later to calculate friction to determine how far will missile fly after being shot/thrown and how is the final speed calculated.
The engine applies quadratic drag to missiles and the drag factors are defined in module.ini
Code:
air_friction_arrow = 0.002
air_friction_bullet = 0.002

The initial velocity is calculated as follows;
Code:
item_shoot_speed * 1.2
For bows and throwing weapons it is different, since Power Draw / Power Throw (defined as skill) adds a speed bonus;
Code:
item_shoot_speed * SQRT(skill * 0.12 + 1) * 1.2
*edit
Note that the Power Draw bonus is capped at bow difficulty + 4

Now do your calculations.
 
I'm having an issue in NW where I spawn a particular scene prop, and then after cleaning up the prop (using the clean up prop script in NW) the collision mesh remains. Eg. I Spawn a chest prop. After using the prop i send a command to clear it. The actual chest disappears, but its mesh stays in the original spawn position. Is there some way to completely remove a temporary object like this so nothing gets left behind?
 
pete99 said:
I'm having an issue in NW where I spawn a particular scene prop, and then after cleaning up the prop (using the clean up prop script in NW) the collision mesh remains. Eg. I Spawn a chest prop. After using the prop i send a command to clear it. The actual chest disappears, but its mesh stays in the original spawn position. Is there some way to completely remove a temporary object like this so nothing gets left behind?
You have to add either sokf_moveable or sokf_static_movement to the flags of the related scene prop.

sokf_moveable prevents the prop from casting shadows.
 
Is there is other things to do after creating a quest npc take make him spawn in tavern? searched about 3 times il all tavern in the game and never found him , here is the npc code

Code:
["npc_quest_1_survivor_warrior","Survivors_Warriors", "Survivor_Warrior",tf_hero|tf_guarantee_armor, 0,reserved,fac_commoners,
   [itm_sword_medieval_a, itm_tab_shield_pavise_d, itm_spiked_helmet, itm_gauntlets, itm_plate_boots, itm_banded_armor],
   str_20|agi_15|int_10|cha_8|level(20),wp(220),knows_common|knows_power_strike_5|knows_ironflesh_5|man_face_young_2, man_face_middle_1],
 
Gess1t said:
Is there is other things to do after creating a quest npc take make him spawn in tavern?

ask yourself: how is the game suppose to know that NPC should show up in a particular scene? It cant guess, so you need to tell the game to do that.

the easier ways:
- add a scene entry on the troop itself (see module_troops.py comments on start of the file);
- include the spawn order on the normal tavern script (or any other way like a mission template trigger). Look at examples if you are unsure like how the game adds the nervous man on a village, or the drunken on a tavern (both are quest characters).
 
kalarhan said:
Gess1t said:
Is there is other things to do after creating a quest npc take make him spawn in tavern?

ask yourself: how is the game suppose to know that NPC should show up in a particular scene? It cant guess, so you need to tell the game to do that.

the easier ways:
- add a scene entry on the troop itself (see module_troops.py comments on start of the file);
- include the spawn order on the normal tavern script (or any other way like a mission template trigger). Look at examples if you are unsure like how the game adds the nervous man on a village, or the drunken on a tavern (both are quest characters).

yep i saw that but the thing is that we can only set the entry as : scn_reyvadin_tavern, but that'll only make it spawn at the reyvadin one
 
Gess1t said:
yep i saw that but the thing is that we can only set the entry as : scn_reyvadin_tavern, but that'll only make it spawn at the reyvadin one

that is why I listed two options. First is a quick way to a particular scene. Second is generic (spawns in any place you tell it to).
 
Status
Not open for further replies.
Back
Top Bottom