Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
There's the old scene chooser that generates python tuples for each scene in menu format, might want to take a look at that. Basically you tackle a menu option onto the tutorial training ground in the main menu and you're good to go.
 
My cannonball is not seeing the mission objects, its only cares about terrain level. how can i check that collision object kind ? is there any variable to check collision object kind ?
 
HyperCharge said:
My cannonball is not seeing the mission objects, its only cares about terrain level. how can i check that collision object kind ? is there any variable to check collision object kind ?
Use cast_ray to check for collision meshes.
Code:
(cast_ray, <destination>, <hit_position_register>, <ray_position_register>, [<ray_length_fixed_point>]),
# Version 1.161+. Casts a ray starting from <ray_position_register> and stores the closest hit position into <hit_position_register> (fails if no hits). If the body hit is a scene prop, its instance id will be stored into <destination>, otherwise it will be -1.
 
_Sebastian_ said:
HyperCharge said:
My cannonball is not seeing the mission objects, its only cares about terrain level. how can i check that collision object kind ? is there any variable to check collision object kind ?
Use cast_ray to check for collision meshes.
Code:
(cast_ray, <destination>, <hit_position_register>, <ray_position_register>, [<ray_length_fixed_point>]),
# Version 1.161+. Casts a ray starting from <ray_position_register> and stores the closest hit position into <hit_position_register> (fails if no hits). If the body hit is a scene prop, its instance id will be stored into <destination>, otherwise it will be -1.

how couldnt i see that ?

Thank you!  :smile:
 
Create a presentation with a number entry field. Use it to jump to a scene.

Or create a dynamic menu with all scenes in the game (there is a OSP pack for that) using Python.

Or if you can't get those two to work: use any shortcut (like a trigger with a key clicked operation) to jump to a specific scene. Change it on your txt or modules source.
There's the old scene chooser that generates python tuples for each scene in menu format, might want to take a look at that. Basically you tackle a menu option onto the tutorial training ground in the main menu and you're good to go.
Simpler is better. I'm just trying to add entry points.
Why can't I find an option to change the number of already existing entry points? There are lots of them in there
For custom battles, I swapped out the nonfunctioning scenes with one from another mod. I apparently had the wrong name in SceneObb and it lacked entry point 16 which is needed for custom battles.

For my special merchant script, I can't seem to find the town shops or there in the oddest corners of the scenes.
How does the game assign a doorway to a subscene in a town center scene?
Can I reassign the object town shop to a new location?

Also, is there a way to control where an agent spawns when visiting "town_center". I'm looking in MST, but can't see any references to scenes or entry points.
 
Can anyone explain to my why module_mission_template is not consistent with its description.

In the comment block, it says that the first parameter is its id defined as a string, but all the defined lists use either 0, or in other words an int, or some kind of trigger.

Here's an example:
Code:
common_siege_question_answered = (
  ti_question_answered, 0, 0, [],
   [
     (store_trigger_param_1,":answer"),
     (eq,":answer",0),
     (assign, "$pin_player_fallen", 0),
     (get_player_agent_no, ":player_agent"),
     (agent_get_team, ":agent_team", ":player_agent"),
     (try_begin),
       (neq, "$attacker_team", ":agent_team"),
       (neq, "$attacker_team_2", ":agent_team"),
       (str_store_string, s5, "str_siege_continues"),
       (call_script, "script_simulate_retreat", 8, 15, 0),
     (else_try),
       (str_store_string, s5, "str_retreat"),
       (call_script, "script_simulate_retreat", 5, 20, 0),
     (try_end),
     (call_script, "script_count_mission_casualties_from_agents"),
     (finish_mission,0),
     ])

Also the description clearly states that the 4th parameter is a string used to describe a mission, yet that is not the case. Could it just be that the documentation for this thing is obsolete and not updated to follow the current version of the mission_templates?

One more thing. I'm not exactly sure how are missions invoked? I searched all of the files in the module system, but that didn't yield any useful results to me. According to the description of the file, it says that each mission is a tuple. But how are missions handled within the engine? How are they used (as in, how does the game engine handle them - are they simple invoked when the trigger gets called)?

Thanks in advance!  :razz:
 
Those aren't the actual templates, they're blocks of code that get inserted in later on (so for example, the compiler replaces every instance of common_siege_question_answered with that block of code).

Scroll or search for mission_templates, and you'll find where the actual mission templates begin. They're in between two square brackets near the beginning and end of the file.
 
Bithon said:
Can anyone explain to my why module_mission_template is not consistent with its description.

jacobhinds said:
Those aren't the actual templates, they're blocks of code that get inserted in later on (so for example, the compiler replaces every instance of common_siege_question_answered with that block of code).

Scroll or search for mission_templates, and you'll find where the actual mission templates begin. They're in between two square brackets near the beginning and end of the file.

