Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
        (try_for_range, ":value", 1, reg5),
      (assign, reg2, ":value"),
        (store_mul, ":carpan", ":value", 15),
        (str_store_string, s2, "str_at"),
       
      # (str_store_string, s1, s2),
        #(str_store_string, s3, s1),
    #  (display_message, s3),
       
          (create_text_overlay, "$g_sayfa_{reg2}", s2),
          (position_set_x, pos1, 1000),
          (position_set_y, pos1, 1000),
          (overlay_set_size, "$g_sayfa_{reg2}", pos1),
          (position_set_x, pos1, 35),
        (store_sub, ":y", 650,":carpan"),
          (position_set_y, pos1, ":y"),
          (overlay_set_position, "$g_sayfa_{reg2}", pos1),
        (try_end),

I always got the "local variable never used: value" error. As you see I used it two times. So why do I always get this error?
 
minnakodunum said:
        (try_for_range, ":value", 1, reg5),
      (assign, reg2, ":value"),
        (store_mul, ":carpan", ":value", 15),
        (str_store_string, s2, "str_at"),
       
      # (str_store_string, s1, s2),
        #(str_store_string, s3, s1),
    #  (display_message, s3),
       
          (create_text_overlay, "$g_sayfa_{reg2}", s2),
          (position_set_x, pos1, 1000),
          (position_set_y, pos1, 1000),
          (overlay_set_size, "$g_sayfa_{reg2}", pos1),
          (position_set_x, pos1, 35),
        (store_sub, ":y", 650,":carpan"),
          (position_set_y, pos1, ":y"),
          (overlay_set_position, "$g_sayfa_{reg2}", pos1),
        (try_end),

I always got the "local variable never used: value" error. As you see I used it two times. So why do I always get this error?

Are you sure that there is no other variable named "value" that isn't used (in other presentation or trigger) (you can try to use a registry instead of a variable to see if the warning is from here or from somewhere else)?

Also I need to specifie that this trick "$g_sayfa_{reg2}" doesn't work. "$g_sayfa_{reg2}" will be considered as a global variable, with the name "g_sayfa_{reg2}". reg2 isn't replaced when the variable is used. For this you will need to use slots (a troop slot as an array).
 
minnakodunum said:
        (try_for_range, ":value", 1, reg5),
      (assign, reg2, ":value"),
        (store_mul, ":carpan", ":value", 15),
        (str_store_string, s2, "str_at"),
       
      # (str_store_string, s1, s2),
        #(str_store_string, s3, s1),
    #  (display_message, s3),
       
          (create_text_overlay, "$g_sayfa_{reg2}", s2),
          (position_set_x, pos1, 1000),
          (position_set_y, pos1, 1000),
          (overlay_set_size, "$g_sayfa_{reg2}", pos1),
          (position_set_x, pos1, 35),
        (store_sub, ":y", 650,":carpan"),
          (position_set_y, pos1, ":y"),
          (overlay_set_position, "$g_sayfa_{reg2}", pos1),
        (try_end),

I always got the "local variable never used: value" error. As you see I used it two times. So why do I always get this error?

Try to rename the variable to ":value1" at the block, then recompile. If the error message still say about ":value", then the problem is at another part of code.

You can use kt0's extended error message, or  try to use my enhanced process_py to get more informative error messages about variables and other things.
 
Frenzied_Crocoduck_Herder said:
Hello! I'm rewriting the start up dialogue to better fit my mod, and I was wondering where the dialogue that appears after you've selected a starting town is located.
If I've understood you correctly,
Code:
[color=navy]mnu_start_phase_2_5[/color]
references
Code:
"$g_journey_string"
, which can be occupied by the strings from
Code:
str_journey_to_reyvadin
to
Code:
str_journey_to_shariz
. Modify them in module_strings, or, if these are not the strings you're looking for, follow the chain of menus around until you find the ones you seek.
 
minnakodunum said:
        (try_for_range, ":value", 1, reg5),
      (assign, reg2, ":value"),
        (store_mul, ":carpan", ":value", 15),
        (str_store_string, s2, "str_at"),
       
      # (str_store_string, s1, s2),
        #(str_store_string, s3, s1),
    #  (display_message, s3),
       
          (create_text_overlay, "$g_sayfa_{reg2}", s2),
          (position_set_x, pos1, 1000),
          (position_set_y, pos1, 1000),
          (overlay_set_size, "$g_sayfa_{reg2}", pos1),
          (position_set_x, pos1, 35),
        (store_sub, ":y", 650,":carpan"),
          (position_set_y, pos1, ":y"),
          (overlay_set_position, "$g_sayfa_{reg2}", pos1),
        (try_end),


I always got the "local variable never used: value" error. As you see I used it two times. So why do I always get this error?

I fixed this error with replacing ":value" with a registry. I don't know why there was an error.


The_dragon said:
Also I need to specifie that this trick "$g_sayfa_{reg2}" doesn't work. "$g_sayfa_{reg2}" will be considered as a global variable, with the name "g_sayfa_{reg2}". reg2 isn't replaced when the variable is used. For this you will need to use slots (a troop slot as an array).

It works for variables, but not works for item names, strings etc.

