MBX

Mount&Blade Expansion => Mod Graveyard => Discussion => Topic started by: Winter on May 03, 2007, 12:31:17 am

Title: Ask Winter
Post by: Winter on May 03, 2007, 12:31:17 am
If there was ever anything you wanted to know about the module system but were afraid to ask, some obscure or complicated piece of scripting knowledge or advice that you thought would require a long trek to the dragon's lair, then look no further. This is the thread where you can ask Winter about what happens or what is needed in the dark recesses of the module system.

The only things I ask are:

1) That your questions relate to using the official module system, not to any other part of modding or modelling.

2) That you not throw me really basic stuff which is better left for the FAQ or other parts of this forum.

3) Please be specific. If you're asking about a bug in your code, try to include all related code. If you want to do something complicated, write up a full description. I can't help you if I can't make out what you want to do.

If you obey these simple rules, I'll do what I can to answer you.
Title: Re: Ask Winter
Post by: fujiwara on May 03, 2007, 06:27:47 pm
Could you give as much of a description of the troop_loot_troop operation as you can? I see a lot of potential there, but I'm somewhat unsure of what goes on behind the scenes.
Title: Re: Ask Winter
Post by: Winter on May 04, 2007, 01:12:31 am
Could you give as much of a description of the troop_loot_troop operation as you can? I see a lot of potential there, but I'm somewhat unsure of what goes on behind the scenes.

No problem. Just remember I only know what I can see from the module system, I don't have a back road into Armagan's mind. :P

The operation (troop_loot_troop,<target_troop>,<source_troop>,<probability>) is essentially a random item selection and transferring script. It reads all items present in the source troop, and then calculates a random chance that each item will be added to the target troop according to the Probability input. If an item is added to the target troop, it's given a random modifier from the item's imod list.


In the wider sense of how it's used in Native, it's coupled with two scripts that 1) calculate the Probability argument required for troop_loot_troop, based on the size of "p_main_party" and the amount of loot shares given to each member (party_calculate_shares, module_scripts.py), then 2) iterate over all party stacks of the enemy party, using troop_loot_troop on each stack's troop ID. The target troop here is always trp_temp_troop, whose inventory is pre-cleared. After troop_loot_troop is finished looping over the party stacks, the script calculates the number of items looted by iterating over the inventory slots of trp_temp_troop and counting the number of full slots (party_calculate_loot, module_scripts.py)

Lastly, the player is shown to the loot screen by a (change_screen_loot,"trp_temp_troop"). This arrangement allows a whole party to be looted in only one loot screen.

I hope that's all you were looking for. If you need anything more, ask away!
Title: Re: Ask Winter
Post by: Neophyte on May 04, 2007, 05:55:37 am
It's worth noting that although the script party_calculate_loot does calculate shares using the loot_calculate_loot_shares script it doesn't actually use that value...
Code: [Select]
      (call_script, "script_calculate_party_shares", ":allied_party"),
      (assign, ":num_player_party_shares", reg0),
      (assign, ":num_ally_shares", reg1),
      (store_add, ":num_shares",  ":num_player_party_shares", ":num_ally_shares"),

      (assign, ":num_shares",10),

I have absolutely no idea why it does this.
Title: Re: Ask Winter
Post by: Winter on May 04, 2007, 07:16:19 am
It's worth noting that although the script party_calculate_loot does calculate shares using the loot_calculate_loot_shares script it doesn't actually use that value...
Code: [Select]
      (call_script, "script_calculate_party_shares", ":allied_party"),
      (assign, ":num_player_party_shares", reg0),
      (assign, ":num_ally_shares", reg1),
      (store_add, ":num_shares",  ":num_player_party_shares", ":num_ally_shares"),

      (assign, ":num_shares",10),

I have absolutely no idea why it does this.

Your guess is as good as mine, man.
Title: Re: Ask Winter
Post by: fujiwara on May 04, 2007, 03:19:21 pm
I noticed this too, though I'm with ya'll, unless the script is buggy for some reason.
Title: Re: Ask Winter
Post by: Apollon-04 on May 04, 2007, 03:46:30 pm
This is a fairly basic question, and I'm sorry to have to post it here, but it wasn't in the FAQ.

In what file can I modify the original player classes and their items, stats, etc.
Title: Re: Ask Winter
Post by: Highlander on May 04, 2007, 04:03:07 pm
it's in the very top of module_game_menus
Title: Re: Ask Winter
Post by: Nethros on May 04, 2007, 11:35:17 pm
Ask, Winter.  :lol:

I'll bring up the same question as I brought up once in the FAQ, but didn't really get what was the problem. (My brain is that limited.)