mission_templates = [
  (
    "town_default",0,-1,
    "Default town visit",

a mission template has a header (name, etc) and many triggers, same kind of code you would find on module_triggers.py (so you can read about them there)
 
Hello folks. Would like to ask a few questions here...

1. Is there any command/"if check" to check if party in the opposing team has a certain troop in the middle of a battle? For example in a battle I would like to check if the opposing party has a Swadian Knight; if they do, then X happens. Maybe something like (opposing_party_has_troop, troop_id)?

2. Is there a function that set which troops that would appear in tavern? If there is, where I could find it and what is its name?

Please pardon my broken English. I appreciate the help.  :smile:
 
Specular Shader working incorrect in edit mode

In edit mode, I place the object which using a specular shader, and then exit add object mode, the placed object glowing so intensive.
For example, "light" and "Armor".
hFQawso.jpg
QdVHnwC.jpg

In order to working properly, I have to restart the game. Is Everyone facing such a situation? If there is any solution, please teach me. thanks.
Sorry my bad English.

Specification
ver 1.168  Steam
Video Setting    Max
Video card    Radeon HD5000 series
OS Windows 7
 
Some native single player questions I didn't find exact answer to by searching the forum:

- When a troop currently wielding ranged weapon notices enemy troop is too close, it switches from ranged to melee weapon. But this switch happens too soon for my taste. Is there some modifier which decides at which range the troop switches from ranged to melee, or is this completely hard coded behaviour?

- In general, what is the best way to write new AI rules for individual agent's decision making in scenes?

 
So, for my mod I'm trying to have both a story mode and a free play mode, and I've created this script to get rid of one faction and give their territory to their neighboring faction:
Code:
("cf_free_play", # free mode
 [
	    (eq, "$story", 0),
	    (display_message, "@free play mode isn't finished yet, expect bugs"),
		(assign, ":save_reg0", reg0),
		(assign, reg0, 0),
		(set_show_messages, 0),
    (try_for_parties, ":cur_party"),
      (store_faction_of_party, ":party_faction", ":cur_party"),
      (eq, ":party_faction", "fac_kingdom_2"),
	  (try_begin),
       (is_between, ":cur_party", centers_begin, centers_end),
	   (call_script, "script_give_center_to_faction", ":cur_party", "fac_kingdom_4"),
	  (try_end),
    (try_end),
	(try_for_range, ":lord", 0, kingdom_ladies_end),
	  (call_script, "script_lord_find_alternative_faction", ":lord"),
	  (assign, ":new_faction", reg0),
	  (try_begin),
	   (neq, ":new_faction", "fac_kingdom_2"),
	   (call_script, "script_change_troop_faction", ":lord", ":new_faction"),
	  (else_try),
	   (call_script, "script_change_troop_faction", ":lord", "fac_kingdom_4"),
	  (try_end),
	(try_end),
	(faction_set_slot, "fac_kingdom_2", slot_faction_state, sfs_defeated),
	(assign, reg0, ":save_reg0"),
		(set_show_messages, 1),
		]),

The result was that kingdom 4 (the kingdom that was supposed to take kingdom 2's territory) took the territory of the entire rest of all factions, and kingdom 3 took the territory of kingdom 4 even though it lost it's own. What the ****?
 
Not exactly related to module system, but can you get Steam/VAC banned if you use Cheat Engine & OllyDbg to analyze Warband executable?
 
@HyperCharge
Code:
(ti_on_agent_killed_or_wounded, 0, 0,[
  (store_trigger_param_1, ":dead_agent_no"),
  (store_trigger_param_2, ":attacker_agent_no"),

  (neg|agent_is_human, ":dead_agent_no"), # if is horse
  (agent_get_rider, ":rider_agent", ":dead_agent_no"),
  (agent_is_active, ":rider_agent"),
  
  (try_begin),
    (agent_is_active, ":attacker_agent_no"),  # can be -1 if horse jumps from high altitude
      (agent_deliver_damage_to_agent, ":attacker_agent_no", ":rider_agent", 123456),
  (else_try),
      (agent_deliver_damage_to_agent, ":rider_agent", ":rider_agent", 123456),
  (try_end), 
]),
 
The_dragon said:
@HyperCharge
Code:
(ti_on_agent_killed_or_wounded, 0, 0,[
  (store_trigger_param_1, ":dead_agent_no"),
  (store_trigger_param_2, ":attacker_agent_no"),

  (neg|agent_is_human, ":dead_agent_no"), # if is horse
  (agent_get_rider, ":rider_agent", ":dead_agent_no"),
  (agent_is_active, ":rider_agent"),
  
  (try_begin),
    (agent_is_active, ":attacker_agent_no"),  # can be -1 if horse jumps from high altitude
      (agent_deliver_damage_to_agent, ":attacker_agent_no", ":rider_agent", 123456),
  (else_try),
      (agent_deliver_damage_to_agent, ":rider_agent", ":rider_agent", 123456),
  (try_end), 
]),

Thanks.
 
Status
Not open for further replies.
Back
Top Bottom