Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
What is the maximum number of teams in a mission? Can I use team 4 for my own purposes, for an example, or maybe even teams 4-15 or whatever insane thing I come up with?
Caba`drin said:
In SP, up to 3 teams are used in battle: 0, 1, and either 2 or 3 if the player has an ally party that is not under the player's command.
The ally team will be the player team (0 or 1) + 2

Defender teams are 0 & 2
Attacker teams are 1 & 3

The player team will always be team 0 or 1.
 
I removed half of the villages, and everything compiled fine, then I edited their coordinates and then it came up with this error

ss12_by_gazda1-d5binb7.jpg
 
dia151 said:
I removed half of the villages, and everything compiled fine, then I edited their coordinates and then it came up with this error
You have a mess somewhere in module_parties.py (not at 69 or 47, check coordinates you have edited).
Something like the comma in coordinates is used instead of the point.
 
Lumos said:
What is the maximum number of teams in a mission? Can I use team 4 for my own purposes, for an example, or maybe even teams 4-15 or whatever insane thing I come up with?
Caba`drin said:
In SP, up to 3 teams are used in battle: 0, 1, and either 2 or 3 if the player has an ally party that is not under the player's command.
The ally team will be the player team (0 or 1) + 2

Defender teams are 0 & 2
Attacker teams are 1 & 3

The player team will always be team 0 or 1.

Native's mission template with biggest team number is arena's training. It has 7 teams (team 0 to team 6) with player agent is the only member of team 6.
 
dunde said:
Lumos said:
What is the maximum number of teams in a mission? Can I use team 4 for my own purposes, for an example, or maybe even teams 4-15 or whatever insane thing I come up with?
Caba`drin said:
In SP, up to 3 teams are used in battle: 0, 1, and either 2 or 3 if the player has an ally party that is not under the player's command.
The ally team will be the player team (0 or 1) + 2

Defender teams are 0 & 2
Attacker teams are 1 & 3

The player team will always be team 0 or 1.

Native's mission template with biggest team number is arena's training. It has 7 teams (team 0 to team 6) with player agent is the only member of team 6.
Teams 0-7 are valid. Team 8 will give you errors.
 
Hello.
I'm going to simplify my method to set item slot values with carry flags.

My current method is to set the slot value for each weapon, which takes much time.
Code:
...
      (item_set_slot, "itm_short_bow", slot_item_carry_slot, 2),
      (item_set_slot, "itm_nomad_bow", slot_item_carry_slot, 8),
      (item_set_slot, "itm_tab_shield_pavise_a", slot_item_carry_slot, 3),
      (item_set_slot, "itm_heavy_throwing_axes", slot_item_carry_slot, 10),
      (item_set_slot, "itm_throwing_spears", slot_item_carry_slot, 1), 
...
cmp suggested me a quicker method with some python comands, but coding with python is not really my world...

So my slotsystem uses 12 different carry positions and some of them are using multiple carry flags.
Code:
    ###carry-slots###
    # itcf_carry_mask crashes the game on weapon change #not used

    #slot 0: #hands
    # cant_sheath

    #slot 1: #back 1
    # itcf_carry_quiver_back, itcf_carry_axe_back, itcf_carry_sword_back, itcf_carry_spear

    #slot 2: #back 2
    # itcf_carry_crossbow_back, itcf_carry_bow_back

    #slot 3: #back 3
    # itcf_carry_kite_shield, itcf_carry_round_shield, itcf_carry_board_shield

    #slot 4: #left stomach
    # itcf_carry_pistol_front_left, itcf_carry_dagger_front_left

    #slot 5: #right stomach
    # itcf_carry_dagger_front_right

    #slot 6: #left hip 1
    # itcf_carry_sword_left_hip, itcf_carry_axe_left_hip, itcf_carry_mace_left_hip, itcf_carry_katana

    #slot 7: #left hip 2
    # itcf_carry_wakizashi

    #slot 8: #left hip 3
    # itcf_carry_bowcase_left

    #slot 9: #left hip 4
    # itcf_carry_buckler_left

    #slot 10: #right hip
    # itcf_carry_quiver_right_vertical, itcf_carry_quiver_front_right, itcf_carry_quiver_back_right

    #slot 11: #right upper leg
    # itcf_carry_revolver_right

This is cmp's method to set a value for each carry flag.
But as you can see above, I need only 12 values and some values are including a couple of carry flags.
Code:
  ("item_set_carry_slot",
  [
    (item_set_slot, "itm_%s" % item[0], slot_item_carry_slot, item[4] & itcf_carry_mask) for item in items
  ]),
Does someone know what I have to change/add that it works :?:
 
Take a look at rubik's code for the autoloot to set up a series of if...then statements, checking the values of the flags.
e.g.
Code:
from module_items import items 
def set_item_score():
  item_score = []
  for i_item in xrange(len(items)):   
    type = items[i_item][3] & 0x000000ff
    if type == itp_type_shield:
      item_score.append((item_set_slot, i_item, slot_item_length, get_weapon_length(items[i_item][6])))
      item_score.append((item_set_slot, i_item, slot_item_body_armor, get_body_armor(items[i_item][6])))
      item_score.append((item_set_slot, i_item, slot_item_speed, get_speed_rating(items[i_item][6])))
    elif type == itp_type_bow or type == itp_type_crossbow:
      item_score.append((item_set_slot, i_item, slot_item_thrust_damage, get_thrust_damage(items[i_item][6])))
      item_score.append((item_set_slot, i_item, slot_item_swing_damage, get_swing_damage(items[i_item][6])))
      item_score.append((item_set_slot, i_item, slot_item_speed, get_speed_rating(items[i_item][6])))
    elif type >= itp_type_one_handed_wpn and type <= itp_type_thrown:
      item_score.append((item_set_slot, i_item, slot_item_thrust_damage, get_thrust_damage(items[i_item][6])&0xff))
      item_score.append((item_set_slot, i_item, slot_item_swing_damage, get_swing_damage(items[i_item][6])&0xff))
      item_score.append((item_set_slot, i_item, slot_item_speed, get_speed_rating(items[i_item][6])))
      item_score.append((item_set_slot, i_item, slot_item_length, get_weapon_length(items[i_item][6])))
    elif type >= itp_type_head_armor and type <= itp_type_hand_armor:
      item_score.append((item_set_slot, i_item, slot_item_head_armor, get_head_armor(items[i_item][6])))
      item_score.append((item_set_slot, i_item, slot_item_body_armor, get_body_armor(items[i_item][6])))
      item_score.append((item_set_slot, i_item, slot_item_leg_armor, get_leg_armor(items[i_item][6])))
    elif type == itp_type_horse:
      item_score.append((item_set_slot, i_item, slot_item_horse_speed, get_missile_speed(items[i_item][6])))
      item_score.append((item_set_slot, i_item, slot_item_horse_armor, get_body_armor(items[i_item][6])))
      item_score.append((item_set_slot, i_item, slot_item_horse_charge, get_thrust_damage(items[i_item][6])))
	     
  return item_score[:]
This goes above scripts = [
then, within the list of scripts, your script just looks like:
("init_item_score", set_item_score()),


So, for you you'd probably want
Code:
def set_item_score():
  item_score = []
  for i_item in xrange(len(items)):   
    carry = items[i_item][4] & itcf_carry_mask
    if carry == itcf_carry_crossbow_back or carry == itcf_carry_bow_back:
      item_score.append((item_set_slot, i_item, slot_item_carry_slot, 2))
...etc
 
SnRolls said:
Can you give me an example?
What do i need to do in PHP and Python?
Im not really understanding this.
Again, the Module System is not Python, it is just compiled by Python. The above operation will send a message to your website and the script mentioned in the comment on that operation from header_operations can deal with whatever the website sends back.

As for coding the website itself, you might want to see
Caba`drin said:
 