Code: [Select]
Exporting item data...
Traceback <most recent call last>:
  File  "process_items.py", line 59 in ?
    write_items<variables>
  File "process_items.py", line 27, in write items
    ofile.write(" %d %d %d %d %f %d %d %d %d %d %d %d %d %d %d %d %d\n"%(item[3], item[4], item[5], item[7],
IndexError: list index out of range
Title: Re: Ask Winter
Post by: Winter on May 05, 2007, 03:48:57 am
Ask, Winter.  :lol:

I'll bring up the same question as I brought up once in the FAQ, but didn't really get what was the problem. (My brain is that limited.)


Code: [Select]
Exporting item data...
Traceback <most recent call last>:
  File  "process_items.py", line 59 in ?
    write_items<variables>
  File "process_items.py", line 27, in write items
    ofile.write(" %d %d %d %d %f %d %d %d %d %d %d %d %d %d %d %d %d\n"%(item[3], item[4], item[5], item[7],
IndexError: list index out of range

Very simple, syntax error in your module_items.py. Too many fields, or a similar screwup. Look at all the items you've added since before this error appeared, and check them against a known good tuple.
Title: Re: Ask Winter
Post by: DarkAnd on May 25, 2007, 11:09:17 am
i typed the formation code copying and pasting it

Code: [Select]
# script_check_enemies_nearby
# Input: none
# Output: none, fails when enemies are nearby
  ("check_enemies_nearby",
   [
       (get_player_agent_no, ":player_agent"),
       (agent_is_alive, ":player_agent"),
       (try_begin),
         (agent_is_defender, ":player_agent"),
         (assign, ":player_defender", 1),
       (else_try),
         (assign, ":player_defender", 0),
       (try_end),
       (agent_get_position, 1, ":player_agent"),
       (assign, ":result", 0),
       (try_for_agents,":cur_agent"),
         (neq, ":cur_agent", ":player_agent"),
         (agent_is_alive, ":cur_agent"),
         (agent_is_human, ":cur_agent"),
         (try_begin),
           (agent_is_defender, ":cur_agent"),
           (assign, ":agent_defender", 1),
         (else_try),
           (assign, ":agent_defender", 0),
         (try_end),
         (neq, ":player_defender", ":agent_defender"),
         (agent_get_position, 2, ":cur_agent"),
         (get_distance_between_positions, ":cur_distance", 1, 2),
         (le, ":cur_distance", 1500),
         (assign, ":result", 1),
       (try_end),
       (eq, ":result", 0),
    ]),
]
("formation_start",
[(get_player_agent_no,reg(10)),
(agent_get_position,1,reg(10)),
  (try_for_range,reg(20),1,100), #reset of the player dummy-slots
  (agent_set_slot,reg(10),reg(20),0),
  (try_end),
          (try_for_agents,reg(5)),
             (assign,reg(0),0),
             #Not the player
             (neq, reg(5), reg(10)),
             #Not Dead
             (agent_is_alive, reg(5)),
             #Not a Horse?
             (agent_is_human, reg(5)),
             #If the Selected Troop is an Ally
             (agent_is_ally,reg(5)),
           (assign,reg(1),1),
          (try_begin),
             (assign,reg(20),1), #reg(20) is the agent number to use every position only once
             (agent_get_slot,reg(21),reg(10),reg(20)), #player agent used as a dummy not to make several agent use one position
             (eq,reg(21),0), #number isn't used, yet
             (assign,reg(1),reg(20)),
            (assign,reg(3),reg(1)),
            (val_mul,reg(3),100),
            (copy_position,reg(1),1),
            (position_move_x,reg(1),reg(3)), #number 1 = 100 metres right to the player agent 2= 200 etc...
            (agent_set_scripted_destination,reg(5),reg(1)), #tells the agent to run there
             (agent_set_slot,reg(5),1,reg(1)), #tells the agent which position he has - only important if you want to do somethink else with the script, it would work without it right now.
            (agent_set_slot,reg(10),reg(20),1), #tells the game that the number is used, by using the player slots.
          (else_try),
#very odd, sorry (the more call_scripts are there \/, the more agents will build a formation
(call_script,"script_formation_repeat"),(else_try),(call_script,"script_formation_repeat"),(else_try),(call_script,"script_formation_repeat"),(else_try),(call_script,"script_formation_repeat"),(else_try),(call_script,"script_formation_repeat"),(else_try),(call_script,"script_formation_repeat"),(else_try),
(call_script,"script_formation_repeat"),(else_try),(call_script,"script_formation_repeat"),(else_try),(call_script,"script_formation_repeat"),(else_try),(call_script,"script_formation_repeat"),(else_try),(call_script,"script_formation_repeat"),(else_try),(call_script,"script_formation_repeat"),(else_try),
(call_script,"script_formation_repeat"),(else_try),(call_script,"script_formation_repeat"),(else_try),(call_script,"script_formation_repeat"),(else_try),(call_script,"script_formation_repeat"),(else_try),(call_script,"script_formation_repeat"),(else_try),(call_script,"script_formation_repeat"),(else_try),
(call_script,"script_formation_repeat"),(else_try),(call_script,"script_formation_repeat"),(else_try),(call_script,"script_formation_repeat"),(else_try),(call_script,"script_formation_repeat"),(else_try),(call_script,"script_formation_repeat"),(else_try),(call_script,"script_formation_repeat"),(else_try),
(call_script,"script_formation_repeat"),(else_try),(call_script,"script_formation_repeat"),(else_try),(call_script,"script_formation_repeat"),(else_try),(call_script,"script_formation_repeat"),(else_try),(call_script,"script_formation_repeat"),(else_try),(call_script,"script_formation_repeat"),(else_try),
(call_script,"script_formation_repeat"),(else_try),(call_script,"script_formation_repeat"),(else_try),(call_script,"script_formation_repeat"),(else_try),(call_script,"script_formation_repeat"),(else_try),(call_script,"script_formation_repeat"),(else_try),(call_script,"script_formation_repeat"),(else_try),
(call_script,"script_formation_repeat"),(else_try),(call_script,"script_formation_repeat"),
           (try_end),           
          (try_end),
   ]),
("formation_repeat",
 [             (val_add,reg(20),1), # adds 1 to the agent number
             (agent_get_slot,reg(21),reg(10),reg(20)),
             (eq,reg(21),0), # again, is the number already used?
             (assign,reg(1),reg(20)), #just copying the number to use it somewhere else...
            (assign,reg(3),reg(1)), #again copying
            (assign,reg(4),0), #assigns the row of this agent to 0
#-#-#-#-#-#-#-#-#-#
            (try_for_range,reg(15),1,100), #this try-code assigns the right row.
            (assign,reg(17),reg(15)),
            (assign,reg(16),reg(15)),
            (val_mul,reg(15),5), #number of troops in one line
            (val_mul,reg(16),5), #has to be the same as above
            (val_add,reg(16),5), #has to be the same as above
            (gt,reg(3),reg(15)),
            (le,reg(3),reg(16)),
            (assign,reg(15),reg(17)),
            (val_mul,reg(15),6), #number of troops in one line + 1
            (val_sub,reg(3),reg(15)),
            (assign,reg(4),reg(17)),
            (try_end),
#delete these lines to get a 1 line formation
#-#-#-#-#-#-#-#-#-#
            (val_mul,reg(3),100),
            (val_mul,reg(4),200),
            (copy_position,reg(1),1),
            (position_move_x,reg(1),reg(3)),
            (position_move_y,reg(1),reg(4)),
            (agent_set_scripted_destination,reg(5),reg(1)),
             (agent_set_slot,reg(5),1,reg(1)),
            (agent_set_slot,reg(10),reg(20),1),
 ]),

and it says

ERROR: illegal identifier script_formation_start
error: unable to find object script_formation_start

wen i added it at any thing

mission templates

Code: [Select]
  (
    "charge",mtf_battle_mode,charge,
    "You lead your men to the charge",
    [
     (8,mtef_defenders,0,group(1)|aif_start_alarmed,8,[]),
     (9,mtef_defenders,0,group(1)|aif_start_alarmed,0,[]),
     (10,mtef_attackers,0,aif_start_alarmed,8,[]),
     (11,mtef_attackers,0,aif_start_alarmed,0,[]),
     (12,mtef_attackers,0,aif_start_alarmed,0,[]),
     (13,mtef_attackers,0,aif_start_alarmed,0,[]),
     ],
    [
      (ti_tab_pressed, 0, 0, [],
       [
           (try_begin),
             (eq, "$battle_won", 1),
             (finish_mission,0),
           (else_try),
             (call_script, "script_check_enemies_nearby"),
             (question_box,"str_do_you_want_to_retreat"),
           (else_try),
             (display_message,"str_can_not_retreat"),
           (try_end),
        ]),
      (ti_question_answered, 0, 0, [],
       [(store_trigger_param_1,":answer"),(eq,":answer",0),(finish_mission,0),]),

      (0, 0, ti_once, [], [(assign,"$battle_won",0),(assign,"$defender_reinforcement_stage",0),(assign,"$attacker_reinforcement_stage",0)]),
      (1, 0, 5, [(lt,"$defender_reinforcement_stage",2),(store_mission_timer_a,reg(1)),(ge,reg(1),10),(store_defender_count,reg(2)),(lt,reg(2),3)],
           [(add_reinforcements_to_entry,0,4),(val_add,"$defender_reinforcement_stage",1)]),
      (1, 0, 5, [(lt,"$attacker_reinforcement_stage",2),(store_mission_timer_a,reg(1)),(ge,reg(1),10),(store_attacker_count,reg(2)),(lt,reg(2),3)],
           [(add_reinforcements_to_entry,3,4),(val_add,"$attacker_reinforcement_stage",1)]),
      (1, 60, ti_once, [(store_mission_timer_a,reg(1)),
                        (ge,reg(1),10),(all_enemies_defeated,2),
                        (neg|main_hero_fallen,0),
                        (set_mission_result,1),
                        (assign, "$g_battle_result", 1),
                        (display_message,"str_msg_battle_won"),
                        (assign,"$battle_won",1)],
           [(finish_mission,1)]),
      (10, 0, 0, [], [(eq,"$battle_won",1),(display_message,"str_msg_battle_won")]),
      (1, 4, ti_once, [(main_hero_fallen)],
          [
              (assign, "$g_battle_result", -1),
              (set_mission_result,-1),(finish_mission,1)]),
      (ti_inventory_key_pressed, 0, 0, [], [[color=red](call_script, "script_formation_start")[/color],(display_message,"str_formation")]),
    ],
 ),
module items

Code: [Select]
["javelin",         "Javelin", [("javelin",0),("javelins_quiver", ixmesh_carry)], itp_type_thrown |itp_merchandise|itp_primary|itp_bonus_against_shield ,itcf_throw_javelin|itcf_carry_quiver_back|itcf_show_holster_when_drawn, 75 , weight(5)|difficulty(0)|spd_rtng(91) | shoot_speed(28) | thrust_damage(27 ,  pierce)|max_ammo(7)|weapon_length(75),imodbits_missile ],
["formation",         "Long Spear", [("pike",0)], itp_type_thrown |itp_merchandise|itp_primary|itp_bonus_against_shield ,itcf_throw_javelin|itcf_show_holster_when_drawn, 75 , weight(5)|difficulty(0)|spd_rtng(91) | shoot_speed(28) | thrust_damage(27 ,  pierce)|max_ammo(17)|weapon_length(75),imodbits_missile ,[(ti_on_weapon_attack,[(call_script,"[color=red]script_formation_start[/color]")])]],
["stones",         "Stones", [("throwing_stone",0)], itp_type_thrown |itp_merchandise|itp_primary ,itcf_throw_stone, 1 , weight(4)|difficulty(0)|spd_rtng(97) | shoot_speed(30) | thrust_damage(10 ,  blunt)|max_ammo(18)|weapon_length(8),imodbit_large_bag ],
Title: Re: Ask Winter
Post by: Winter on May 25, 2007, 12:02:50 pm
# script_check_enemies_nearby
# Input: none
# Output: none, fails when enemies are nearby
  ("check_enemies_nearby",
   [
       (get_player_agent_no, ":player_agent"),
       (agent_is_alive, ":player_agent"),
       (try_begin),
         (agent_is_defender, ":player_agent"),
         (assign, ":player_defender", 1),
       (else_try),
         (assign, ":player_defender", 0),
       (try_end),
       (agent_get_position, 1, ":player_agent"),
       (assign, ":result", 0),
       (try_for_agents,":cur_agent"),
         (neq, ":cur_agent", ":player_agent"),
         (agent_is_alive, ":cur_agent"),
         (agent_is_human, ":cur_agent"),
         (try_begin),
           (agent_is_defender, ":cur_agent"),
           (assign, ":agent_defender", 1),
         (else_try),
           (assign, ":agent_defender", 0),
         (try_end),
         (neq, ":player_defender", ":agent_defender"),
         (agent_get_position, 2, ":cur_agent"),
         (get_distance_between_positions, ":cur_distance", 1, 2),
         (le, ":cur_distance", 1500),
         (assign, ":result", 1),
       (try_end),
       (eq, ":result", 0),
    ]),
]

There's your problem in bold. That bracket should be at the bottom of your file, not in between scripts, because it closes the list of scripts.

This is the sort of thing that I've stressed heavily in my official documentation. Remember to read it and refer to it often.
Title: Re: Ask Winter
Post by: morgoth2005 on June 01, 2007, 07:12:51 am
Can I edit the trp_player?
Title: Re: Ask Winter
Post by: Highlander on June 01, 2007, 07:17:04 am
you should be able to edit stats, items, face (and I guess faction too). I'm not sure if you are allowed to remove tf_hero, but you should be allowed to add flags.
Title: Re: Ask Winter
Post by: karl1s on June 08, 2007, 10:49:33 am
How can I install the star wars patch? :-[ :-[
Title: Re: Ask Winter
Post by: fujiwara on June 22, 2007, 11:33:10 pm
I've gotten to the point with Onin no Ran where I'm ready to start looking at animating some of the scene props (doors and gates, mostly). The operations relating to this seems straight-forward enough, but I have some questions regarding the scene_prop_get_instance. If I have, for example, a scene with 3 identical houses, each with a door prop. I'd like to close two of the doors, say at night, but leave the third one open. How do I know which instance is which? Looking through the operations, it occurs to me that I could use prop_instance_get_position to compare the distance between each of the door instances and some fixed reference point, but what reference to use? An entry point? Another scene prop?

Also, when designing a door that swings, as opposed to one that slides, is it important to model the mesh so that the 'hinge' is on the Y-axis?

Thanks!!!
Title: Re: Ask Winter
Post by: Winter on June 23, 2007, 07:21:14 am
I've gotten to the point with Onin no Ran where I'm ready to start looking at animating some of the scene props (doors and gates, mostly). The operations relating to this seems straight-forward enough, but I have some questions regarding the scene_prop_get_instance. If I have, for example, a scene with 3 identical houses, each with a door prop. I'd like to close two of the doors, say at night, but leave the third one open. How do I know which instance is which? Looking through the operations, it occurs to me that I could use prop_instance_get_position to compare the distance between each of the door instances and some fixed reference point, but what reference to use? An entry point? Another scene prop?

Your best bet would be to use Entry Point 0 as a fixed reference point, find out the exact distance between each instance and Entry Point 0, and then manually make condition blocks for each of them based on that exact distance.


Quote
Also, when designing a door that swings, as opposed to one that slides, is it important to model the mesh so that the 'hinge' is on the Y-axis?

Thanks!!!

You should be able to animate it however you like regardless of its original position, since you can move the prop along all 3 axes and rotate left and right. Simply test out what happens during the rotation animation and maybe move the door to the side some distance (the distance between the middle axis of the door model and the doorframe) before rotating it.
Title: Re: Ask Winter
Post by: fujiwara on June 23, 2007, 06:04:12 pm
Good call, Winter. Thanks.

Has another quick question: can you explain store_repeat_object and the associated repeat_for_factions, etc?
Title: Re: Ask Winter
Post by: Highlander on June 24, 2007, 02:10:17 am
I had problems with setting health for troops/agents, so I took a look at the code from Hero&Blade:
  (store_troop_health,":player_agent_hp","trp_player",.2),
  [val_sub,":player_agent_hp",10],
  (troop_set_health,"trp_player",":player_agent_hp"),
Could you explain me what ".2" does?
Some other things:
what are the funktions of "position_get_x", "position_set_x", "position_transform_position_to_parent" and "position_transform_position_to_local"?
Title: Re: Ask Winter
Post by: Winter on June 24, 2007, 01:32:05 pm
Good call, Winter. Thanks.

Has another quick question: can you explain store_repeat_object and the associated repeat_for_factions, etc?

I would, but I haven't a clue. No examples exist in Native from which I could deduce their function.


I had problems with setting health for troops/agents, so I took a look at the code from Hero&Blade:
  (store_troop_health,":player_agent_hp","trp_player",.2),
  [val_sub,":player_agent_hp",10],
  (troop_set_health,"trp_player",":player_agent_hp"),
Could you explain me what ".2" does?

You'd have to ask Cartread. The number in that field is supposed to be an absolute value, determining the output of the operation, and the only absolutes you should be able to use in that op are 0 and 1.


Quote
Some other things:
what are the funktions of "position_get_x", "position_set_x", "position_transform_position_to_parent" and "position_transform_position_to_local"?

position_get_x stores the X-axis value of the selected position number. It stores only the X value, not the Y or Z values, which is very handy for detailed modification of positions.

Likewise, position_set_x moves the selected position to the input X value.

Transform operations are further 3d locational things that I'll leave to someone else to figure out. Just model a perfect square and put it in-game, get its prop instance and position, use some transform ops on the position, and then use animate to position. Take screens or a movie. It'll be interesting to see.
Title: Re: Ask Winter
Post by: Hellequin on July 03, 2007, 05:00:52 pm
I worked with those position operators a lot when doing the potion code for Schattenlander.  See the Schattenlander thread - I'm planning to release it publically (unplanned synchronicity with Yoshi).  You can see most of these operators in use there.

For instance:

The weirdest, but incredibly useful, one is position_transform_to_local; this generates a "local position" which is based on the position & axes of a reference position. 

For instance, if my hero were standing at position 1 = (100,0,1), facing (his facing = his +Y object-axis, IIRC) along the global -X axis, and an apple were located at global position 2 = (200, 50, 5), then the local position obtained by transforming the apple's position local-relative-to the player's position would be worked out as:
- The local +Y axis is the global -X axis, displacement of the apple in these terms is -100;
- The local +X is axis is (think about the positioning here) the global +Y axis, displacement of the apple in these terms is +50;
- Their Z axes are the same, so displacement of the apple is +4.
You'd obtain a special result position, position #3, with coordinates (50,-100,4).  It would also have a facing: whatever facing the apple prop had, within the frame of the player.

You *could* in theory work with this as a real position (global pos (50,-100,4), that facing); as far as I can tell, that would be legal, although it would 98% of the time produce gibberish in-game.  However, more likely is that you want to do some local operations within the "frame" dictated by that relative-to-this base position.  For instance, I want the apple to fly 10m (1000 units) in the direction the player is facing.  Without the position_transform_to_local operation, this would have required a whole bunch of getting-of-rotations and so forth, just to figure out what "the direction the player is facing" meant to the apple.  But with this new, local, position, it's easy.  One position_move_y of the result position (NOT the apple's original position) by 1000 units would give it coordinates of (50, 900, 4).  Still meaningless...

...until we then apply the reverse transform, position_transform_position_to_parent.  This turns the now-modified relative position, plus the reference position, into a final position in global terms.  This is a new position, call it position #4; the coordinates would be, um, (-800, 50, 5).  Now we animate the apple prop to move to this position, and it flies 10m in the direction the player was facing... without us ever needing to actually know any of those explicit coordinates I wrote out in this example.

The key is that the local position, position #3, is operating not using the global definitions of X,Y,Z, and facing angles, but the ones based on the object axes of the "parent position" you used in the transform_to_local.  Transforming (or simply assigning) the X,Y,Z, or angles of the local position all work within this frame of reference.  Then you make it relevant to the game by reversing the transform again, using the same parent position*.

* Under certain circumstances you could conceivably use a different parent position for the return.  F'rinstance, a spell which teleported an object found near-and-in-front-of the player, to the exact same relative position with respect to someone else instead, would use the player as the original reference position, do nothing to the local position, then reinterpret it using the target person's position as the parent.  Then animate the prop in question with time=0 to the new position.

Cheers!

PS: For your amusement, this is all very much the thought processes that go into working in General Relativity.  What I described above is exactly how one works a GR problem - work with "geometric and true" quantities as long as you can (for instance, distance_between_positions does not require knowing any X, Y, Z, or facing angles explicitly), then when that's not enough, find a useful frame of reference where the coordinates will be as simple as possible (such as our +1000 in Y, +0 in X and Z), then come back out to the "unframed" viewpoint as soon as you've generated some useful truth within the frame.
Title: Re: Ask Winter
Post by: fujiwara on July 05, 2007, 07:34:35 am
Excellent work, Hellequin. And kudos to Armagan for coming up with it.
Title: Re: Ask Winter
Post by: khakhan on October 23, 2007, 01:46:23 pm
Hey Just the kinda thread I was looking for... I have a question for ya winter..

I'm looking into making pack horses... They would have there own inventory capacity, the horse's would be in the players inventory (when clicked on in the inventory screen would have its own inventory window pop up - or something like that.
Be purchasable thru the horse merch.
Be limited to weight they can carry, (eg.  old pack horse - 1000(animal weight) x .15 = max load (150), heavy/stubborn pack horse - 1000(animal weight) x .25 = max load (250), pack horse - 1000(animal weight) x .2 = max load (200).
Now would it be easier to make the pack horse from a chest and just have the pack horse model?  or make a horse and add inventory to it?
["zendar_chest???","pack_horse", [("sumpter_horse", (0)].........   OR,
 ["sumpter_horse","pack_horse", [("sumpter_horse", (0)].........  if this way how do i assign inventory that the player can access via inventory window?

If that is confusing let me know and i will try to explain more..
My apologies in advance and thanks.. 
Title: Re: Ask Winter
Post by: Winter on October 23, 2007, 01:54:55 pm
Hey Just the kinda thread I was looking for... I have a question for ya winter..

I'm looking into making pack horses... They would have there own inventory capacity, the horse's would be in the players inventory (when clicked on in the inventory screen would have its own inventory window pop up - or something like that.
Be purchasable thru the horse merch.
Be limited to weight they can carry, (eg.  old pack horse - 1000(animal weight) x .15 = max load (150), heavy/stubborn pack horse - 1000(animal weight) x .25 = max load (250), pack horse - 1000(animal weight) x .2 = max load (200).
Now would it be easier to make the pack horse from a chest and just have the pack horse model?  or make a horse and add inventory to it?
["zendar_chest???","pack_horse", [("sumpter_horse", (0)].........   OR,
 ["sumpter_horse","pack_horse", [("sumpter_horse", (0)].........  if this way how do i assign inventory that the player can access via inventory window?

If that is confusing let me know and i will try to explain more..
My apologies in advance and thanks.. 

It's not a question of what would be easier. It's more a question of whether or not it can be done at all, because it's certainly not possible the way you describe it. There are no triggers in the inventory screen that could be modified to produce extra behaviour on mouseclick of an inventory item.

With an alternate trigger, such as a dialogue entry or game menu, it would be a possible but very ugly hack. And the horse couldn't be rideable or it would lose all its inventory if it ever went lame.
Title: Re: Ask Winter
Post by: khakhan on October 23, 2007, 02:57:53 pm
hmmm.. yeah the horse in this case was never meant to be rideable.. just an inventory item acts only like a "chest".  Maybe show up in map mode behind your player (attached caravan grafx behind player horse??)

what about if the pack horse added directly too your inventory mangament skill?  and incorporated a encumberance modifier?

 
Title: Re: Ask Winter
Post by: Winter on October 24, 2007, 01:56:21 am
what about if the pack horse added directly too your inventory mangament skill?  and incorporated a encumberance modifier?

That would be a lot easier to do, although an encumbrance modifier wouldn't really be feasible.

Just create a simple trigger with a timer of 0 or 0.1. Make it raise the player's inventory management skill by the number of pack horses he has in current inventory, minus the number of pack horses he had the last time the trigger checked it (store this in a troop slot on the player or in a global var). This should raise and lower the inventory management skill appropriately.
Title: Re: Ask Winter
Post by: Highlander on October 24, 2007, 05:41:59 am
Is there an easy way to tell if an agent is riding a horse?
Title: Re: Ask Winter
Post by: Winter on October 24, 2007, 06:18:03 am
Is there an easy way to tell if an agent is riding a horse?

Yes. It's done in the new Native code, like so:

                   (agent_get_horse, ":horse_agent", <agent>),
                   (ge, ":horse_agent", 0),
Title: Re: Ask Winter
Post by: Inukshuk on October 25, 2007, 07:32:59 am
I posted a problem in the "strange never before seen assertion errors thread", and to be honest, we all seem a bit confused. I followed parts 1 and 2 of the official documentation for the module system, but after I compile, and click "Start new game" in the main menu, I get this assertion failure. It even happens If you don't change any of the files in the module system (apart from, of course, the directory in module_info.py).

Microsoft Visual C++ Runtime Library                       X
------------------------------------------------------------------
Assertion failed!

Program: C:\Program Files\Mount&Blade\mount&blade.exe
File: e:\develop\mb\program\src\troop.h
Line: 1169

Expression: rgl_between(skill_level,0,(skills[skill_no].max_level + 1))

For information on how your program can cause assertion
failure, see the Visual C++ documentation on asserts

(Press Retry to debug the application - JIT must be enabled)

  Abort                       Retry                      Ignore


We came up with lots of possibilities in that thread, but we still haven't found a solution. Would it be ok if you could quickly drop in on the thread and see if you could throw some light on anything?

This is the thread: http://mbx.streetofeyes.com/index.php/topic,792.0.html (http://mbx.streetofeyes.com/index.php/topic,792.0.html)

My first post is towards the end of page 1, and we keep going from there.
Title: Re: Ask Winter
Post by: Fisheye on October 25, 2007, 08:51:37 am
Too much rubbish on that thread to read.

I've had this error countless times. It's just a misplaced or missing comma.
Title: Re: Ask Winter
Post by: Inukshuk on October 25, 2007, 12:23:28 pm
I'm afriad you are probobably wrong there. I must stress again that I do not need to alter any files in the module system for the error to arise. There isn't a lot of "Rubbish" on that thread, and by reading it you can gain a much better picture of the trouble we are having.
Title: Re: Ask Winter
Post by: Fisheye on October 25, 2007, 01:13:50 pm
Sorry, when I said "rubbish" I meant "a large amount of useful information". Didn't mean to be dismissive.
Title: Re: Ask Winter
Post by: Inukshuk on October 26, 2007, 02:21:41 am
 :lol: I'll give you the benefit of the doubt there.

What I might try and do is look for other people who have this problem, and get them to look at their build_module.bat files. Apparently, even though I'm following the download link for version 0.894, I seem to be getting a previous version of this file. Wierd... ???
Title: Re: Ask Winter
Post by: Ron Losey on October 26, 2007, 03:03:03 am
:lol: I'll give you the benefit of the doubt there.

What I might try and do is look for other people who have this problem, and get them to look at their build_module.bat files. Apparently, even though I'm following the download link for version 0.894, I seem to be getting a previous version of this file. Wierd... ???

Negative ... my last post on the other thread ... the build_module.bat file was changed between .892 and .894 - the advice I gave you was out of date (or, more specifically, valid for .892 but not for .894).  Your file should be fine if used over a clean install of .894.  (Do not use the .894 module system over any older versions - that will crash, due to changes in the module.ini file.)

The problem must be somewhere else.
Title: Re: Ask Winter
Post by: Inukshuk on October 26, 2007, 05:11:13 am
Grrr. I'm gonna do waht grail knight says and compile on my bros pc. I think it could well be something to do with my spec, which would explain why not everyone is having the problem. Not getting my hopes up though.
Title: Re: Ask Winter
Post by: grailknighthero on December 01, 2007, 04:47:19 pm
This is going to sound stupid and it is stupid.  Here is my problem:
This problem has been around since .89x.  I was trying to script in village rebellions and I had it so a party of peasants was spawned and traveled to the player to attack the player.  Once I got this in(but I hadnt got them to attack the player yet, they just traveled to the player and the disappeared) I decided to change it so a battle would happen inside the player's village when the player entered it.  So I commented out the previous code that has the party of peasants travel to the player.....But it still happened.  So I deleted the commented out code from the module system.  And it still happened except the party was somehow changed to the village farmer party.  I was hoping when I updated my version to .901 it would stop, except it hasnt, and it now happens more often.  Before it would happen like once a day(game day), now it happens practically every minute and has become very annoying.  In .89x and .901 I have spent hours searching for any code that would cause this and I have found none.  I have searched for every reference for the village farmer  party and every reference is unchanged native code.  The only thing I can think of is the code that spawns the village farmers is treating the player as a village but it is unchanged and the player is not between villages begin and villages end.  What is going on!
Title: Re: Ask Winter
Post by: Winter on December 01, 2007, 05:38:08 pm
This is going to sound stupid and it is stupid.  Here is my problem:
This problem has been around since .89x.  I was trying to script in village rebellions and I had it so a party of peasants was spawned and traveled to the player to attack the player.  Once I got this in(but I hadnt got them to attack the player yet, they just traveled to the player and the disappeared) I decided to change it so a battle would happen inside the player's village when the player entered it.  So I commented out the previous code that has the party of peasants travel to the player.....But it still happened.  So I deleted the commented out code from the module system.  And it still happened except the party was somehow changed to the village farmer party.  I was hoping when I updated my version to .901 it would stop, except it hasnt, and it now happens more often.  Before it would happen like once a day(game day), now it happens practically every minute and has become very annoying.  In .89x and .901 I have spent hours searching for any code that would cause this and I have found none.  I have searched for every reference for the village farmer  party and every reference is unchanged native code.  The only thing I can think of is the code that spawns the village farmers is treating the player as a village but it is unchanged and the player is not between villages begin and villages end.  What is going on!

ERROR: need more input

Something to think about is that operations (such as spawn operations) don't need a direct reference to a module list entry to do something. All they need is an integer. For example, if you're adding items to a local variable containing the value 0, the game will add items to the player troop, because trp_player = 0. This may be what's happening.

What I'd do is disable any script that spawns parties until it stops happening, and then reincorporate the scripts with feedback messages that tell you if one of these parties is spawning and in which script/trigger.
Title: Re: Ask Winter
Post by: grailknighthero on December 01, 2007, 06:44:05 pm
Ok I just commented out this simple trigger and it fixed the problem.  How is the player being set as the target?  I know it is what you said, 0 means it will affect the player so the target is the player, but I dont know how or why, this is native code and I dont see how the target is set to 0.

Edit: When I put this code back in the problem seemed to have fixed itself.  It doesnt happen anymore, although I need to test it some more.  If it comes up again I think I have an idea of how to fix it.  Ill just put in a check for the target party and if it is the player Ill stop it from being the player.

Code: [Select]
  # Spawn village farmer parties
  (24,
   [
       (try_for_range, ":village_no", villages_begin, villages_end),
         (party_slot_eq, ":village_no", slot_village_state, svs_normal),
         (party_get_slot, ":farmer_party", ":village_no", slot_village_farmer_party),
         (this_or_next|eq, ":farmer_party", 0),
         (neg|party_is_active, ":farmer_party"),
         (store_random_in_range, ":random_no", 0, 100),
         (lt, ":random_no", 30),
         (call_script, "script_create_village_farmer_party", ":village_no"),
         (assign, ":party_no", reg0),
         (party_set_slot, ":village_no", slot_village_farmer_party, ":party_no"),
         (str_store_party_name, s1, ":village_no"),
#         (display_message, "@Village farmers created at {s1}."),
       (try_end),
    ]),
Here's the script
Code: [Select]
("create_village_farmer_party",
   [(store_script_param, ":village_no", 1),
    (party_get_slot, ":town_no", ":village_no", slot_village_market_town),

    (store_faction_of_party, ":party_faction", ":town_no"),
    (set_spawn_radius, 0),
    (spawn_around_party, ":village_no", "pt_village_farmers"),
    (assign, ":new_party", reg0),
     
    (party_set_faction, ":new_party", ":party_faction"),
    (party_set_slot, ":new_party", slot_party_home_center, ":village_no"),
    (party_set_slot, ":new_party", slot_party_type, spt_village_farmer),
    (party_set_slot, ":new_party", slot_party_ai_state, spai_trading_with_town),
    (party_set_slot, ":new_party", slot_party_ai_object, ":town_no"),
    (party_set_ai_behavior, ":new_party", ai_bhvr_travel_to_party),
    (party_set_ai_object, ":new_party", ":town_no"),
    (party_set_flags, ":new_party", pf_default_behavior, 0),
    (store_sub, ":item_to_price_slot", slot_town_trade_good_prices_begin, trade_goods_begin),
    (try_for_range, ":cur_goods", trade_goods_begin, trade_goods_end),
      (store_add, ":cur_good_price_slot", ":cur_goods", ":item_to_price_slot"),
      (party_get_slot, ":cur_village_price", ":village_no", ":cur_good_price_slot"),
      (party_set_slot, ":new_party", ":cur_good_price_slot", ":cur_village_price"),
    (try_end),
    (assign, reg0, ":new_party"),
    ]),
Title: Re: Ask Winter
Post by: Winter on December 02, 2007, 08:00:52 am
Ok I just commented out this simple trigger and it fixed the problem.  How is the player being set as the target?  I know it is what you said, 0 means it will affect the player so the target is the player, but I dont know how or why, this is native code and I dont see how the target is set to 0.

It happens when the slots it's getting contain 0 in the first place, which is easily done due to fooling around by modders (i.e. the slots in question never get set properly in the gamestart script, or their contents get erased at some point).
Title: Re: Ask Winter
Post by: grailknighthero on December 02, 2007, 12:23:58 pm
K, Ill call it in game start then and perhaps in the script that spawns the farmer just to make sure.
Title: Re: Ask Winter
Post by: Llew on December 05, 2007, 09:22:56 pm
Dumb question: Where are the Lord's party templates? I want to edit how many troops they have etc., but I can't find their parties. They don't seem to be in the Party_Templates.
Title: Re: Ask Winter
Post by: Winter on December 06, 2007, 03:10:08 am
Dumb question: Where are the Lord's party templates? I want to edit how many troops they have etc., but I can't find their parties. They don't seem to be in the Party_Templates.

They're not made straight from party templates, they're assembled scriptwise. The base template is pt_kingdom_hero_party, but troops, hero, name and icon are all added via script_create_kingdom_hero_party.
Title: Re: Ask Winter
Post by: Llew on December 06, 2007, 07:22:55 am
Dumb question: Where are the Lord's party templates? I want to edit how many troops they have etc., but I can't find their parties. They don't seem to be in the Party_Templates.

They're not made straight from party templates, they're assembled scriptwise. The base template is pt_kingdom_hero_party, but troops, hero, name and icon are all added via script_create_kingdom_hero_party.

Looked through that whole set of scripts, but I still can't find what I change to give the Lords certain troops.  :-\
Title: Re: Ask Winter
Post by: Fisheye on December 06, 2007, 11:45:37 am
In module_party_templates:

 ("kingdom_1_reinforcements_a", "kingdom_1_reinforcements_a", 0, 0, fac_commoners, 0, [(trp_swadian_footman,3,7),(trp_swadian_skirmisher,5,10),(trp_swadian_militia,11,26)]),
 ("kingdom_1_reinforcements_b", "kingdom_1_reinforcements_b", 0, 0, fac_commoners, 0, [(trp_swadian_man_at_arms,5,10),(trp_swadian_infantry,5,10),(trp_swadian_crossbowman,3,8)]),
 ("kingdom_1_reinforcements_c", "kingdom_1_reinforcements_c", 0, 0, fac_commoners, 0, [(trp_swadian_inquisitor,3,7),(trp_swadian_knight,3,7),(trp_swadian_sergeant,2,5),(trp_swadian_sharpshooter,2,5)]),

The way it works: each party has a desired size, and it randomly selects one of the three templates to add. Repeat until the desired size is met.

Lord parties randomly select from all three, garrisons only select from the first two.
Title: Re: Ask Winter
Post by: Llew on January 07, 2008, 07:38:12 am
I am working on porting HYW, and starting with getting the items ingame. I copied the resources (which are two brf files, I put the lines to make the game read them here:        Is that right?
load_resource = food
load_resource = beards
load_resource = armors_b
load_resource = helmets_b
load_resource = village_houses
load_resource = village_houses_a
load_resource = village_houses_b
load_resource = hair
load_resource = deneme
load_module_resource = HYW4
load_module_resource = HYW4b

I also copied the textures and the from the .751 installation into the .903 one, then I opened the module system and added teh code for two pairs of boots, just to see if it worked. When I started HYW though, I get and RDL error that says "attepting to reregister weapons2.dds (the name of one of the texture files that I moved.)

So, can anyone tell me what I'm doing wrong?
Title: Re: Ask Winter
Post by: Ron Losey on January 07, 2008, 07:49:11 am
I am working on porting HYW, and starting with getting the items ingame. I copied the resources (which are two brf files, I put the lines to make the game read them here:        Is that right?
load_resource = food
load_resource = beards
load_resource = armors_b
load_resource = helmets_b
load_resource = village_houses
load_resource = village_houses_a
load_resource = village_houses_b
load_resource = hair
load_resource = deneme
load_module_resource = HYW4
load_module_resource = HYW4b

I also copied the textures and the from the .751 installation into the .903 one, then I opened the module system and added teh code for two pairs of boots, just to see if it worked. When I started HYW though, I get and RDL error that says "attepting to reregister weapons2.dds (the name of one of the texture files that I moved.)

So, can anyone tell me what I'm doing wrong?

Attempting to reregister something is like if you have "weapons2.dds" listed in two different BRF files, and so to prevent having two different textures with the same name, the game crashes to an error message.

"HYW"?  ".751"?  What is HYW?
Title: Re: Ask Winter
Post by: Llew on January 07, 2008, 08:54:02 am
GandalftheGray's Hundred Years War mod. The last version of it was for .751.
Quote
Attempting to reregister something is like if you have "weapons2.dds" listed in two different BRF files, and so to prevent having two different textures with the same name, the game crashes to an error message.

So how do I go about fixing it? And what do you mean by "listed in two different BRFs?" Does that mean that an item in each BFR uses the same texture (but that doesn't seem right, because it works in the .751 version of the mod.) , and if so, how do I go about eliminating one of them?
Title: Re: Ask Winter
Post by: Ron Losey on January 07, 2008, 11:22:15 am
Start up BRFEdit.  Look through every .BRF file in the game, native and/or the mod, under "textures".  Eventually you will find that you have "weapons2.dds" in two (or more) different places.  Delete (or rename) all but one of them.
Title: Re: Ask Winter
Post by: Llew on January 07, 2008, 12:04:44 pm
I looked through all that I could find, and only found one. I deleted the listing the the BRF and also the actual texture in the Textures file. Now it gives me and RGL error that says "attempt to reregister weapons2". Hmm.
Title: Re: Ask Winter
Post by: fujiwara on February 11, 2008, 02:38:15 pm
Since you're asking for repeat_for_items over on the Taleworlds board, I assume you understand how the repeat_for_xxx works. Can you enlighten us? Thanks!
Title: Re: Ask Winter
Post by: Winter on February 11, 2008, 02:51:30 pm
Since you're asking for repeat_for_items over on the Taleworlds board, I assume you understand how the repeat_for_xxx works. Can you enlighten us? Thanks!

Sure. It's not too difficult, really.

Essentially a repeated dialogue entry iterates over every tuple of the specified type, like a try_for_range for the whole list of troops/factions/parties. You store the currently accessed tuple to a destination by using store_repeat_object. Then you add conditionals to the conditions block as per a normal dialogue entry, for example reading the repeat object's slots, in order to fail entries/hide ones that aren't applicable.

The repeat option will display a dialogue menu option for every tuple which meets all the conditionals, so you have to make sure the game doesn't end up with too many to display, or you'll end up with an assert.
Title: Re: Ask Winter
Post by: fujiwara on February 13, 2008, 02:01:01 pm
So, as an example:

Code: [Select]

[anyone|repeat_for_troops,'start',
     [
          (store_repeat_object,':hero_npc'),
          (troop_is_hero,':hero_npc'),
          ],
     'I am a hero in this mod. Respect my authority!',
     'close_window',
     [],
]

If I understand you correctly, this would be a valid dialog for any hero troops in a given mod?
Title: Re: Ask Winter
Post by: Winter on February 13, 2008, 02:16:56 pm
So, as an example:

Code: [Select]

[anyone|repeat_for_troops,'start',
     [
          (store_repeat_object,':hero_npc'),
          (troop_is_hero,':hero_npc'),
          ],
     'I am a hero in this mod. Respect my authority!',
     'close_window',
     [],
]

If I understand you correctly, this would be a valid dialog for any hero troops in a given mod?

Yep. But remember, that also includes merchants! Be on guard that you thoroughly exclude everything you don't want.
Title: Re: Ask Winter
Post by: KON_Air on February 15, 2008, 06:54:54 am
Code: [Select]
  [trp_combat_teac|plyr|repeat_for_troops,"ask_which_to_train", [
(store_repeat_object, ":troop_no"),
(is_between, ":troop_no", companions_begin, companions_end),
(main_party_has_troop,":troop_no"),
(str_store_troop_name, s1, ":troop_no")],
   "{s1}", "other_train",[(store_repeat_object, "$hero_to_train")]],

"is_between", is solution to everything.
Title: Re: Ask Winter
Post by: Winter on February 15, 2008, 08:34:44 am
Code: [Select]
  [trp_combat_teac|plyr|repeat_for_troops,"ask_which_to_train", [
(store_repeat_object, ":troop_no"),
(is_between, ":troop_no", companions_begin, companions_end),
(main_party_has_troop,":troop_no"),
(str_store_troop_name, s1, ":troop_no")],
   "{s1}", "other_train",[(store_repeat_object, "$hero_to_train")]],

"is_between", is solution to everything.

Well, almost everything.
Title: Re: Ask Winter
Post by: 风Wind过 on February 17, 2008, 09:28:49 am
试发。

Fisheye translates: "Winter, could you please ban me?"
Title: Re: Ask Winter
Post by: DSparil on February 21, 2008, 03:45:05 pm
I have a question. I have many non-lord parties a la old war parties, commanded by heroes. I have been trying to give each one custom dialogs, but they always just yell the generic "you have no chance against us, surrender blah blah" and "you rascal, youll pay for this". I have tried many times, using the vanilla dialogs as a base, but I just can't seem to get it right. Can anyone help me? I want the "formula" for custom dialog when the party attacks the player, when the player gives the ultimatum, and when the party encounters the player after having fought in the past.
Title: Re: Ask Winter
Post by: Winter on February 21, 2008, 07:39:55 pm
I have a question. I have many non-lord parties a la old war parties, commanded by heroes. I have been trying to give each one custom dialogs, but they always just yell the generic "you have no chance against us, surrender blah blah" and "you rascal, youll pay for this". I have tried many times, using the vanilla dialogs as a base, but I just can't seem to get it right. Can anyone help me? I want the "formula" for custom dialog when the party attacks the player, when the player gives the ultimatum, and when the party encounters the player after having fought in the past.

I ran into this with Storymod C2, and ended up having to write a custom script that ensures you speak to the highest-level member troop of any party.

You may have to adapt it to your own needs, seeing as it's designed to be called from a game menu, but here it is:

Code: [Select]
(party_get_num_companion_stacks,":num_stacks","$g_encountered_party"),
(assign,":current_level",0),
(try_for_range,":range",0,":num_stacks"),
(party_stack_get_troop_id,":troop","$g_encountered_party",":range"),
(store_character_level,":level",":troop"),
(gt,":level",":current_level"),
(assign,":current_level",":level"),
(assign,":meeting_troop",":troop"),
(party_stack_get_troop_dna,":dna","$g_encountered_party",":range"),
(try_end),
(call_script,"script_setup_troop_meeting",":meeting_troop",":dna"),
Title: Re: Ask Winter
Post by: DSparil on February 23, 2008, 11:00:36 am
Thanks  :)

I have another one:

When a lord gets captured, the message is messed up like "March 4, 1265 of poor was captured by Lord blah of blah"
Maw posted the fixed script:
Code: [Select]
       (try_begin),
               (ge, ":rand", hero_escape_after_defeat_chance),

#mod this to count victorious troops uninjured, and add it as a bonus to catch the lord
               (party_add_prisoners, ":nonempty_winner_party", ":cur_troop_id", 1),

             (else_try),
               (gt, reg0, 10),
               (troop_set_slot, ":cur_troop_id", slot_troop_is_prisoner, 1),
               (str_store_troop_name, s1, ":cur_troop_id"),
               (str_store_faction_name, s2, ":faction_receiving_prisoners"),
               (str_store_faction_name, s3, ":defeated_faction"),
               (display_log_message,"@{s1} of {s3} was captured by {s2}."),
             (else_try),
               (str_store_troop_name, s1, ":cur_troop_id"),
               (str_store_faction_name, s2, ":faction_receiving_prisoners"),
               (str_store_faction_name, s3, ":defeated_faction"),
               (display_log_message,"@{s1} of {s3} was defeated in battle but managed to escape."),
             (try_end),

           (try_end),

           (party_get_num_prisoner_stacks, ":num_stacks", ":collective_casualties"),

Horewer, it doesn't seem to work for me. The messages simply dissapear, I can't tell whether a lord was captured or escaped anywhere in Calradia. It does happen, as I run into parties with lords as prisioners, but the report just doesn't show up. I have tried  tweaking the script many times, to see if it changed anything, but I couldn't  make it work.
Title: Re: Ask Winter
Post by: KON_Air on February 23, 2008, 11:15:26 am
Use display_message and try not to use s1 to s5 in scripts. They get updated with date strings automatically.
Title: Re: Ask Winter
Post by: DSparil on February 26, 2008, 04:49:50 pm
Thanks, that worked, althoug I had to edit it a bit. Anyways. Another one. Im trying to increase the size of lord parties, they currently spawn with 50 to 70 soldiers, I want that to be around 120 for common lords. Increasing the reinforcement party templates only seems to affect the garrisons. I have also tried this small piece of code from BOW, that goes in "script_party_get_ideal_size":
Code: [Select]
###################################################################################
# Modified Party Size Scripts for Band of Warriors v903a100
###################################################################################
(val_mul, ":limit", 2.5), #BoW: party sizes x1.5
(val_div, ":limit", 2), #BoW: party sizes x1.5
###################################################################################
# End Modified Party Size Scripts for Band of Warriors v903a100
###################################################################################
When I tried it, not much changed, so I increased the multiplier and then some lords got bigger parties, while others stayed the same. So, I want to know what do I have to edit to increase lord parties?
Title: Re: Ask Winter
Post by: Winter on February 26, 2008, 05:46:53 pm
Thanks, that worked, althoug I had to edit it a bit. Anyways. Another one. Im trying to increase the size of lord parties, they currently spawn with 50 to 70 soldiers, I want that to be around 120 for common lords. Increasing the reinforcement party templates only seems to affect the garrisons. I have also tried this small piece of code from BOW, that goes in "script_party_get_ideal_size":
Code: [Select]
###################################################################################
# Modified Party Size Scripts for Band of Warriors v903a100
###################################################################################
(val_mul, ":limit", 2.5), #BoW: party sizes x1.5
(val_div, ":limit", 2), #BoW: party sizes x1.5
###################################################################################
# End Modified Party Size Scripts for Band of Warriors v903a100
###################################################################################
When I tried it, not much changed, so I increased the multiplier and then some lords got bigger parties, while others stayed the same. So, I want to know what do I have to edit to increase lord parties?

Add more reinforcement party templates to the kingdom hero parties in the script where they're spawned.
Title: Re: Ask Winter
Post by: DSparil on February 26, 2008, 06:40:36 pm
Thanks, Ill try that. Anyways, I had never realized just how helpfull  the MBX community is. Kudos for that.
Title: Re: Ask Winter
Post by: Fisheye on February 26, 2008, 07:00:50 pm
The party hero spawn script adds reinforcement templates until either the "preferred size" is reached or the faction runs out of cash. My modification above increases the preferred size slightly.

Remember this is only for newly spawned parties so existing parties will not be affected.
Title: Re: Ask Winter
Post by: Kolba on March 01, 2008, 03:18:46 am
I just added four heroes into my mod and ran with following error:

http://img468.imageshack.us/img468/2779/errorthingvz2.jpg

Here are my lines of code:
 
Quote
  ["ealfrith","Ealfrith","Ealfrith",tf_hero, 0, reserved, fac_commoners,[itm_leather_jerkin,itm_suttonhoo,itm_sword,itm_nomad_boots,itm_viking_ax,itm_leather_gloves,itm_saddle_horse],knight_attrib_1|level(30),wp(180),knows_common,0x000000000000000101c0008040008240],
  ["boadicea","Boadicea","Boadicea",tf_female|tf_hero, 0, reserved, fac_commoners,[itm_mail_hauberk,itm_suttonhoo,itm_sword,itm_nomad_boots,itm_viking_ax,itm_courser],knight_attrib_1|level(43),wp(130),knows_common,girl_face1],
  ["millar","Millar","Millar",tf_hero, 0, reserved, fac_commoners,[itm_linen_tunic,itm_leather_boots,itm_sickle,itm_scythe,itm_smoked_fish],def_attrib|str_8|agi_7|int_8|level(5),wp(60),knows_inventory_management_3|knows_athletics_2,0x00000000000c840001f8c0a4ab8ad50a],
  ["merlin","Merlin","Merlin",tf_hero, 0, reserved, fac_commoners,[itm_gallicmail,itm_leather_boots,itm_speara,itm_celtsword_a],def_attrib|str_10|agi_15|int_20|level(32),knows_surgery_4|knows_athletics_3|knows_first_aid_7|knows_spotting_8,0x00000000000c840001f8c0a4ab8ad50a],


What I did wrong?

Title: Re: Ask Winter
Post by: Ron Losey on March 01, 2008, 04:14:06 am
Kolba:  comment out all but one of them, run it, repeat, until you figure out which one (or ones) has the problem.  That will reduce it to one bugged entry instead of four, and thereby increase the chances of finding the bug by 4x. (I can't see it... but that surely doesn't mean it isn't there.)

Run the process of elimination first.  Then the process of figuring out the problem.
Title: Re: Ask Winter
Post by: Winter on March 01, 2008, 04:43:39 am
You've made your troops too high-level and set their starting attributes too high, they're ending up with more skill and attribute points than the game will allow.
Title: Re: Ask Winter
Post by: Ron Losey on March 01, 2008, 04:59:07 am
You've made your troops too high-level and set their starting attributes too high, they're ending up with more skill and attribute points than the game will allow.

Does it randomly add points for every level like that?  I thought the opening attributes applied to whatever level they were set to.

I mean, yeah, the error says something is set higher than the max value ... but usually that happens when you put two commands knows_common and knows_X such that they add up to more than 10.  I didn't know there were random points added too.
Title: Re: Ask Winter
Post by: Winter on March 01, 2008, 07:00:50 am
Does it randomly add points for every level like that?  I thought the opening attributes applied to whatever level they were set to.

It adds 1 point to attributes and skills for every level of the character, in addition to the base attributes.
Title: Re: Ask Winter
Post by: Ron Losey on March 01, 2008, 07:36:52 am
Does it randomly add points for every level like that?  I thought the opening attributes applied to whatever level they were set to.

It adds 1 point to attributes and skills for every level of the character, in addition to the base attributes.

Randomly to a skill?  And with no check to see if it goes over allowable limits, I suppose?  Or is there some system to which ones it weights?  Oh, wait, it adds the attribute randomly, and then only adds to the skills that are an option for that level of attribute, doesn't it?  So then it crashes if it tries to raise a skill over the legal limit?  I'm trying to get a picture of how this works, in reality ... because we've all seen that error a few dozen times, on totally different mods and with no real pattern at all.

This is one bit of code that I never really played with, but I should.  It somewhat relates to stuff I do.  But it's easier to ask than to mess with it for days to figure it out.
Title: Re: Ask Winter
Post by: Kolba on March 01, 2008, 07:58:55 am
Thanks Winter and Ron! I'd try to decrease heroes skills and test it in game.

OK. The problem seems to be fixed - I didn't encountered any crashes.
Title: Re: Ask Winter
Post by: DSparil on March 03, 2008, 11:55:53 am
Is there any way to make sure that a troop uses the reinforced version of an armor/helmet?
Title: Re: Ask Winter
Post by: Winter on March 03, 2008, 02:05:32 pm
Is there any way to make sure that a troop uses the reinforced version of an armor/helmet?

Give the troop the reinforced version and only the reinforced version of the item. Otherwise, no way to do it.

Although I suppose you could write a nasty custom script to strip out normal items and give them the modifier you want, but like I said, that's really nasty.
Title: Re: Ask Winter
Post by: DSparil on March 03, 2008, 04:26:53 pm
Well, what I have been doing so far is create an alternate reinforced version of an item, making it use the reinforced mesh, and increasing its stats, etc. But I had to give them the unique flag so that they don't show up as loot. But now I need that flag for true "unique items", to use the give_special_loot script, like in BOW.
Title: Re: Ask Winter
Post by: Fisheye on March 04, 2008, 11:19:06 am
Just add the reinforced items manually at game start using troop_add_item. It's not so bad.
Title: Re: Ask Winter
Post by: DSparil on March 06, 2008, 09:35:00 am
I have another one. Ill explain.

As I mentioned before, I had parties commanded by custom, named troops, npcs wannabes if you will. I didn't want them to get killed or captured, so i tried the unkillable and no_capture_alive flags, but they didn't seem to do anything. Why not just make them npcs? because I have enabled the posibility of lord capture, and the script works on them too, so they get captured, a new party spawns (since they use regular party templates, like bandits for example), and suddenly I got two guys who are supposed to be the same. I added a dialog so that automatically talk to the player and escape after beaten by him, but they get defeated by other parties as well, so its still a problem. Any ideas?
Title: Re: Ask Winter
Post by: Winter on March 06, 2008, 11:53:34 am
I have another one. Ill explain.

As I mentioned before, I had parties commanded by custom, named troops, npcs wannabes if you will. I didn't want them to get killed or captured, so i tried the unkillable and no_capture_alive flags, but they didn't seem to do anything. Why not just make them npcs? because I have enabled the posibility of lord capture, and the script works on them too, so they get captured, a new party spawns (since they use regular party templates, like bandits for example), and suddenly I got two guys who are supposed to be the same. I added a dialog so that automatically talk to the player and escape after beaten by him, but they get defeated by other parties as well, so its still a problem. Any ideas?

unkillable doesn't work, no_capture_alive just means that the troop will always die rather than be captured.

You'll have to make your troops into heroes, and include code in your new party spawning to remove the troop in question from the party after spawn.
Title: Re: Ask Winter
Post by: grailknighthero on March 21, 2008, 10:18:24 pm
Why doesn't this work like I want it to?  Instead of going to the exchange members screen, it goes to battle.
Code: [Select]
[anyone,"start", [(eq,"$talk_context",tc_party_encounter),
                    (eq, "$character_race", 1),
                    (eq,"$g_encountered_party_template","pt_roaming_undead"),
                    ],
   "...", "roaming_undead_party_encounter_force_join",[]],
  [anyone|plyr, "roaming_undead_party_encounter_force_join", [], "Follow me!", "close_window",[(change_screen_exchange_members,0),]],

Title: Re: Ask Winter
Post by: Fisheye on March 21, 2008, 10:31:14 pm
I think the change-screen exchange members thing might only work in certain contexts.
Title: Re: Ask Winter
Post by: fujiwara on March 22, 2008, 08:23:34 am
Speaking of stuff only working in certain contexts, has anyone tried to compile which operations work where? For example, it seems rest_for_hours and rest_for_hours_interactive now only works from game_menus, where pre-v.89x, it worked from dialogs also (the inn dialogs).
Title: Re: Ask Winter
Post by: grailknighthero on March 22, 2008, 10:13:13 am
I tried a few months ago to get it to work from dialogs (what fujiwara is talking about) and it didnt work.

@Fisheye there is a native dialog similar to mine with companions.  When you tell a companion to meet you later there is dialog to give you the option of giving the companion troops and uses something like what Ive got.  I just tried out the native code and it works.  Ill mess around later today with it.  I think the only difference is that mine is through a party encounter.  So what I need help on is how to make it so there isnt a battle.

Edited:  I got a way for it to work by modifying the simple encounter game menu to go to another menu and then have the menu call the change_screen_exchange_members.
Title: Re: Ask Winter
Post by: grailknighthero on March 23, 2008, 02:10:55 pm
Ok, sorry for the double post, but I got a different problem now with slots that I can’t figure out.  I have changed mercenaries for one of my factions, to where if the culture of a town is the culture of that faction, it uses a different set of mercenaries and adds the troop type and the amount to the mercenary slots just like it does normally.  The only difference is that there is a troop that is always in the tavern that you talk to that allows you to hire the troops (a necromancer).  The problem is that the number of mercenaries is always the number of how many necromancers there are, which is always one.  This should be impossible because the amount of mercenaries is a number between 3 and 11.  Here is my code.  I know it is a lot but any help is appreciated.  I can’t figure out how the amount stored in the slot_center_mercenary_troop_amount gets changed to 1.  My only guess is it has something to do witwh the amount of necromancers in the tavern.

Code: [Select]
bunch of code was here but I cleaned it all up
Title: Re: Ask Winter
Post by: Winter on March 23, 2008, 02:23:29 pm
#module_dialogs.py
[trp_necromancer, "start", [(eq, "$talk_context", tc_tavern_talk),
                     (party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_troop_type),
                     (party_get_slot, ":mercenary_amount", "$g_encountered_party", slot_center_mercenary_troop_amount),
                     (gt, ":mercenary_amount", 0),
                     (assign, reg3, ":mercenary_amount"),
                     (call_script, "script_game_get_join_cost", ":mercenary_troop"),
                     (assign, ":join_cost", reg0),
                     (val_sub, ":join_cost", 5),
                     (store_mul, reg5, ":mercenary_amount", reg0),
                     (party_get_free_companions_capacity, ":free_capacity", "p_main_party"),
                     (val_min, ":mercenary_amount", ":free_capacity"),                     (store_troop_gold, ":cur_gold", "trp_player"),
                     (try_begin),
                       (gt, ":join_cost", 0),
                       (val_div, ":cur_gold", ":join_cost"),
                       (val_min, ":mercenary_amount", ":cur_gold"),                     (try_end),
                     (assign, "$temp", ":mercenary_amount"),
                     (str_store_troop_name_plural,s19,":mercenary_troop"),
                     ],
   "I raise the dead for a fee, do you want me to raise {reg3} {s19} for {reg5} silver?", "necro_tavern_talk", []],

You're using val_min pretty indiscriminately here, which is a bad idea, and I think it's making your calculations turn out different from what you intended. I don't have the time nor patience for an in-depth analysis but I'm confident that "$temp" is getting an incorrect value assigned to it because of these val_min ops.
Title: Re: Ask Winter
Post by: grailknighthero on March 23, 2008, 03:13:45 pm
That is actually native code, and I put a display message right after it got the value from the slot, and the value was 1.  I have taken the code for the native mercenaries and edited it to my own needs.
Title: Re: Ask Winter
Post by: Winter on March 23, 2008, 03:30:03 pm
That is actually native code, and I put a display message right after it got the value from the slot, and the value was 1.  I have taken the code for the native mercenaries and edited it to my own needs.

Well, in that case, is the town where you're testing it maybe of kingdom_2?

'Cause, um . . .

            (party_set_slot, ":town_no", slot_center_mercenary_troop_amount, 1),
Title: Re: Ask Winter
Post by: grailknighthero on March 23, 2008, 04:39:22 pm
Wow....I dont know how that got in there.  Thanks.
Title: Re: Ask Winter
Post by: KON_Air on March 26, 2008, 04:48:43 pm
Speaking of stuff only working in certain contexts, has anyone tried to compile which operations work where? For example, it seems rest_for_hours and rest_for_hours_interactive now only works from game_menus, where pre-v.89x, it worked from dialogs also (the inn dialogs).

Sorry about not seeing that before, you have finish the mission and return to world map in order to get it work... The ancient dialouge option modified to function;

bla, bla, bla, conditions and string,
Quote
  [(assign, reg(2), 13),(val_sub,reg(2),reg(1)),(assign, "$g_town_visit_after_rest", 1),(rest_for_hours, reg(2)),(troop_remove_gold, "trp_player","$tavern_rest_cost"),(call_script, "script_change_player_party_morale", 2),
   (finish_mission,0),
    (change_screen_return),]],
Title: Re: Ask Winter
Post by: fujiwara on March 27, 2008, 06:40:51 pm
Thanks for that...this will fix a very irksome bug.
Title: Re: Ask Winter
Post by: RTWfreak132 on April 13, 2008, 05:21:32 pm
Does anybody know about any bugs using BRFedit?  every time I load a brf file into brfedit, I get a permissions error?

************** Exception Text **************
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at loadCompressedTexture(UInt32 tex, SByte* fileIn, BImage* image, Boolean mod)
   at CreateTexture(UInt32 tex, SByte* filename, BImage* image1)
   at loadMapModel(Int32 modelNum, Resource* meshIn, Mesh** mesh2, SByte* texture, SByte* mbPath, SByte* module, Int32 type, Int32 timeIn, Int32 renderType, Boolean wireframe, Boolean color, Boolean light, Int32 selBone, Boolean face, Scene* scene, Boolean positionAnim, Int32* textures, Int32 reachVal)
   at BRFEdit.Form1.resetDisplay()
   at BRFEdit.Form1.renderScene(Boolean initIt)
   at BRFEdit.Form1.updateMeshes()
   at BRFEdit.Form1.meshList_SelectedIndexChanged(Object sender, EventArgs e)
   at System.Windows.Forms.ListBox.OnSelectedIndexChanged(EventArgs e)
   at System.Windows.Forms.ListBox.WmReflectCommand(Message& m)
   at System.Windows.Forms.ListBox.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


any ideas?
Title: Re: Ask Winter
Post by: grailknighthero on April 16, 2008, 10:38:51 pm
Have you, or anyone else worked with spt_x's?  I added spt_mercenary = 21 and it screwed up all of the types of my parties.  Changing it to 14 no longer messes up my parties, but if I try to use spt_mercenary nothing happens.

I am messing with the .808 party template spawns (patrols, scouts, etc) and I have added to it so mercenary parties are spawned.  But,

If I set the chance for a spt_mercenary party to spawn at 100%, none spawn, and none of below display messages show, even though the party type is spt_mercenary.
Code: [Select]
(taken from script_cf_create_kingdom_party)
(else_try),
        (eq, ":party_type", spt_mercenary),
        (assign, ":party_template", "pt_hired_mercenaries_party"),
        (display_message, "@party temp assigned"),

Code: [Select]
(else_try),
          (eq, ":party_type", spt_mercenary),
          (display_message, "@before pt add"),
          (party_add_template, ":result", "pt_mercenaries_c"),
          (display_message, "@after pt add"),

I know the script is being called because I have a display message showing right before the script call, but nothing happens.  I am assuming that something is wrong with spt_mercenary and even though I pass it in, nothing happens.

@RTWfreak132, go onto the taleworlds forums and ask on the brfedit topic.
Title: Re: Ask Winter
Post by: Winter on April 17, 2008, 01:29:05 am
The problem with your spt_mercenary is that it has no new code attached to it. Just because you slapped in a new constant doesn't mean the game knows what to do with it. You have to code in that functionality yourself, for example in the script game_event_party_encounter. The game has several bits that key on party type and I've used them extensively for the Storymod Chapter 2 war system, so believe me they work fine.
Title: Re: Ask Winter
Post by: grailknighthero on April 17, 2008, 06:52:04 am
The code for it that I have added is:

Code: [Select]
(taken from the trigger that spawns all the kingdom secondary parties)
(try_begin),
        (this_or_next|eq, ":cur_kingdom", "fac_kingdom_1"),
        (this_or_next|eq, ":cur_kingdom", "fac_kingdom_3"),
        (eq, ":cur_kingdom", "fac_kingdom_5"),
        (store_random_in_range, ":random_no", 0, 100),
        (lt, ":random_no", 100),
        (display_message, "@before script call"),
        (call_script, "script_create_kingdom_party_if_below_limit", ":cur_kingdom", spt_mercenary),
(try_end),

Code: [Select]
(taken from script_cf_create_kingdom_party)
(else_try),
        (eq, ":party_type", spt_mercenary),
        (assign, ":party_template", "pt_hired_mercenaries_party"),
        (display_message, "@party temp assigned"),

(else_try),
          (eq, ":party_type", spt_mercenary),
          (display_message, "@before pt add"),
          (party_add_template, ":result", "pt_mercenaries_c"),
          (display_message, "@after pt add"),

It seems to me like this is the only code that spawns lets say a patrol, and my patrols spawn fine.
Title: Re: Ask Winter
Post by: Winter on April 17, 2008, 07:28:09 am
. . . Okay, so what's the problem? You've still not explained what it is that's wrong with it.
Title: Re: Ask Winter
Post by: grailknighthero on April 17, 2008, 08:19:42 am
I dont know what is wrong with it.  No mercenary parties spawn, even though the chance to spawn is 100%, and the messages in the script do not display.  The display message in the triggers displays right before the script call, but once the script is called, nothing happens if the spt is set to mercenary.

Edit:  Somehow deleting quick strings, tag uses, and variable uses fixed the problem...Sorry for my stupidity.

Title: Re: Ask Winter
Post by: fujiwara on April 20, 2008, 09:49:44 pm
I recommend deleting those files at every compile. I wrote a process_init.py file to do just that. I realize they get overwritten, but I've seen stranger things happen.
Title: Re: Ask Winter
Post by: grailknighthero on April 21, 2008, 03:18:09 pm
This isnt the first time something like this has happened to me, and I should have known from the beginning.  All I need to do is this right:
try:
  os.remove(export_dir + 'variable_uses.txt')
except:
  a = []

Well ya, that's what it does for quick strings and tag uses, but I just want to make sure so I dont screw anything up.  I've never messed with deleting files with python, just creating files and folders.
Title: Re: Ask Winter
Post by: fujiwara on May 01, 2008, 10:41:51 pm
EXACTLY!

My process_init.py code:

Code: [Select]
from module_info import *
import os

print "Initializing..."

try:
os.remove(export_dir + 'tag_uses.txt')
except:
pass
try:
os.remove(export_dir + 'quick_strings.txt')
except:
pass

I don't typically delete variable_uses.txt everytime, but it certainly wouldn't hurt. Pretty much anything the module system generates (quick_strings.txt, tag_uses.txt, variables.txt, variable_uses.txt) can be deleted without consequence.
Title: Re: Ask Winter
Post by: grailknighthero on May 02, 2008, 02:53:07 pm
Sorry, I should have stated that I figured it out awhile ago.  Ill make sure mine is like yours when I have time to mod again.
Title: Re: Ask Winter
Post by: fujiwara on May 03, 2008, 08:52:36 am
I would NOT delete variable_uses.txt; That's where the compiler stores all the globals it finds as it compiles. I tried it, and it forgot all the globals, so I got this horde of "Usage of undeclared global variable" messages.
Title: Re: Ask Winter
Post by: Kolba on June 17, 2008, 08:00:48 am
I tried making some conversations, but while "building module" encountered some weird problems

Code: [Select]
C:\Documents and Settings\andrzej\Moje dokumenty\modulesystem\ModuleSystem>python process_dialogs.py
exporting triggers...
exporting dialogs...
********************************************************************************
**
********************************************************************************
**
ERROR: INPUT TOKEN NOT FOUND:ulric_e
********************************************************************************
**
********************************************************************************
**
Traceback (most recent call last):
  File "process_dialogs.py", line 121, in <module>
    compile_sentence_tokens(dialogs)
  File "process_dialogs.py", line 90, in compile_sentence_tokens
    cause_error()
NameError: global name 'cause_error' is not defined
Aby kontynuować, naciśnij dowolny klawisz . . .


Here is mine conversation:

Code: [Select]
[trp_ulric,"start", [], "Who are you? You'll not get anything from me!", "ulric_aa",[]],
  [trp_ulric|plyr,"ulric_aa", [], "What are you talking about?", "ulric_b",[]],
  [trp_ulric,"ulric_b", [], "Excuse me sir, I am really old and I'm often talking about stupid things. Do you know my story? No? Listen...my name is Ulric. I was born in town of Zendar. My father signed up to Swadian army, went to West Territories and never came back. My mother died few years later. I had nothing to do, so like my father I joined Swadian Army. With my only one companion and friend Rolf, I fought many battles, killed many Vaegirs and outlaws. Finally, King Harlaus allowed us to became knights. After that, we went with army to the West Territories in search of my father. We found an old, looks abandoned keep. We explored all rooms, but didn't find anybody! I decided to sleep here, since there were many beds upstairs. Next day, I woke up early and I was going to talk with Rolf, but he wasn't there, where he should be. I thought that he went outside of keep, but sadly ALL THE CASTLE WAS EMPTY! I dind't find any soldiers! I left keep and tried to look for them in near areas, but with no results. Finally, I decided to go alone to the West and find father. It was a long way, too big to tell you. I found another castle, but little bigger. In the courtyard I found...my father lying on the grass! He was death. I found a letter. It was for me...", "ulric_c",[]],
  [trp_ulric|plyr,"ulric_c", [], "And what happened next?", "ulric_d",[]],
  [trp_ulric,"ulric_d", [], "If you want to know, give me mystic potion. It's in town, where Sea Raiders land. I'll give you my lore book.", "ulric_da",[]],
  [trp_ulric|plyr,"ulric_da", [],  [(player_has_item,"itm_vial")], "Here you are...", (troop_remove_item,0,"itm_vial"),(troop_add_item, "trp_player","itm_lore_book"), "ulric_e",[]],
  [trp_ulric|plyr,"ulric_da", [], "I'll try to search.", "close_window",[]],
  [trp_ulric,"ulric_e", [], "When I was opening letter, ten or eleven undeads jumped from castle tower to me. They tried to kill me, but at the last moment Rolf appeared and throw away few of them. We escaped, because more and more undeads appeared. Suddenly, I saw the fog and lost from eyes Rolf. Then, I felt hard hit on head and I don't remember anything more...", "close_window",[]],


I know probably what's the problem - symbols "[]" before dialogue text are wrong placed in "ulric_da" line. Where should I put them? And I'm not sure about having/removing/adding items scheme in this line - does it work?




Title: Re: Ask Winter
Post by: grailknighthero on June 18, 2008, 12:07:26 am
[trp_ulric|plyr,"ulric_da", [],  [(player_has_item,"itm_vial")], "Here you are...", "ulric_e",[(troop_remove_item,0,"itm_vial"),(troop_add_item, "trp_player","itm_lore_book"),]],
 
I think this fixes it.
Title: Re: Ask Winter
Post by: fujiwara on June 18, 2008, 12:08:32 pm
Code: [Select]
[trp_ulric|plyr,"ulric_da",  [(player_has_item,"itm_vial")], "Here you are...", "ulric_e",[(troop_remove_item,0,"itm_vial"),(troop_add_item, "trp_player","itm_lore_book"),]],
Try this.
Title: Re: Ask Winter
Post by: grailknighthero on June 18, 2008, 01:35:27 pm
Ya, I missed the first two extra brackets.  Thanks fujiwara.

I suggest having another look at this http://forums.taleworlds.net/index.php/topic,12733.0.html and native dialogs.
Title: Re: Ask Winter
Post by: grailknighthero on June 27, 2008, 02:21:52 pm
Lets say I have the following

slot_item_first_slot = 1
slot_item_second_slot = 2
slot_item_third_slot = 3

can I do
(assign, ":slot", slot_item_first_slot),
(val_add, ":slot", 2)

to have ":slot" be slot_item_third_slot

So I can do

(item_get_slot,":n","itm_item",":slot"),

I am having error messages display in battle for a trigger that does this.

Ok I fixed it.  That works for all I know so far, I had a different mistake.


Also, can anyone get (agent_get_entry_no,<destination>,<agent_id>), to work?

I have
(try_for_agents, ":a"),
                (agent_get_entry_no,":entry",":a"),
                (assign, reg25, ":entry"),
                (display_message, "@Agent entry point: {reg25}"),

and nothing displays.

I got this to display from changing 0, 0, ti_once to 1,0, ti_once
Title: Re: Ask Winter
Post by: Winter on June 27, 2008, 03:22:52 pm
Lets say I have the following

slot_item_first_slot = 1
slot_item_second_slot = 2
slot_item_third_slot = 3

can I do
(assign, ":slot", slot_item_first_slot),
(val_add, ":slot", 2)

to have ":slot" be slot_item_third_slot

So I can do

(item_get_slot,":n","itm_item",":slot"),

I am having error messages display in battle for a trigger that does this.

You can certainly do that, it's exactly how the module system works. I do it all the time in Craftmod. Your error messages may be related but not a direct consequence.

Regards,
Ryan
Title: Re: Ask Winter
Post by: grailknighthero on June 27, 2008, 03:50:14 pm
Another problem I cant figure out.  This is for custom battles.

game menu

(set_visitor, 0, "$qb_player"),  # player troop (assign, "$qb_player", "trp_quick_battle_bretonnian"), assigned above = Lord Montfort
                 (set_visitors, 1, "trp_b_pb1", 5), # peasant bowmen
                 (set_visitors, 2, "trp_b_pb1", 5), # peasant bowman
                 (set_visitors, 3, "trp_b_m_a_a1", 1),
                 (set_visitors, 4, "trp_b_m_a_a2", 1),
                 (set_visitors, 5, "trp_b_m_a_a3", 1),


                 (set_visitors, 10, "trp_e_m_chief", 1),
                 (set_visitors, 11, "trp_e_m_mcg", 1),
                 (set_visitors, 12, "trp_e_m_m1", 1),
                 (set_visitors, 13, "trp_e_m_m2", 1),
                 (set_visitors, 14, "trp_e_m_m3", 1),
                 (set_visitors, 20, "trp_e_m_mh1", 1),  # the only marauder horsemen spawned

(http://i283.photobucket.com/albums/kk320/grailknighthero/The%20Peasants%20Rebellion/entrypointerrors.jpg)

The marauder horsemen is hard to see but it is listed twice, once at -1 and once at 20.
Title: Re: Ask Winter
Post by: Winter on June 28, 2008, 04:33:51 am
Lord Montfort also appears twice in there, one time at entry -1. Are you actually seeing clones being deployed in the battle?

Regards,
Ryan
Title: Re: Ask Winter
Post by: grailknighthero on June 28, 2008, 05:15:12 am
Nope, there are no duplicates in battle....hmmm

Actually, I think I just figured it out.  It is because those two agents are mounted.  I was afraid the -1s would affect a script, but they wont because I use the agent is human operation.
Title: Re: Ask Winter
Post by: Winter on June 28, 2008, 06:40:11 am
Nope, there are no duplicates in battle....hmmm

Actually, I think I just figured it out.  It is because those two agents are mounted.  I was afraid the -1s would affect a script, but they wont because I use the agent is human operation.

Interesting bit of data there, horses getting spawned with an entry of -1? Probably never useful, but interesting . . .

Regards,
Ryan
Title: Re: Ask Winter
Post by: grailknighthero on June 30, 2008, 08:11:53 pm
Is this the same as neq for a slot?

(neg|agent_slot_eq,":agent",slot_agent_is_formation_leader,1),

Just wondering because you don't have something like it in your operations.
Title: Re: Ask Winter
Post by: Winter on July 01, 2008, 02:11:05 am
Is this the same as neq for a slot?

(neg|agent_slot_eq,":agent",slot_agent_is_formation_leader,1),

Just wondering because you don't have something like it in your operations.

Yes, it's the same. If you look in header_operations, neq itself is only an amalgamation of neg|eq. My operations are a little bit out of date nowadays.

Regards,
Ryan
Title: Re: Ask Winter
Post by: grailknighthero on July 12, 2008, 04:48:14 am
Can I do something like this:

module constants

"$overlay_checkbox_unit1" = 0
"$overlay_checkbox_unit2" = 0
"$overlay_checkbox_unit3" = 0

module scripts

(assign, ":checkbox", 0),
(try_for_range, ":i", 0, 3),
       (store_add, ":checkbox", "$overlay_checkbox_unit1", ":i"),
       (statements)
(try_end),

and have checkbox be the variable.  I am thinking no, because it is not something like a slot, a troop, etc and is not assigned in ascending order.   What I want to do is make a for or recursive statement that runs multiple times and each time the next variable is used, so I do not have to have a try_begin else_try statement with 14 else_try's.
Title: Re: Ask Winter
Post by: Winter on July 12, 2008, 10:21:07 am
Can I do something like this:

module constants

"$overlay_checkbox_unit1" = 0
"$overlay_checkbox_unit2" = 0
"$overlay_checkbox_unit3" = 0

module scripts

(assign, ":checkbox", 0),
(try_for_range, ":i", 0, 3),
       (store_add, ":checkbox", "$overlay_checkbox_unit1", ":i"),
       (statements)
(try_end),

and have checkbox be the variable.  I am thinking no, because it is not something like a slot, a troop, etc and is not assigned in ascending order.   What I want to do is make a for or recursive statement that runs multiple times and each time the next variable is used, so I do not have to have a try_begin else_try statement with 14 else_try's.

No, the only way you can access variable destinations is by using slots. Variables and registers don't have that capability in M&B.

What you can do is simply loop it to use a new slot each time.

Regards,
Ryan
Title: Re: Ask Winter
Post by: Highlander on July 21, 2008, 04:42:19 pm
I have the following problem:
I have a troop who doesn't take the weapon I give him.
This troop has a thrown weapon and a shield in his inventory. guarantee_shield and guarantee_ranged are both used and the thrown weapon is not two handed. It's basicly the same as itm_stones with another mesh and other stats.
The problem is, that the shield doesn't show up. Neither at the hands of the troops nor at the backs. When I remove the thrown weapon, it suddenly shows up. Any ideas?
Title: Re: Ask Winter
Post by: Ron Losey on July 21, 2008, 09:53:28 pm
I have the following problem:
I have a troop who doesn't take the weapon I give him.
This troop has a thrown weapon and a shield in his inventory. guarantee_shield and guarantee_ranged are both used and the thrown weapon is not two handed. It's basicly the same as itm_stones with another mesh and other stats.
The problem is, that the shield doesn't show up. Neither at the hands of the troops nor at the backs. When I remove the thrown weapon, it suddenly shows up. Any ideas?

Systematic elimination first.  Try replacing the item stats with the ones from native thrown stone, and see if it works.  Then replace the mesh with a known working one (like the native stone) and try it.  Those two tests will get it down to either one line of code or one mesh.  At least isolate the bug.
Title: Re: Ask Winter
Post by: Highlander on July 22, 2008, 03:20:07 am
Thanks. I found the problem.
Believe it or not, but it seems that troops only carry shields with thrown weapons, if they have an one-handed melee weapon as well.
Title: Re: Ask Winter
Post by: grailknighthero on July 22, 2008, 02:03:35 pm
Interesting to know, is it any melee weapon, or does it have specifics like 2 handed polearm as well.  Im guessing it is a bug and not something Armagan planned on.
Title: Re: Ask Winter
Post by: Tamuli on August 17, 2008, 06:46:18 pm
What have I done wrong?
I followed the "Part 1" tutorial exactly, but got the error several time:
Traceback (most recent call last):
  File "process_init.py", line 1, in ?
    from module_info import *
  File "module_info.py", line 5
    export_dir = "C:/Documents and Settings/HP_Administrator/Desktop/Mount&Blade
/Modules/Eire

            ^
SyntaxError: invalid token
Traceback (most recent call last):
  File "process_global_variables.py", line 4, in ?
    from module_info import *
  File "module_info.py", line 5
    export_dir = "C:/Documents and Settings/HP_Administrator/Desktop/Mount&Blade
/Modules/Eire

            ^
SyntaxError: invalid token
Traceback (most recent call last):
  File "process_strings.py", line 3, in ?
    from module_info import *
  File "module_info.py", line 5
    export_dir = "C:/Documents and Settings/HP_Administrator/Desktop/Mount&Blade
/Modules/Eire

            ^
SyntaxError: invalid token
Traceback (most recent call last):
  File "process_skills.py", line 3, in ?
    from module_info import *
  File "module_info.py", line 5
    export_dir = "C:/Documents and Settings/HP_Administrator/Desktop/Mount&Blade
/Modules/Eire

            ^
SyntaxError: invalid token
Traceback (most recent call last):
  File "process_music.py", line 3, in ?
    from module_info import *
  File "module_info.py", line 5
    export_dir = "C:/Documents and Settings/HP_Administrator/Desktop/Mount&Blade
/Modules/Eire

            ^
SyntaxError: invalid token
Traceback (most recent call last):
  File "process_animations.py", line 3, in ?
    from module_info import *
  File "module_info.py", line 5
    export_dir = "C:/Documents and Settings/HP_Administrator/Desktop/Mount&Blade
/Modules/Eire

            ^
SyntaxError: invalid token
Traceback (most recent call last):
  File "process_meshes.py", line 3, in ?
    from module_info import *
  File "module_info.py", line 5
    export_dir = "C:/Documents and Settings/HP_Administrator/Desktop/Mount&Blade
/Modules/Eire

            ^
SyntaxError: invalid token
Traceback (most recent call last):
  File "process_sounds.py", line 2, in ?
    from module_info import *
  File "module_info.py", line 5
    export_dir = "C:/Documents and Settings/HP_Administrator/Desktop/Mount&Blade
/Modules/Eire

            ^
SyntaxError: invalid token
Traceback (most recent call last):
  File "process_skins.py", line 3, in ?
    from module_info import *
  File "module_info.py", line 5
    export_dir = "C:/Documents and Settings/HP_Administrator/Desktop/Mount&Blade
/Modules/Eire

            ^
SyntaxError: invalid token
Traceback (most recent call last):
  File "process_map_icons.py", line 2, in ?
    from module_info import *
  File "module_info.py", line 5
    export_dir = "C:/Documents and Settings/HP_Administrator/Desktop/Mount&Blade
/Modules/Eire

            ^
SyntaxError: invalid token
Traceback (most recent call last):
  File "process_factions.py", line 1, in ?
    from module_info import *
  File "module_info.py", line 5
    export_dir = "C:/Documents and Settings/HP_Administrator/Desktop/Mount&Blade
/Modules/Eire

            ^
SyntaxError: invalid token
Exporting item data...
Traceback (most recent call last):
  File "process_items.py", line 56, in ?
    from module_info import *
  File "module_info.py", line 5
    export_dir = "C:/Documents and Settings/HP_Administrator/Desktop/Mount&Blade
/Modules/Eire

            ^
SyntaxError: invalid token
Traceback (most recent call last):
  File "process_scenes.py", line 1, in ?
    from module_info import *
  File "module_info.py", line 5
    export_dir = "C:/Documents and Settings/HP_Administrator/Desktop/Mount&Blade
/Modules/Eire

            ^
SyntaxError: invalid token
Traceback (most recent call last):
  File "process_troops.py", line 3, in ?
    from module_info import *
  File "module_info.py", line 5
    export_dir = "C:/Documents and Settings/HP_Administrator/Desktop/Mount&Blade
/Modules/Eire

            ^
SyntaxError: invalid token
Traceback (most recent call last):
  File "process_particle_sys.py", line 1, in ?
    from module_info import *
  File "module_info.py", line 5
    export_dir = "C:/Documents and Settings/HP_Administrator/Desktop/Mount&Blade
/Modules/Eire

            ^
SyntaxError: invalid token
Traceback (most recent call last):
  File "process_scene_props.py", line 3, in ?
    from module_info import *
  File "module_info.py", line 5
    export_dir = "C:/Documents and Settings/HP_Administrator/Desktop/Mount&Blade
/Modules/Eire

            ^
SyntaxError: invalid token
Traceback (most recent call last):
  File "process_tableau_materials.py", line 4, in ?
    from module_info import *
  File "module_info.py", line 5
    export_dir = "C:/Documents and Settings/HP_Administrator/Desktop/Mount&Blade
/Modules/Eire

            ^
SyntaxError: invalid token
Traceback (most recent call last):
  File "process_presentations.py", line 3, in ?
    from module_info import *
  File "module_info.py", line 5
    export_dir = "C:/Documents and Settings/HP_Administrator/Desktop/Mount&Blade
/Modules/Eire

            ^
SyntaxError: invalid token
Traceback (most recent call last):
  File "process_party_tmps.py", line 1, in ?
    from module_info import *
  File "module_info.py", line 5
    export_dir = "C:/Documents and Settings/HP_Administrator/Desktop/Mount&Blade
/Modules/Eire

            ^
SyntaxError: invalid token
Traceback (most recent call last):
  File "process_parties.py", line 3, in ?
    from module_info import *
  File "module_info.py", line 5
    export_dir = "C:/Documents and Settings/HP_Administrator/Desktop/Mount&Blade
/Modules/Eire

            ^
SyntaxError: invalid token
Traceback (most recent call last):
  File "process_quests.py", line 3, in ?
    from module_info import *
  File "module_info.py", line 5
    export_dir = "C:/Documents and Settings/HP_Administrator/Desktop/Mount&Blade
/Modules/Eire

            ^
SyntaxError: invalid token
Traceback (most recent call last):
  File "process_scripts.py", line 3, in ?
    from module_info import *
  File "module_info.py", line 5
    export_dir = "C:/Documents and Settings/HP_Administrator/Desktop/Mount&Blade
/Modules/Eire

            ^
SyntaxError: invalid token
Traceback (most recent call last):
  File "process_mission_tmps.py", line 4, in ?
    from module_info import *
  File "module_info.py", line 5
    export_dir = "C:/Documents and Settings/HP_Administrator/Desktop/Mount&Blade
/Modules/Eire

            ^
SyntaxError: invalid token
Traceback (most recent call last):
  File "process_game_menus.py", line 4, in ?
    from module_info import *
  File "module_info.py", line 5
    export_dir = "C:/Documents and Settings/HP_Administrator/Desktop/Mount&Blade
/Modules/Eire

            ^
SyntaxError: invalid token
Traceback (most recent call last):
  File "process_simple_triggers.py", line 1, in ?
    from module_info import *
  File "module_info.py", line 5
    export_dir = "C:/Documents and Settings/HP_Administrator/Desktop/Mount&Blade
/Modules/Eire

            ^
SyntaxError: invalid token
Traceback (most recent call last):
  File "process_dialogs.py", line 4, in ?
    from module_info import *
  File "module_info.py", line 5
    export_dir = "C:/Documents and Settings/HP_Administrator/Desktop/Mount&Blade
/Modules/Eire

            ^
SyntaxError: invalid token
Traceback (most recent call last):
  File "process_global_variables_unused.py", line 1, in ?
    from module_info import *
  File "module_info.py", line 5
    export_dir = "C:/Documents and Settings/HP_Administrator/Desktop/Mount&Blade
/Modules/Eire

            ^
SyntaxError: invalid token

______________________________

Script processing has ended.
Press any key to exit. . .
Title: Re: Ask Winter
Post by: KON_Air on August 18, 2008, 06:20:47 pm
"C:/Documents and Settings/HP_Administrator/Desktop/Mount&Blade/Modules/Eire

"C:/Documents and Settings/HP_Administrator/Desktop/Mount&Blade/Modules/Eire"
Title: Re: Ask Winter
Post by: Tamuli on August 19, 2008, 07:09:00 pm
I got that fixed, it turns out I'd been following the Module Documentian to literally, I'd installed it somewere else to were python was looking.
But now I have a new problem... >:(
Every time I start M&B I get the first assertion error and all I have to do is click 10x, which is fine. But then I get a second error saying:

Assertion failed!

Program: C:\Program Files\Mount&Blade\mount&blade.exe
File: e\develop\mb\programs\src\troop.h
Line: 1165

Expression: rgl_between(skill_level,0,(skills[skill_no].max_level + 1))
Title: Re: Ask Winter
Post by: KON_Air on August 19, 2008, 08:45:18 pm
A troop(or troops) have a skill that is too high for his level. Increase his level or decrease his skill.
Title: Re: Ask Winter
Post by: Tamuli on August 20, 2008, 03:18:18 pm
I haven't edited troops and despite being an exact copy, native works fine.
I even reinstalled the whole game and mod system...
Title: Re: Ask Winter
Post by: grailknighthero on November 17, 2008, 12:24:43 am
Me again.

Anyone know what is wrong with this?

Im getting TypeError: list indices must be integers for the line in purple

Quote
  ("gkh_shield_item_set_banner",
    [
       (store_script_param, ":tableau_no",1),
       (store_script_param, ":agent", 2),
       #(store_script_param, ":troop_no", 3),
       (store_script_param, ":heraldry_value", 3),
       
       (val_sub, ":heraldry_value", 1),

       (store_add, ":banner_spr", ":heraldry_value", banner_scene_props_begin),
       (store_add, ":banner_scene_props_end", banner_scene_props_end_minus_one, 1),
       (try_begin),
           (is_between, ":banner_spr", banner_scene_props_begin, ":banner_scene_props_end"),
       (else_try),
           (store_add, ":banner_spr", 0, banner_scene_props_begin),
           (item_set_slot,"itm_global_heraldry_slot",slot_item_global_heraldry_slot,0),
           (agent_set_slot,":agent",slot_agent_heraldry,0),
       (try_end),
       (val_sub, ":banner_spr", banner_scene_props_begin),
       (store_add, ":banner_mesh", ":banner_spr", arms_meshes_begin),

       (cur_item_set_tableau_material, ":tableau_no", ":banner_mesh"),
     ]),

Ive looked for missing comas and extra brackets, but I can't find any.
Title: Re: Ask Winter
Post by: Winter on November 17, 2008, 07:32:39 am
Me again.

Anyone know what is wrong with this?

Im getting TypeError: list indices must be integers for the line in purple

Quote
  ("gkh_shield_item_set_banner",
    [
       (store_script_param, ":tableau_no",1),
       (store_script_param, ":agent", 2),
       #(store_script_param, ":troop_no", 3),
       (store_script_param, ":heraldry_value", 3),
       
       (val_sub, ":heraldry_value", 1),

       (store_add, ":banner_spr", ":heraldry_value", banner_scene_props_begin),
       (store_add, ":banner_scene_props_end", banner_scene_props_end_minus_one, 1),
       (try_begin),
           (is_between, ":banner_spr", banner_scene_props_begin, ":banner_scene_props_end"),
       (else_try),
           (store_add, ":banner_spr", 0, banner_scene_props_begin),
           (item_set_slot,"itm_global_heraldry_slot",slot_item_global_heraldry_slot,0),
           (agent_set_slot,":agent",slot_agent_heraldry,0),
       (try_end),
       (val_sub, ":banner_spr", banner_scene_props_begin),
       (store_add, ":banner_mesh", ":banner_spr", arms_meshes_begin),

       (cur_item_set_tableau_material, ":tableau_no", ":banner_mesh"),
     ]),

Ive looked for missing comas and extra brackets, but I can't find any.

Comment everything out, then uncomment one line at a time to see which line is the offending one.

Regards,
Winter
Title: Re: Ask Winter
Post by: grailknighthero on November 17, 2008, 09:22:02 am
Well Obviously something is wrong, because I just commented out the entire script and now its pointing to the script above it (so it started at the bottom and it is flagging each line above as I comment out lines).

Probably missing a bracket or parentheses or comma at the top lol.  I wonder how I am going to find the problem in 20000 lines of code.

Edit:  nm, found the problem.  Like I thought, the problem was at the very top, forgot this plus

scripts = formation_scripts + tactical_ui_scripts + multiple_formations_scripts + [

Thanks for the help, it would have taken me to find that because I was thinking it was something in the script and more specifically how I was handling the tableau system.
Title: Re: Ask Winter
Post by: tercero on November 22, 2008, 03:27:31 pm
Can someone posta  list with the default entry points?

I know that nº0 is the player's entry point but.. the other??

I have been searching hours, I remember that there was a post here or maybe in the TW forum (i've searched there too) where there was a list with them if someone have it, give me a link please

If you could post the list would be even better

THANKS!!! :mrgreen:

BTW I'm talking about castles/towns/villages for example attackers/defender entry point, reinforcement etc

I have found out this:

0- player spawn point when you choose "take a walk around"
32- soldiers that appear in the wall watching when you are waliking around the castle
40-44- archers ina  siege???

any-one know more?
Title: Re: Ask Winter
Post by: grailknighthero on November 22, 2008, 04:20:03 pm
This might not be up to date
http://z9.invisionfree.com/exilian/index.php?showtopic=12
Title: Re: Ask Winter
Post by: tercero on November 22, 2008, 04:26:10 pm
grailknighthero I LOVE YOU that was the post I was looking for!!!!  :green: :green: thanks thanks thanks thanks!!!!!!!!!!!!
Title: Re: Ask Winter
Post by: Ron Losey on January 30, 2009, 12:51:07 am
I got one that will keep you programming geniuses busy for a while...

Building destructible scene props.  Easy enough to do, in general:

Code: [Select]
("earth_gate_a",sokf_destructible|sokf_moveable|spr_hit_points(3500),"earth_gate_a","bo_earth_gate_a",   [
   (ti_on_scene_prop_destroy,
    [
        (store_trigger_param_1, ":instance_no"),
        (prop_instance_get_starting_position, pos1, ":instance_no"),
        (get_player_agent_no, ":player_agent"),
        (agent_get_position, 2, ":player_agent"),
        (assign, ":rotate_side", 80),
        (try_begin),
          (position_is_behind_position, 2, 1),
          (val_mul, ":rotate_side", -1),
        (try_end),
        (position_rotate_x, 1, ":rotate_side"),
        (position_set_z_to_ground_level, pos1),(prop_instance_animate_to_position, ":instance_no", 1, 70), #animate to position 1 in 0.7 second
        (play_sound, "snd_dummy_destroyed"),
    ]),
(ti_on_scene_prop_hit,
    [
        (play_sound, "snd_dummy_hit"),
        (particle_system_burst, "psys_dummy_smoke", pos1, 3),
     ]),
  ]),

Problem is, no matter what I set spr_hit_points to, the fool things never seem to get more than a hundred or so hit points.
Now, that's just not going to work with castle gates.  The gate needs to take several minutes to knock it down (while under fire), or some exceptionally large weapon, to get the proper effect.

So, how can we armor these gates in some way?  Damage reduction of some sort?  Or at least get it to read the bloody hit point data?  I've looked everywhere, and several other people have asked the same question at various times, but so far, zero solutions have been presented.

And a LOT of mods could use this, if it would work properly.
Title: Re: Ask Winter
Post by: Winter on January 30, 2009, 01:33:35 pm
Nope, sorry. There's no way to do that with the current version of the module system.

Regards,
Winter
Title: Re: Ask Winter
Post by: Ron Losey on January 30, 2009, 11:46:39 pm
Crud ....

Well, can we go at this the other direction?  Use the "on hit" function, have the door move just a little each time it is hit (preferably relative to damage taken)?  Such that the player has to beat on the door until there is an opening large enough to pass through?

(Note: I tried this, but I couldn't get it to work right, because I don't know what the heck I'm doing.  I'm trying to teach myself to read Python, but I need examples to work from.)

Any ideas on how to approach that?
Title: Re: Ask Winter
Post by: Winter on January 31, 2009, 02:43:18 am
Crud ....

Well, can we go at this the other direction?  Use the "on hit" function, have the door move just a little each time it is hit (preferably relative to damage taken)?  Such that the player has to beat on the door until there is an opening large enough to pass through?

(Note: I tried this, but I couldn't get it to work right, because I don't know what the heck I'm doing.  I'm trying to teach myself to read Python, but I need examples to work from.)

Any ideas on how to approach that?


That's easy -- I did the same in the last version of Craftmod with chopping down trees. Getting the positions right is the only difficult bit.

I haven't got the code here to show you but it was an adaptation of the target dummies in module_scene_props.

Regards,
Winter
Title: Re: Ask Winter
Post by: Ron Losey on January 31, 2009, 03:58:46 am
Roger that ... I'll check out the craftmod code.

But I got as far as the part about adapting the target dummy code, before my plan fell apart ... Everything rotated the wrong way at the wrong time, or some such.  I couldn't get anything to zero at ground level, so the doors all would pivot in the middle or some dumb thing.

I mean, the concept I have ... the details, forget it.

-------------------------

Edit:
OK, the last released version of the craftmod code didn't have that in there.  So I still need help of a more direct variety.
Title: Re: Ask Winter
Post by: Winter on January 31, 2009, 02:58:29 pm
Everything rotated the wrong way at the wrong time, or some such.  I couldn't get anything to zero at ground level, so the doors all would pivot in the middle or some dumb thing.

Well they would, wouldn't they? The position of the scene prop is the geometric middle of the model, so you need to either enlarge the model to offset the central point to the location of the hinges or modify the position you're rotating for the same reason.

Regards,
Winter
Title: Re: Ask Winter
Post by: Ron Losey on March 05, 2009, 07:27:25 am
Just for the record ... on the destructable scene props:

http://forums.taleworlds.net/index.php/topic,58596.msg1515619.html#msg1515619

Fisheye comes through again.  Hit point code for scene props that can be destroyed correctly.

So it was possible - it just took a skill level a darn sight higher than I could really comprehend.

Anyway, I'll certainly be making use of those in any number of projects, I'm sure a lot of other people will be happy to have this one too.  It does work ... just finished initial testing on DoL (the proposed fantasy mod in the discussions thread ... we're hoping for an alpha release soon, so it can be moved down to "new mods").
Title: Re: Ask Winter
Post by: Oroonin on July 06, 2009, 04:55:41 am
I´m getting the pre-.808 quest window when I try to play my mod-in-the-works. Compiled evertthing in python with no errors. Any ideas?
Title: Re: Ask Winter
Post by: Winter on July 06, 2009, 11:25:16 am
I´m getting the pre-.808 quest window when I try to play my mod-in-the-works. Compiled evertthing in python with no errors. Any ideas?

ERROR: NEED MORE GODDAMN INPUT.

And a screenshot.

Regards,
Winter
Title: Re: Ask Winter
Post by: Oroonin on July 07, 2009, 01:30:59 pm
Problem solved. Appearantly, if the brf-edit saves brfs to module.ini, the end of the file screws up.
Title: Re: Ask Winter
Post by: Brutus on August 30, 2009, 11:27:07 pm
I am getting killed trying to learn quests and dialog scripting in 1.011.  I have gotten a handle on the other modules... 

This Geoffery example is awesome if I could get it rolling.  Anyone get the code working for Geoffrey in 1.011???

Kolba's tut on a new quests (Thyr) also fails.  I believe because the enemy_defeated bit is buggy.  Is that correct?  Can it be made to work?  Is it safe to assume the rest of the conditions are ok?

Are there any tutorials on the quests/dialogs development that work to quest closure for 1.011?  Preferably not for "anyone" quests but trp specific quest starters and targets?  

I created what i thought was a useful get item type of quest.  but is says non-ASCII code on the end_quest line. :(

Suggestions?

[trp_antler, "start", [[eq,"$holy_relic",0]], "Hello, fetch the relic from Har in Praven", "antler",[]],
[trp_antler|plyr, "antler1", [], "Ok.", "antler2",[]],
[trp_antler, "antler2", [], "Please hurry!", "antler3",[]],
[trp_antler|plyr, "antler3", [], "I will.", "antleryes",[
      (setup_quest_text, "qst_relic"),
      (str_store_string, s2, "@Get relic from Har in Praven and return it to Antler."),
      (call_script,"script_start_quest","qst_relic","trp_antler"),
  [trp_antler|plyr, "antler3", [], "No, I don't have time for that!", "close_window",[]],
  [trp_antler, "antleryes", [], "Excellent!", "close_window",[[assign,"$holy_relic",1]]],


[trp_antler, "start", [[eq,"$holy_relic",1]], "Did you find the relic?","got_relic_question",[]],
[trp_antler|plyr, "got_relic_question", [(player_has_item,"itm_relic")], "Yes! It was quite difficult.", "relic_got",[(call_script,"script_end_quest","qst_relic")]],
[trp_antler|plyr, "got_relic_question", [], "No, not yet.", "close_window",[]],
[trp_antler, "relic_got", "Excellent! Here is your reward.”, ,"close_window",[(call_script, "troop_add_gold","trp_player","2000"),(call_script, "troop_remove_item_relic"),(call_script, "end_quest_qst_relic"),"trp_antler")],[[assign,"$holy_relic",2]]],

[trp_antler, "start", [[eq,"$holy_relic",2]], "Greetings {playername}.","bye2",[]],
[trp_antler|plyr, "bye2", [], "Greetings to you too, Antler.","close_window",[]],

[trp_har, "start", “antleryes”, [[eq,"$har_relic",0]],"Greetings playername}.","har_1",[]],
[trp_har|plyr, “har_1”,[], “Give me the stolen relic!”, “har_2”,[]],
[trp_har, “har_2”, [[eq,"$har_relic",1]],"Yes, yes!  Here take it.”,"har_3",
(call_script, "add_troop_item", "trp_player", "itm_relic"), "close_window",[]],

[trp_har, "start", [[]], "Greetings {playername}.","har_bye",[]],
[trp_har|plyr, "har_bye", [], "Greetings to you too, Antler.","close_window",[]],


Title: Re: Ask Winter
Post by: Brutus on August 31, 2009, 07:55:41 pm
***Double Post*** :D

Will trade custom models and UV mapping for basic dialog code direction.  PM me if interested.  

Some new TLD warg examples.  
(http://img.photobucket.com/albums/v315/ibebrutus/hvyWargs2.jpg)

Dominance War III entry
(http://img.photobucket.com/albums/v315/ibebrutus/BeautySheetcopy.jpg)


HL2 Mod piratechar
(http://img.photobucket.com/albums/v315/ibebrutus/swashdone.jpg)

All models created from scratch...

PLEASE help the noob coder...  Will do art for script lessons.



  

Title: Re: Ask Winter
Post by: Winter on September 01, 2009, 03:45:56 am
[trp_antler, "start", [[eq,"$holy_relic",0]], "Hello, fetch the relic from Har in Praven", "antler",[]],
[trp_antler|plyr, "antler1", [], "Ok.", "antler2",[]],
[trp_antler, "antler2", [], "Please hurry!", "antler3",[]],
[trp_antler|plyr, "antler3", [], "I will.", "antleryes",[
      (setup_quest_text, "qst_relic"),
      (str_store_string, s2, "@Get relic from Har in Praven and return it to Antler."),
      (call_script,"script_start_quest","qst_relic","trp_antler"),  -- Improperly closed consequences block, no closing brackets.
  [trp_antler|plyr, "antler3", [], "No, I don't have time for that!", "close_window",[]],
  [trp_antler, "antleryes", [], "Excellent!", "close_window",[[assign,"$holy_relic",1]]],


[trp_antler, "start", [[eq,"$holy_relic",1]], "Did you find the relic?","got_relic_question",[]],
[trp_antler|plyr, "got_relic_question", [(player_has_item,"itm_relic")], "Yes! It was quite difficult.", "relic_got",[(call_script,"script_end_quest","qst_relic")]],
[trp_antler|plyr, "got_relic_question", [], "No, not yet.", "close_window",[]],
[trp_antler, "relic_got", "Excellent! Here is your reward.”, ,"close_window",[(call_script, "troop_add_gold","trp_player","2000"),(call_script, "troop_remove_item_relic"),(call_script, "end_quest_qst_relic"),"trp_antler")],[[assign,"$holy_relic",2]]],

[trp_antler, "start", [[eq,"$holy_relic",2]], "Greetings {playername}.","bye2",[]],
[trp_antler|plyr, "bye2", [], "Greetings to you too, Antler.","close_window",[]],

[trp_har, "start", “antleryes”, [[eq,"$har_relic",0]],"Greetings playername}.","har_1",[]],
[trp_har|plyr, “har_1”,[], “Give me the stolen relic!”, “har_2”,[]],
[trp_har, “har_2”, [[eq,"$har_relic",1]],"Yes, yes!  Here take it.”,"har_3",
(call_script, "add_troop_item", "trp_player", "itm_relic"), "close_window",[]], -- Here you've put an operation outside of an operations block. That's never gonna work.

[trp_har, "start", [[]], "Greetings {playername}.","har_bye",[]],
[trp_har|plyr, "har_bye", [], "Greetings to you too, Antler.","close_window",[]],

Regards,
Winter
Title: Re: Ask Winter
Post by: Brutus on September 01, 2009, 10:20:01 am
Ah yes.  And many other nooby issues...  THANKS!!!  Stuck on two last items - even copied the format from working code in same module???

[trp_antler, "start", [[eq,"$holy_relic",0]], "Hello. Please fetch the relic from Har in Praven.", "antler1",[]],
[trp_antler|plyr, "antler1", [], "Ok.", "antleryes",[
      (setup_quest_text, "qst_relic"),
     (str_store_string, s2, "@Get relic from Har in Praven and return it to Antler in Suno."),
      (call_script,"script_start_quest","qst_relic","trp_antler")]],
[trp_antler|plyr, "antler1", [], "No, I don't have time for that.", "close_window",[]],
[trp_antler, "antleryes", [], "Excellent!", "close_window",[[assign,"$holy_relic",1]]],

[trp_antler, "start", [[eq,"$holy_relic",1]], "Did you find the relic?","got_relic_question",[]],
[trp_antler|plyr, "got_relic_question",[(player_has_item,"itm_relic")], "Yes, here it is!", "relic_got",[
      (call_script, "script_end_quest", "qst_relic")]],
[trp_antler|plyr, "got_relic_question",[],"No, not yet.", "close_window",[]],
[trp_antler, "relic_got",[],"Excellent! Here is your reward.", "close_window",[
      (call_script, "script_troop_add_gold", "trp_player", 2000),
     ("troop_remove_items","trp_player","itm_relic"),
     (call_script, "end_quest_qst_relic")]],

[trp_har, "start", [(check_quest_active, "qst_relic")],"Greetings. Are you here for the relic?.","har_1",[]],
[trp_har|plyr,"har_1",[], "Yes.  Please give me the relic.", "har_2",[]],
[trp_har, "har_2",[],"Yes, yes!  Take it!.","close_window",[
      ("troop_add_items", "trp_player", "itm_relic", 1)]],

...
Error in dialog line:
[603, 'relic_got', [], 'Excellent! Here is your reward.', 'close_window', [(1, 'script_troop_add_gold', 'trp_player', 2000), ('troop_remove_items', 'trp_player'
, 'itm_relic'), (1, 'end_quest_qst_relic')]]

Error in dialog line:
[604, 'har_2', [], 'Yes, yes!  Take it!.', 'close_window', [('troop_add_items',
'trp_player', 'itm_relic', 1)]]
Checking global variable usages...
...

Winter, if you are still working Storymod and need some art just send a sketch. :D
Title: Re: Ask Winter
Post by: geeves on October 01, 2009, 11:49:39 am
hey winter,
I've got a question for you, well actually 2 or more questions.

To start off, i am happy to say that your module explanations on the taleworlds website forums are pretty well worked out, i learned a lot of them.
until i get to the point where i wish see my created troops in game, following your steps i should be able to see my troops in game on the specified location...
to start off: with the Module system 1010_0, Zendar mercs do not exist. i didn't see a point in that, i just copied your script from the website and put it in place, just under the line telling me that zendar as city is inactive. i put zendar as active city and saved the lot. no errors. run the game, find zendar, see a grand total of ... 3 NPCs, clearly it has to be customised. (in game editor ain't popping up BTW, but i could copy my face code earlier on.) i go to the inn, find 3 hero's which i didn't want there, but OK, i found out they are scripted into that place when Zendar is set as active city. No tavernkeeper to be found by the way, neither are the mercs i wanted to put in game.

there we go, Question one: how do we solve this?
I've already tried giving the mercs a hero line without the TF_HERO mark. not working. gets you a nice error.

that covered. how can we get Zendar a working city? merchants ect added, a game menu of the kind you get when for example you enter Thir. for that's where we get question two:
why wasn't your module explanations finished? i find part 10 where in game editing is covered incomplete, as are to my noob idea more of the covered but completed" arts of the module explanations.

another question arising is: how can i get a village in the game where i can get my own troops as recruits like i can get swadian recruits in swadian towns?
for the moment this will cover enough things to get me going after the time being.

(PS game info: module system 1010_0, game version 1.011)
Title: Re: Ask Winter
Post by: Shik on October 04, 2009, 12:00:18 pm
[trp_antler, "relic_got",[],"Excellent! Here is your reward.", "close_window",[
      (call_script, "script_troop_add_gold", "trp_player", 2000),
     ("troop_remove_items","trp_player","itm_relic"),
     (call_script, "end_quest_qst_relic")]],

[trp_har, "start", [(check_quest_active, "qst_relic")],"Greetings. Are you here for the relic?.","har_1",[]],
[trp_har|plyr,"har_1",[], "Yes.  Please give me the relic.", "har_2",[]],
[trp_har, "har_2",[],"Yes, yes!  Take it!.","close_window",[
      ("troop_add_items", "trp_player", "itm_relic", 1)]],

Brutus, if you haven't already fixed this issue by yourself, just remove the quotation marks around the operation troop_add_items.
Title: Re: Ask Winter
Post by: Brutus on October 04, 2009, 06:50:58 pm
Thanks!!!  I found some other issues in there after that was straight too.  oi...  But those were showstoppers, rest I got.   

Need a model? :D  If so just PM. 
Title: Re: Ask Winter
Post by: Winter on October 04, 2009, 07:39:45 pm
hey winter,
I've got a question for you, well actually 2 or more questions.

To start off, i am happy to say that your module explanations on the taleworlds website forums are pretty well worked out, i learned a lot of them.
until i get to the point where i wish see my created troops in game, following your steps i should be able to see my troops in game on the specified location...
to start off: with the Module system 1010_0, Zendar mercs do not exist. i didn't see a point in that, i just copied your script from the website and put it in place, just under the line telling me that zendar as city is inactive. i put zendar as active city and saved the lot. no errors. run the game, find zendar, see a grand total of ... 3 NPCs, clearly it has to be customised. (in game editor ain't popping up BTW, but i could copy my face code earlier on.) i go to the inn, find 3 hero's which i didn't want there, but OK, i found out they are scripted into that place when Zendar is set as active city. No tavernkeeper to be found by the way, neither are the mercs i wanted to put in game.

there we go, Question one: how do we solve this?
I've already tried giving the mercs a hero line without the TF_HERO mark. not working. gets you a nice error.

that covered. how can we get Zendar a working city? merchants ect added, a game menu of the kind you get when for example you enter Thir. for that's where we get question two:
why wasn't your module explanations finished? i find part 10 where in game editing is covered incomplete, as are to my noob idea more of the covered but completed" arts of the module explanations.

another question arising is: how can i get a village in the game where i can get my own troops as recruits like i can get swadian recruits in swadian towns?
for the moment this will cover enough things to get me going after the time being.

(PS game info: module system 1010_0, game version 1.011)

There's no real point trying to make my tutorials work for the current version of M&B, there's way too much distance between the two. If you really want to bypass the native systems and create a functioning town, make a special game menu for Zendar and use that instead of mnu_town. That's about as much advice I can give without writing additional tutorials, and I'm not doing that without a paycheque. :P

Regards,
Winter
Title: Re: Ask Winter
Post by: motomataru on February 01, 2010, 10:49:53 am
I've come to the conclusion after 3-4 days of examining the issue that team_get_order_position is badly behaved compared to, say, agent_get_position. It's like, position_move_x completely shuts down on the acquired position. script_update_order_flags_on_map from the module system uses script_convert_3d_pos_to_map_pos on positions acquired by team_get_order_position, but I think it's specifically for building some sort of order map and moreover didn't work at all for me. I ended up with the following kluge, apologies to agent 0 whoever he or she may be, which fixed the problem:

Code: [Select]
  # script_get_formation_position
  # Input: team, troop class
  # Output: pos1 (pos0 used)
  # Kluge around team_get_order_position shutting down position_move_x
  # without resorting to looping through agents yet again
  ("get_formation_position",
   [(store_script_param, ":fteam", 1),
    (store_script_param, ":fclass", 2),
(agent_get_position, pos0, 0),
(team_get_order_position, pos1, ":fteam", ":fclass"),
(agent_set_position, 0, pos1),
(agent_get_position, pos1, 0),
(agent_set_position, 0, pos0),
]),

Question is, am I missing something basic about using team_get_order_position?
Title: Re: Ask Winter
Post by: ithilienranger on September 04, 2010, 08:18:00 pm
I have an extremely annoying problem with a modification that I am working on. It seems to be an error with the "troop_get_upgrade_troop" operation. I am trying to use the 1st and 2nd nodes of that operation, but I do not get the proper return values. The string register is not given the correct value. I have tried outputting the register values at different key points in the game and I added new registers to avoid conflicts. All I can figure out is that it likes to store the 2nd node troop for the first node and then the first node is stored as my player name. If there is one node choice then I get the player name for both menu choices.

Here is the code that I narrowed the problem down to.


#excerpt from a script
(try_begin),
         (eq, "$commander's_faction", fac_kingdom_1),
         (assign, "$player_cur_troop", "trp_swadian_recruit"),
      (else_try),
         (eq, "$commander's_faction", fac_kingdom_2),
         (assign, "$player_cur_troop", "trp_vaegir_recruit"),
      (else_try),
         (eq, "$commander's_faction", fac_kingdom_3),
         (assign, "$player_cur_troop", "trp_khergit_tribesman"),
      (else_try),
         (eq, "$commander's_faction", fac_kingdom_4),
         (assign, "$player_cur_troop", "trp_nord_recruit"),
      (else_try),
         (eq, "$commander's_faction", fac_kingdom_5),
         (assign, "$player_cur_troop", "trp_rhodok_tribesman"),
      (try_end),


#menu_upgrade_path
  (
    "upgrade_path",0,
    "In recognition of your excellent service, you have been promoted.",
    "none",
    [
   (troop_get_upgrade_troop, "$path_1", "$player_cur_troop", 1),
   (troop_get_upgrade_troop, "$path_2", "$player_cur_troop", 2),
   #string register to output troop name
   (str_store_troop_name, s66, "$path_1"),
   (str_store_troop_name, s67, "$path_2"),
   ],
    [
      ("upgrade_path_1",[(neq, "$path_1", -1)],
       "{s66}",
        [
         (assign, "$menu_upgrade_path_response", "$path_1"),
         (call_script, "script_cf_event_player_promotion", "$menu_upgrade_path_response"),
         (change_screen_map),
        ]),
      
      ("upgrade_path_2",[(neq, "$path_2", -1)],
      "{s67}",
        [
         (assign, "$menu_upgrade_path_response", "$path_2"),
         (call_script, "script_cf_event_player_promotion", "$menu_upgrade_path_response"),
         (change_screen_map),
        ]),
    ]
  ),





Title: Re: Ask Winter
Post by: GetAssista on September 05, 2010, 04:47:30 am
Try put some constant troop instead of "$player_cur_troop" variable into a menu part and see what happens. If menu choices are correct then it would mean you are messing up with this variable somewhere else

Also, you are not checking for -1 in paths when doing (str_store_troop_name, s67, "$path_2"). Might throw it off somehow
Title: Re: Ask Winter
Post by: ithilienranger on September 05, 2010, 05:52:42 am
I tried using the built in temp troop and it did the same thing for me. I'll try that check for -1 for the string registers, but I think I already tried it.

EDIT: I did the -1 check before assigning the string registers. but something else is causing the problem. Also, I have checked several times using the Notepad++ find in files and none of my uses should mess with the variable.
Title: Re: Ask Winter
Post by: GetAssista on September 05, 2010, 09:00:58 am
I tried using the built in temp troop and it did the same thing for me. I'll try that check for -1 for the string registers
What do you mean built in temp? I suggested putting e.g. "trp_vaegir_recruit" instead of "$player_cur_troop" in menu script.
Because, well, troop_get_upgrade_troop works fine in the game :)
Title: Re: Ask Winter
Post by: ithilienranger on September 05, 2010, 01:31:28 pm
I used trp_temp_troop and got the same results. I don't want to use the actual troop names because I will have to add a ton more code. It would be more efficient to have one universal troop name that stores the current troop. I cannot give out anymore information unless you want me to PM you.
Title: Re: Ask Winter
Post by: ithilienranger on September 06, 2010, 06:26:06 pm
YES, I finally figured it out. The documentation for troop_get_upgrade_troop is wrong. Instead of 0 for random, 1 for first node, and 2 for second node it is 0 for first node and 1 for second node. I wondered why in the original module system the uses contained :rand_no variable for the value. It is because there is no 0 for random. This needs to be fixed in the documentation, but I do not know who to notify.