My reference:
("test", prsntf_manual_end_only, 0, [
(ti_on_presentation_load, [

(set_fixed_point_multiplier, 1000),

(create_text_overlay, "$g_mouse_helper", "@00,00"),
(overlay_set_color, "$g_mouse_helper", 0xFF0000),
(position_set_x, pos1, 20),
(position_set_y, pos1, 700),
(overlay_set_position, "$g_mouse_helper", pos1),


(scene_prop_get_num_instances, ":num_instance", "spr_pointer_arrow"),
  (try_for_range, ":instance_no", 0, ":num_instance"),
    (scene_prop_get_instance, ":instance_id", "spr_pointer_arrow", ":instance_no"),
(prop_instance_get_position, pos3, ":instance_id"),
(position_get_screen_projection, pos4, pos3),
(assign, reg65, ":instance_no"),
(create_text_overlay, "$g_pointer_overlay_{reg65}", "@0"),
(overlay_set_color, "$g_pointer_overlay_{reg65}", 0x00FF00),
(overlay_set_position, "$g_pointer_overlay_{reg65}", pos4),
(overlay_set_text, "$g_pointer_overlay_{reg65}", "@{reg65}"),
(create_mesh_overlay, ":tmp", "mesh_mp_score_a"),
(overlay_set_position, ":tmp", pos4),
    (try_begin),
    (le, reg65, 10),
    (position_set_x, pos2, 4:cool:,
    (position_set_y, pos2, 4:cool:,
    (else_try),
(gt, reg65, 10),
(position_set_x, pos2, 85),
(position_set_y, pos2, 4:cool:,
(try_end),
(overlay_set_size, ":tmp", pos2),
(try_end),

(presentation_set_duration, 999999),
]),
]),
 
minnakodunum said:
It works for variables, but not works for item names, strings etc.

My reference:
("test", prsntf_manual_end_only, 0, [
(ti_on_presentation_load, [

(set_fixed_point_multiplier, 1000),

(create_text_overlay, "$g_mouse_helper", "@00,00"),
(overlay_set_color, "$g_mouse_helper", 0xFF0000),
(position_set_x, pos1, 20),
(position_set_y, pos1, 700),
(overlay_set_position, "$g_mouse_helper", pos1),


(scene_prop_get_num_instances, ":num_instance", "spr_pointer_arrow"),
  (try_for_range, ":instance_no", 0, ":num_instance"),
    (scene_prop_get_instance, ":instance_id", "spr_pointer_arrow", ":instance_no"),
(prop_instance_get_position, pos3, ":instance_id"),
(position_get_screen_projection, pos4, pos3),
(assign, reg65, ":instance_no"),
(create_text_overlay, "$g_pointer_overlay_{reg65}", "@0"),
(overlay_set_color, "$g_pointer_overlay_{reg65}", 0x00FF00),
(overlay_set_position, "$g_pointer_overlay_{reg65}", pos4),
(overlay_set_text, "$g_pointer_overlay_{reg65}", "@{reg65}"),
(create_mesh_overlay, ":tmp", "mesh_mp_score_a"),
(overlay_set_position, ":tmp", pos4),
    (try_begin),
    (le, reg65, 10),
    (position_set_x, pos2, 4:cool:,
    (position_set_y, pos2, 4:cool:,
    (else_try),
(gt, reg65, 10),
(position_set_x, pos2, 85),
(position_set_y, pos2, 4:cool:,
(try_end),
(overlay_set_size, ":tmp", pos2),
(try_end),

(presentation_set_duration, 999999),
]),
]),

You can't make an array in that way. This simple code prove it:
Code:
(try_for_range, reg1, 1, 6),
	(assign, "$test_var_{reg1}", reg1),
(try_end),
(try_for_range, reg1, 1, 6),
	(assign, reg2, "$test_var_{reg1}"),
	(str_store_string, s1, "@{reg1}:{reg2}"),
	(display_message, s1),
(try_end),
It will show:
1:5
2:5
3:5
4:5
5:5

Using "$random_name" instead of "$g_pointer_overlay_{reg65}" will give you the exact same result.
Your presentation works because you never use the value that "$g_pointer_overlay_{reg65}" holds, but if you would use that variable somewhere (getting the value out), you would notice that the value is the same, despite the reg65's value.
 
The_dragon said:
Using "$random_name" instead of "$g_pointer_overlay_{reg65}" will give you the exact same result.
Your presentation works because you never use the value that "$g_pointer_overlay_{reg65}" holds, but if you would use that variable somewhere (getting the value out), you would notice that the value is the same, despite the reg65's value.

I put this:
(try_for_range, reg1, 1, 6),
(assign, "$test_var_{reg1}", reg1),
(try_end),
(try_for_range, reg1, 1, 6),
(assign, reg2, "$test_var_{reg1}"),
(str_store_string, s1, "@{reg1}:{reg2}"),
(display_message, s1),
(try_end),


Here:

(try_for_range, reg1, 1, 6),
(assign, "$test_var_{reg1}", reg1),

(try_for_range, reg1, 1, 6),
(assign, reg2, "$test_var_{reg1}"),
(str_store_string, s1, "@{reg1}:{reg2}"),
(display_message, s1),
(try_end),
(try_end),


And the result is:
xVQ3An.jpg

I'm not sure if it is an array or not. :grin:

Edit: You are right. It was not what excatly I thought I did. So I need some help with putting an digit at the end of the string id, item id etc.
For example I need check the number and kind of swords with a script, and I have 3 kinds of sword and 4 count for each.
Which means:
itm_kind_1_sword_1
itm_kind_1_sword_2
itm_kind_1_sword_3
itm_kind_1_sword_4
itm_kind_2_sword_1
itm_kind_2_sword_2
.
.
.
 
Thank you Lumos!

**EDIT**

I have another question, would it be possible to give a player troops, through the backstory selection with out editing the player party template?
 
Frenzied_Crocoduck_Herder said:
I have another question, would it be possible to give a player troops, through the backstory selection with out editing the player party template?
Code:
[color=navy](party_add_members, <party_id>, <troop_id>, <number>),[/color]
Though if you're doing that by piggybacking on top of the current system, you'll need a try_ block that checks the journey string and adds the proper troops or something.
 
wat does this mean??

SCRIPT WARNING ON OPCODE 1704: Invalid Agent ID: 571; LINE NO: 6:
At Mission Template mst_lead_charge trigger no: 68 consequences.
At Mission Template mst_lead_charge trigger no: 68 consequences.
At Mission Template mst_lead_charge trigger no: 68 consequences.

happens when script works
http://forums.taleworlds.com/index.php/topic,192161.0.html

added to this mod

http://forums.taleworlds.com/index.php/topic,250920.0.html

see:

ZrQXzyA.jpg

? any clue would be great help pls!

SCRIPT:

dismemberment_mod_decap = (

# Trigger Param 1: damage inflicted agent_id
# Trigger Param 2: damage dealer agent_id
# Trigger Param 3: inflicted damage
# Register 0: damage dealer item_id
# Position Register 0: position of the blow rotation gives the direction of the blow

ti_on_agent_hit, 0, 0, [],
[
  (store_trigger_param_1, ":victim_agent"),
  (store_trigger_param_2, ":attacker_agent"),
  (store_trigger_param_3, ":damage"),
 
  (assign, ":attacker_item", reg0), ### Transfer the item ID to make sure it dosn't change while the script is running
  (copy_position, pos5, pos0), ### Transfer the position of the hit to make sure it dosn't change while the script is running
 
  (neq, ":victim_agent", -1),
 
  (try_begin), #-- Decapitations --#
      (agent_is_human, ":victim_agent"),
  (ge, ":attacker_item", 0),
 
 
  (assign, ":run", 0), ### Reset the run test variable
  (try_begin), ### Special weapons that can decap, ovevrrides the below conditions
  (neq, ":attacker_item", "itm_mace_1"), ### List of weapons that cannot decapitate
  (neq, ":attacker_item", "itm_mace_2"), ### This would be easier to do with a preperty check (for damage type), but I don't know if that is possible or not
  (neq, ":attacker_item", "itm_mace_3"),
  (neq, ":attacker_item", "itm_staff"),
 
  (agent_get_action_dir, ":attack_dir", ":attacker_agent"), ### Makes sure the attack is either a left or right swing
  (this_or_next|eq, ":attack_dir", 1), ### Right swing
  (eq, ":attack_dir", 2), ### Left swing
  (assign, ":run", 1),
  (try_end),
  (eq, ":run", 1), ### One of the checks were true, continue to run script
 
 
  #(assign, reg1, ":damage"), #Debug messages
  #(display_message, "@Damage: {reg1}"),
 
  (assign, ":run", 0), ### Reset the run test variable
  (try_begin),
(ge, ":damage", 10), ### Minimum damage required to decapitate an agent
(assign, ":run", 1),
  (try_end),
  (eq, ":run", 1),
 
  (store_agent_hit_points, ":hp", ":victim_agent", 1),
  (val_add, ":hp", 2), ### Victim must have the negative of this hp or below after hit for the script to move on (never put this value below 0 since the agent has to be absolutley positvely dead)!
  (ge, ":damage", ":hp"),
 
 
  ### Compare the hit position to the agent's position
      (agent_get_position, pos4, ":victim_agent"),
      (get_distance_between_positions, ":distance", pos4, pos5),
  (agent_get_horse, ":is_mounted", ":victim_agent"),
  (try_begin), ### If the agent is on horseback, these values are used (note that these values will not be exactly correct if the horse is very large or very small)
(ge, ":is_mounted", 0), ### Will be -1 if no horse is to be found, so anything above means that the agent is mounted
(assign, ":min_distance", 240), ### Minimum distance from the agent's horse's hooves from which the hit is valid (240 is an approximate value)
(assign, ":max_distance", 260), ### Maximum distance from the agent's horse's hooves to which the hit is valid (260 is an approximate value)
  (else_try),  ### If the agent is on foot, these values are used
    (assign, ":min_distance", 160), ### Minimum distance from the agent's feet from which the hit is valid (160 = slightly below the neck)
    (assign, ":max_distance", 176), ### Maximum distance from the agent's feet to which the hit is valid (176 = near the nose)
  (try_end),
      (is_between, ":distance", ":min_distance", ":max_distance"), ### Check to see if the hit is within the allowed area
 
 
  (assign, ":run", 0), ### Default variable value before damage test
  (try_begin),
  (store_div, ":chance", ":damage", 1), ### Chance of decap is damage / 4 right now. Lower this value for higher chances of decapitation (or press M+Right Ctrl for debug more if you just want to test easy decaps in-game).
 
  #(assign, reg1, ":chance"), #Debug messages
  #(display_message, "@Decap chance is: {reg1}"),
  (store_random_in_range, ":diceroll", 0, 100), ### Randomizer, 0-100
 
  #(assign, reg1, ":diceroll"), #Debug messages
  #(display_message, "@Diceroll: {reg1}"),
  (le, ":diceroll", ":chance"), ### ":diceroll" must be less than or equal to ":chance", if it is, decapitation occurs!
 
  (assign, ":run", 1), ### SUCCESS!
  (try_end), 
  (eq, ":run", 1), ### Time for the fun stuff!

  ### Gender test for spawning the right head type
  (assign, ":head_type", "itm_cut_off_head_male"),
  (agent_get_troop_id, ":victim_troop", ":victim_agent"),
  (try_begin),
    (ge, ":victim_troop", 0),
(troop_get_type,":victim_gender",":victim_troop"),
(eq, ":victim_gender", 1),
(assign, ":head_type", "itm_cut_off_head_female"),
  (try_end),
 
  ### Randomize the spawned head's and/or helmet's position and orientation
  (store_random_in_range, ":z_rotation", 0, 360),
  (store_random_in_range, ":y_rotation", -60, 60),
  (store_random_in_range, ":mad:_pos", -90, 90),
  (store_random_in_range, ":y_pos", -90, 90),
  (position_rotate_z, pos4,":z_rotation"),
  (position_rotate_y, pos4,":y_rotation"),
  (position_move_x, pos4, ":mad:_pos"),
  (position_move_y, pos4, ":y_pos"),
  (position_set_z_to_ground_level, pos4),
  (position_move_z, pos4, 5),
  (set_spawn_position, pos4),
  (assign, ":prunetime", 360), ### This is the time in seconds before the spawned head or helmet gets pruned (removed). Recommended to keep it above 0 to make sure it gets removed eventually or when the scene resets, to prevent performance issues.
 
  #(spawn_item, ":head_type", 0, ":prunetime"), ### This is the old way of spawning the head on the ground with the helmet, disabled because of the new dynamic heads. You can comment away (disable) the dynamic heads spawning further down and uncomment this line for a less performance-needing approach (with no physics involved).
 
  ### Does the agent have a helmet or hat equipped?
      (agent_get_item_slot, ":item", ":victim_agent", 4), #head slot
      (try_begin),
        (ge, ":item", 1), ### Does it?
        (agent_unequip_item, ":victim_agent", ":item"), ### Yes it does. Unequip it to allow replacement by the invisible helmet further down
(try_begin),
### Don't spawn items with "itp_attatch_armature" flag: rigging causes floating bugs
### This would be much better to do with an item flag check, but I haven't found any way to do that
#(neq, ":item", "itm_with_itp_attatch_armature"),
#(neg|is_between,":item","start_of_itm_range_with_itp_attatch_armature","end_of_itm_range_with_itp_attatch_armature"),
#(set_spawn_position, pos4),
(spawn_item, ":item", 0, ":prunetime"), ### Spawns the agent's currently equipped headgear on the dropped head's position
(try_end),
      (try_end),
 
  (agent_equip_item, ":victim_agent", "itm_invisible_head"), ### Put an invisible helmet on the agent's head to "remove" it
 
 
  (agent_get_position, pos4, ":victim_agent"), ### Refreshes the agent's position
  (position_move_z, pos4, ":min_distance"), ### Move to the where the neck used to be attached
 
 
  ### Blood effects! The last variable is the strength. Lower or increase it for more/less blood (or tweak the particle effects themselves in "module_particle_systems.py").
      (particle_system_burst, "psys_blood_decapitation", pos4, 40),
  (particle_system_burst, "psys_game_blood", pos4, 10),
  (particle_system_burst, "psys_game_blood_2", pos4, 10),
 
  (play_sound_at_position, "snd_decapitation", pos4), ### Play some nasty sounds
 
 
  ### Dynamic head spawning! See the bottom of "module_scene_props.py" for physics-related options and more.
  (position_move_z, pos4, 20),
  (set_spawn_position, pos4),
  (assign, ":head_type", "spr_head_dynamic_male"),
  (try_begin), ### Gender check (for determening the type of head)
(eq, ":victim_gender", 1),
(assign, ":head_type", "spr_head_dynamic_female"),
  (try_end),
  (spawn_scene_prop, ":head_type"),
 
 

  ### This below is for the text that shows up when somebody is decapitated.
 
  ### Who decapitated who?
(agent_get_troop_id, ":attacker_troop", ":attacker_agent"),
(str_store_troop_name, s0, ":attacker_troop"),

(agent_get_troop_id, ":victim_troop", ":victim_agent"),
(str_store_troop_name, s1, ":victim_troop"),

 
  ### Colour check (friend or foe?)
  (get_player_agent_no, ":my_agent"),
  (agent_get_team, ":my_team", ":my_agent"),
  (agent_get_team, ":victim_team", ":victim_agent"),
  (try_begin), ### Display it!
  (neq, ":my_team", ":victim_team"),
  (display_message, "@{s0} decapitated {s1}!", 0xFF33DD11), ## Green
  (else_try),
  (display_message, "@{s0} decapitated {s1}!", 0xFFFF4422), ## Red
  (try_end),
  (try_end), #-- Decapitations END --#
 
  ])

see here again:

oTiDrCJ.jpg

?????
 
Carlos Danger said:
It's late, say, if I added a new party template, how do I make said party spawn on the map?

edit: also, how do I make minor factions siege and pillage and stuff.

1. I believe you'd look in either module_triggers.py or module_simple_triggers.py for the code regarding their spawn amount etc. It'd just be a matter of sopying and altering native code. Of course, you'd have to create a spawn point on module_parties.py. just follow the preexisting ones.

2. Not sure if this has been done before - someone else might have the answer, but I assume it'd take a lot of coding.

Bumping:
jacobhinds said:
is there a way to make it so that a building changes the troops recruitable in a settlement?
 
updates:

K5xujT4.jpg

no error for scene  quickbattle
(
    "quick_battle_battle",mtf_battle_mode,-1,
    "You lead your men to battle.",
    [
      (0,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (1,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (2,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (3,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (4,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (5,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (6,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (7,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),

      (8,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (9,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (10,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (11,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (12,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (13,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (14,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (15,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),

      (16,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (17,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (18,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (19,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (20,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (21,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (22,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (23,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),

      (24,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (25,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (26,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (27,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (28,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (29,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (30,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (31,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
    ],
    [
      common_custom_battle_tab_press,
      common_custom_battle_question_answered,
      common_inventory_not_available,

      (ti_before_mission_start, 0, 0, [],
      [
        (scene_set_day_time, 15),
        ]),

      common_battle_init_banner,
     
      (0, 0, ti_once, [],
        [
          (assign, "$g_battle_result", 0),
          (call_script, "script_combat_music_set_situation_with_culture"),
        ]),

      common_music_situation_update,
      custom_battle_check_victory_condition,
      common_battle_victory_display,
      custom_battle_check_defeat_condition,
  dismemberment_mod_decap,
    ],
  ),

ah,no problem battle_siege (for customs)

(
    "quick_battle_siege", mtf_battle_mode,-1,
    "You lead your men to battle.",
    [
      (0,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),
      (1,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),
      (2,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),
      (3,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),
      (4,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),
      (5,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),
      (6,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),
      (7,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),

      (8,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),
      (9,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),
      (10,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),
      (11,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),
      (12,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),
      (13,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),
      (14,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),
      (15,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),

      (16,mtef_visitor_source|mtef_team_1,af_override_horse,aif_start_alarmed,1,[]),
      (17,mtef_visitor_source|mtef_team_1,af_override_horse,aif_start_alarmed,1,[]),
      (18,mtef_visitor_source|mtef_team_1,af_override_horse,aif_start_alarmed,1,[]),
      (19,mtef_visitor_source|mtef_team_1,af_override_horse,aif_start_alarmed,1,[]),
      (20,mtef_visitor_source|mtef_team_1,af_override_horse,aif_start_alarmed,1,[]),
      (21,mtef_visitor_source|mtef_team_1,af_override_horse,aif_start_alarmed,1,[]),
      (22,mtef_visitor_source|mtef_team_1,af_override_horse,aif_start_alarmed,1,[]),
      (23,mtef_visitor_source|mtef_team_1,af_override_horse,aif_start_alarmed,1,[]),

      (24,mtef_visitor_source|mtef_team_1,af_override_horse,aif_start_alarmed,1,[]),
      (25,mtef_visitor_source|mtef_team_1,af_override_horse,aif_start_alarmed,1,[]),
      (26,mtef_visitor_source|mtef_team_1,af_override_horse,aif_start_alarmed,1,[]),
      (27,mtef_visitor_source|mtef_team_1,af_override_horse,aif_start_alarmed,1,[]),
      (28,mtef_visitor_source|mtef_team_1,af_override_horse,aif_start_alarmed,1,[]),
      (29,mtef_visitor_source|mtef_team_1,af_override_horse,aif_start_alarmed,1,[]),
      (30,mtef_visitor_source|mtef_team_1,af_override_horse,aif_start_alarmed,1,[]),
      (31,mtef_visitor_source|mtef_team_1,af_override_horse,aif_start_alarmed,1,[]),

      (32,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),
      (33,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),
      (34,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),
      (35,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),
      (36,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),
      (37,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),
      (38,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),
      (39,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),

      (40,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),
      (41,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),
      (42,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),
      (43,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),
      (44,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),
      (45,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),
      (46,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),
      (47,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),
    ],
    [
      common_battle_mission_start,
      common_battle_init_banner,

      (0, 0, ti_once,
      [
        (assign, "$defender_team", 0),
        (assign, "$attacker_team", 1),
        (assign, "$defender_team_2", 2),
        (assign, "$attacker_team_2", 3),
        ], []),

      (ti_before_mission_start, 0, 0, [],
      [
        (scene_set_day_time, 15),
        ]),

      common_custom_battle_tab_press,
      common_custom_battle_question_answered,
      common_inventory_not_available,
      common_custom_siege_init,
      common_music_situation_update,
      custom_battle_check_victory_condition,
      common_battle_victory_display,
      custom_battle_check_defeat_condition,
      common_siege_attacker_do_not_stall,
      common_siege_refill_ammo,
      common_siege_init_ai_and_belfry,
      common_siege_move_belfry,
      common_siege_rotate_belfry,
      common_siege_assign_men_to_belfry,
      common_siege_ai_trigger_init_2,
  dismemberment_mod_decap,
      ],
    ),

but why then for others?? ???


see village_raid
(
    "village_raid",mtf_battle_mode|mtf_synch_inventory,charge,
    "You lead your men to battle.",
    [
    (3,mtef_defenders|mtef_team_0,af_override_horse,aif_start_alarmed,12,[]),
    (3,mtef_defenders|mtef_team_0,0,aif_start_alarmed,0,[]),
    (1,mtef_attackers|mtef_team_1,0,aif_start_alarmed,12,[]),
    (1,mtef_attackers|mtef_team_1,0,aif_start_alarmed,0,[]),
    ],
    [
      common_battle_tab_press,
      common_battle_init_banner,

      (ti_question_answered, 0, 0, [],
      [(store_trigger_param_1,":answer"),
        (eq,":answer",0),
        (assign, "$pin_player_fallen", 0),
        (str_store_string, s5, "str_retreat"),
        (call_script, "script_simulate_retreat", 10, 20, 1),
        (call_script, "script_count_mission_casualties_from_agents"),
        (finish_mission,0),]),

      (0, 0, ti_once, [], [(assign,"$g_battle_won",0),
                          (assign,"$defender_reinforcement_stage",0),
                          (assign,"$attacker_reinforcement_stage",0),
                          (call_script, "script_combat_music_set_situation_with_culture"),
                          ]),

      common_music_situation_update,
      common_battle_check_friendly_kills,

      (1, 0, 5, [(lt,"$defender_reinforcement_stage",5),#zs:lead_charge_more_reinforcement: 2 => 5#yifeng
                (store_mission_timer_a,":mission_time"),
                (ge,":mission_time",10),
                (store_normalized_team_count,":num_defenders", 0),
                (lt,":num_defenders",6)],
          [(add_reinforcements_to_entry,0,6),(val_add,"$defender_reinforcement_stage",1)]),
      (1, 0, 5, [(lt,"$attacker_reinforcement_stage",5),#zs:lead_charge_more_reinforcement: 2 => 5
                (store_mission_timer_a,":mission_time"),
                (ge,":mission_time",10),
                (store_normalized_team_count,":num_attackers", 1),
                (lt,":num_attackers",6)],
          [(add_reinforcements_to_entry,3,6),(val_add,"$attacker_reinforcement_stage",1)]),

      (1, 60, ti_once,
      [
        (store_mission_timer_a,reg(1)),
        (ge,reg(1),10),
        (all_enemies_defeated, 5),
        (neg|main_hero_fallen, 0),
        (set_mission_result,1),
        (display_message,"str_msg_battle_won"),
        (assign,"$g_battle_won",1),
        (assign, "$g_battle_result", 1),
        (try_begin),
          (eq, "$g_village_raid_evil", 0),
          (call_script, "script_play_victorious_sound"),
        (else_try),
          (play_track, "track_victorious_evil", 1),
        (try_end),
        ],
      [
        (call_script, "script_count_mission_casualties_from_agents"),
        (finish_mission, 1),
        ]),

      common_battle_victory_display,

      (1, 4, ti_once, [(main_hero_fallen)],
          [
              (assign, "$pin_player_fallen", 1),
              (str_store_string, s5, "str_retreat"),
              (call_script, "script_simulate_retreat", 10, 20, 1),
              (assign, "$g_battle_result", -1),
              (set_mission_result,-1),
              (call_script, "script_count_mission_casualties_from_agents"),
              (finish_mission,0)]),

      common_battle_inventory,
      common_battle_order_panel,
      common_battle_order_panel_tick,
############################################################################################################
##### Custom Commander(CC)
############################################################################################################
      common_npc_proficiency_limit,
      common_npc_raise_proficiency,
      common_check_player_can_join_battle,
############################################################################################################
##### Custom Commander(CC)
############################################################################################################

##      #AI Tiggers
##      (0, 0, ti_once, [
##          (store_mission_timer_a,reg(1)),(ge,reg(1),4),
##          (call_script, "script_select_battle_tactic"),
##          (call_script, "script_battle_tactic_init"),
##          ], []),
##      (1, 0, 0, [
##          (store_mission_timer_a,reg(1)),(ge,reg(1),4),
##          (call_script, "script_battle_tactic_apply"),
##          ], []),
      common_dealer_lance_break,
      dplmc_horse_speed,
      fill_agent_empty_wpn_slot,
      agent_weapons_fix,
      custom_commander_special_strike,
      spearwall_trigger_1,
      spearwall_trigger_2,
      spearwall_trigger_3,
      spearwall_trigger_4,
      spearwall_trigger_5,
      spearwall_trigger_6,
      spearwall_trigger_7,
      spearwall_trigger_8,
      spearwall_trigger_9,
      dismemberment_mod_decap,

    ]
  + my_triggers_collection   
  #+ lance_usage
  + order_volley_triggers
  ),


see lead_charge

(
    "lead_charge",mtf_battle_mode|mtf_synch_inventory,charge,
    "You lead your men to battle.",
    [
    (1,mtef_defenders|mtef_team_0,0,aif_start_alarmed,12,[]),
    (0,mtef_defenders|mtef_team_0,0,aif_start_alarmed,0,[]),
    (4,mtef_attackers|mtef_team_1,0,aif_start_alarmed,12,[]),
    (4,mtef_attackers|mtef_team_1,0,aif_start_alarmed,0,[]),
    ],
    [
      (ti_on_agent_spawn, 0, 0, [],
      [
        (store_trigger_param_1, ":agent_no"),
        (call_script, "script_agent_reassign_team", ":agent_no"),

        (assign, ":initial_courage_score", 5000),
                 
        (agent_get_troop_id, ":troop_id", ":agent_no"),
        (store_character_level, ":troop_level", ":troop_id"),
        (val_mul, ":troop_level", 35),
        (val_add, ":initial_courage_score", ":troop_level"), #average : 20 * 35 = 700
       
        (store_random_in_range, ":randomized_addition_courage", 0, 3000), #average : 1500
        (val_add, ":initial_courage_score", ":randomized_addition_courage"),
                 
        (agent_get_party_id, ":agent_party", ":agent_no"),       
        (party_get_morale, ":cur_morale", ":agent_party"),
       
        (store_sub, ":morale_effect_on_courage", ":cur_morale", 70),
        (val_mul, ":morale_effect_on_courage", 30), #this can effect morale with -2100..900
        (val_add, ":initial_courage_score", ":morale_effect_on_courage"),
       
        #average = 5000 + 700 + 1500 = 7200; min : 5700, max : 8700
        #morale effect = min : -2100(party morale is 0), average : 0(party morale is 70), max : 900(party morale is 100)
        #min starting : 3600, max starting  : 9600, average starting : 7200
        (agent_set_slot, ":agent_no", slot_agent_courage_score, ":initial_courage_score"),
        ]),

      common_battle_init_banner,

      (ti_on_agent_killed_or_wounded, 0, 0, [],
      [
        (store_trigger_param_1, ":dead_agent_no"),
        (store_trigger_param_2, ":killer_agent_no"),
        (store_trigger_param_3, ":is_wounded"),

        (try_begin),
          (ge, ":dead_agent_no", 0),
          (neg|agent_is_ally, ":dead_agent_no"),
          (agent_is_human, ":dead_agent_no"),
          (agent_get_troop_id, ":dead_agent_troop_id", ":dead_agent_no"),
##          (str_store_troop_name, s6, ":dead_agent_troop_id"),
##          (assign, reg0, ":dead_agent_no"),
##          (assign, reg1, ":killer_agent_no"),
##          (assign, reg2, ":is_wounded"),
##          (agent_get_team, reg3, ":dead_agent_no"),         
          #(display_message, "@{!}dead agent no : {reg0} ; killer agent no : {reg1} ; is_wounded : {reg2} ; dead agent team : {reg3} ; {s6} is added"),
          (party_add_members, "p_total_enemy_casualties", ":dead_agent_troop_id", 1), #addition_to_p_total_enemy_casualties
          (eq, ":is_wounded", 1),
          (party_wound_members, "p_total_enemy_casualties", ":dead_agent_troop_id", 1),
        (try_end),

        (call_script, "script_apply_death_effect_on_courage_scores", ":dead_agent_no", ":killer_agent_no"),
      ]),

      common_battle_tab_press,

      (ti_question_answered, 0, 0, [],
      [(store_trigger_param_1,":answer"),
        (eq,":answer",0),
        (assign, "$pin_player_fallen", 0),
        (try_begin),
          (store_mission_timer_a, ":elapsed_time"),
          (gt, ":elapsed_time", 20),
          (str_store_string, s5, "str_retreat"),
          (call_script, "script_simulate_retreat", 10, 20, 1),
        (try_end),
        (call_script, "script_count_mission_casualties_from_agents"),
        (finish_mission,0),]),

      (ti_before_mission_start, 0, 0, [],
      [
        (team_set_relation, 0, 2, 1),
        (team_set_relation, 1, 3, 1),
        (call_script, "script_place_player_banner_near_inventory_bms"),

        (party_clear, "p_routed_enemies"),

        (assign, "$g_latest_order_1", 1),
        (assign, "$g_latest_order_2", 1),
        (assign, "$g_latest_order_3", 1),
        (assign, "$g_latest_order_4", 1),
        ]),

     
      (0, 0, ti_once, [], [(assign,"$g_battle_won",0),
                          (assign,"$defender_reinforcement_stage",0),
                          (assign,"$attacker_reinforcement_stage",0),
                          (call_script, "script_place_player_banner_near_inventory"),
                          (call_script, "script_combat_music_set_situation_with_culture"),
                          (assign, "$g_defender_reinforcement_limit", 2),
                          ]),

      common_music_situation_update,
      common_battle_check_friendly_kills,

      (1, 0, 5, [
                             
      #new (25.11.09) starts (sdsd = TODO : make a similar code to also helping ally encounters)
      #count all total (not dead) enemy soldiers (in battle area + not currently placed in battle area)
      (call_script, "script_party_count_members_with_full_health", "p_collective_enemy"),
      (assign, ":total_enemy_soldiers", reg0),
     
      #decrease number of agents already in battle area to find all number of reinforcement enemies
      (assign, ":enemy_soldiers_in_battle_area", 0),
      (try_for_agents,":cur_agent"),
        (agent_is_human, ":cur_agent"),
        (agent_get_party_id, ":agent_party", ":cur_agent"),
        (try_begin),
          (neq, ":agent_party", "p_main_party"),
          (neg|agent_is_ally, ":cur_agent"),
          (val_add, ":enemy_soldiers_in_battle_area", 1),
        (try_end),
      (try_end),
      (store_sub, ":total_enemy_reinforcements", ":total_enemy_soldiers", ":enemy_soldiers_in_battle_area"),

      (try_begin),
        (lt, ":total_enemy_reinforcements", 15),
        (ge, "$defender_reinforcement_stage", 2),
        (eq, "$defender_reinforcement_limit_increased", 0),
        (val_add, "$g_defender_reinforcement_limit", 1),                   
        (assign, "$defender_reinforcement_limit_increased", 1),
      (try_end),   
      #new (25.11.09) ends
     
     
     
     
     
     
      (lt,"$defender_reinforcement_stage","$g_defender_reinforcement_limit"),
                (store_mission_timer_a,":mission_time"),
                (ge,":mission_time",10),
                (store_normalized_team_count,":num_defenders", 0),
                (lt,":num_defenders",6)],
          [(add_reinforcements_to_entry,0,7),(assign, "$defender_reinforcement_limit_increased", 0),(val_add,"$defender_reinforcement_stage",1)]),
     
      (1, 0, 5, [(lt,"$attacker_reinforcement_stage",2),
                (store_mission_timer_a,":mission_time"),
                (ge,":mission_time",10),
                (store_normalized_team_count,":num_attackers", 1),
                (lt,":num_attackers",6)],
          [(add_reinforcements_to_entry,3,7),(val_add,"$attacker_reinforcement_stage",1)]),

      common_battle_check_victory_condition,
      common_battle_victory_display,

      (1, 4, ti_once, [(main_hero_fallen)],
          [
              (assign, "$pin_player_fallen", 1),
              (str_store_string, s5, "str_retreat"),
              (call_script, "script_simulate_retreat", 10, 20, 1),
              (assign, "$g_battle_result", -1),
              (set_mission_result,-1),
              (call_script, "script_count_mission_casualties_from_agents"),
              (finish_mission,0)]),

      common_battle_inventory,

## ZZ comment out for formAI
    # AI Triggers
      (0, 0, ti_once, [
          (store_mission_timer_a,":mission_time"),(ge,":mission_time",2),
          ],
      [(call_script, "script_select_battle_tactic"),
        (call_script, "script_battle_tactic_init"),
        #(call_script, "script_battle_calculate_initial_powers"), #deciding run away method changed and that line is erased
        ]),
## ZZ comment out for formAI
     
      (3, 0, 0, [
          (call_script, "script_apply_effect_of_other_people_on_courage_scores"),
              ], []), #calculating and applying effect of people on others courage scores

      (3, 0, 0, [
          (try_for_agents, ":agent_no"),
            (agent_is_human, ":agent_no"),
            (agent_is_alive, ":agent_no"),         
            (store_mission_timer_a,":mission_time"),
            (ge,":mission_time",3),         
            (call_script, "script_decide_run_away_or_not", ":agent_no", ":mission_time"),
          (try_end),         
              ], []), #controlling courage score and if needed deciding to run away for each agent

      (5, 0, 0, [
          (store_mission_timer_a,":mission_time"),

          (ge,":mission_time",3),
         
          (call_script, "script_battle_tactic_apply"),
          ], []), #applying battle tactic

## ZZ voice
      (0, 0, 0, [(key_is_down,key_f3),(eq,"$last_key",1),], [
(play_sound,"snd_chaging"),
    (assign,"$last_key",13),
  ]),
 
      (0, 0, 0, [(key_is_down,key_f1)], [
(assign,"$last_key",1),
]
), ## ZZ voice  
 
      common_battle_order_panel,
      common_battle_order_panel_tick,
############################################################################################################
##### Custom Commander(CC)
############################################################################################################
      common_npc_proficiency_limit,
      common_npc_raise_proficiency,
      common_check_player_can_join_battle,
############################################################################################################
##### Custom Commander(CC)
############################################################################################################

      common_dealer_lance_break,
      dplmc_horse_speed,
      fill_agent_empty_wpn_slot,
      agent_weapons_fix,
      custom_commander_special_strike,
      spearwall_trigger_1,
      spearwall_trigger_2,
      spearwall_trigger_3,
      spearwall_trigger_4,
      spearwall_trigger_5,
      spearwall_trigger_6,
      spearwall_trigger_7,
      spearwall_trigger_8,
      spearwall_trigger_9,
  dismemberment_mod_decap,

    ]
  + my_triggers_collection   
  #+ lance_usage
  + order_volley_triggers
  ),

errors both give:

village
SCRIPT WARNING ON OPCODE 1704: Invalid Agent ID: 381; LINE NO: 6:
At Mission Template mst_village_raid trigger no: 59 consequences.
At Mission Template mst_village_raid trigger no: 59 consequences.
At Mission Template mst_village_raid trigger no: 59 consequences.

leadcharge
SCRIPT WARNING ON OPCODE 1704: Invalid Agent ID: 571; LINE NO: 6:
At Mission Template mst_lead_charge trigger no: 68 consequences.
At Mission Template mst_lead_charge trigger no: 68 consequences.
At Mission Template mst_lead_charge trigger no: 68 consequences.

:???: ????? why
 
Hello, I would like to know how to get a WFaS Native item texture exported from WFaS/OpenBRF into Photoshop and then back again. I just want to recolour the texture of an already existing item and
I should have installed a dds plugin for Photoshop already. I did follow a tutorial and glanced at some but most of them made no sense for my purpose and were focused on modelling. The one I did follow stopped at exporting static mesh to you desktop which sounded very incomplete.
 
Status
Not open for further replies.
Back
Top Bottom