Hey guys! I am repeating a question I asked a while ago about assigning villages to specific lords. How should this be done?

I tried to modify the assign to center script as in to assign the villages to lords also, but it does nothing. Actually most villages though they are in the right faction have no lord.

#fremen villages
("assign_villages_to_naibs",
  [

      #(try_for_range,":cur_lord","trp_naib_korba","trp_kingdom_1_pretender"),
      (try_for_range,":cur_center","p_sietch_tabr","p_castle_1"),
          (party_set_slot,":cur_center", slot_town_lord, stl_reserved_for_player),
          (party_slot_eq, ":cur_center", slot_party_type, spt_town),
          (try_for_range,":cur_village","p_sietch_village_tabr_1","p_salt_mine"),
              (party_slot_eq, ":cur_village", slot_village_bound_center, ":cur_center"),
              (party_slot_eq, ":cur_village", slot_town_lord, stl_unassigned),
                (party_set_slot, ":cur_village", slot_town_lord, stl_reserved_for_player),
          (try_end),
      (try_end),
  ]),

I am calling this script right after this:

# Give family castles to certain nobles.
      (call_script, "script_give_center_to_lord", "p_castle_29", "trp_knight_2_10", 0), #Nelag_Castle
      (call_script, "script_give_center_to_lord", "p_castle_30", "trp_knight_3_4", 0), #Asugan_Castle
      (call_script, "script_give_center_to_lord", "p_castle_35", "trp_knight_1_3", 0), #Haringoth_Castle
 
      (call_script, "script_assign_lords_to_empty_centers"),
      (call_script, "script_assign_villages_to_naibs"),

So, how can I assign villages to specific lords?

Also, a second question: what would happen (on the long run) to a faction without villages?
 
Now its time to remove faction. I remove faction, get lots of errors as expected, go trough them one by one, and in final im left with this repetitive error.

pcsda_by_gazda1-d5bjsv7.jpg

so, the question is how to fully and successfully remove troop from a mod
 
Status
Not open for further replies.
Back
Top Bottom