Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Hey guys,

I'm having trouble fully viewing this item in game.

I gave it lods but that hasnt helped, it isnt that too far out of view anyways. sometimes the balloon is warped and most of the time the ship isnt visible...just at specific angles. the ship is being used as body armor, like what the guys did in the parabellum mod. Maybe the model is just too big?

any ideas?

2nrkk29.png

UPDATE: it must be with the rigging, using it as a horse it just bobbles like one. but the for some reason as an armor, its deformed.
 
@KaToZ
You gotta be trolling....
Your text editor (like Notepad++) has a search function.


@kalarhan
Any idea about this? Also, would you know what the itp_primary and itp_secondary flags actually do?

InVain said:
Does the AI take weapon types into account? E.g. do agents distinguish between 2H weapons and polearms and know when to use which, in case they have both in their inventory? Or do they choose based on the weapon's range?

I'm asking because TLD has a lot of 2H axes flagged as itp_type_polearm, and I wonder if that somehow impedes the AI.
 
InVain said:
@kalarhan
Any idea about this? Also, would you know what the itp_primary and itp_secondary flags actually do?

Engine AI code was written to Native, which uses very simple layout for weapons. Mods tend to complicate things with mix groups, so you also have custom AI like in FormationsOSP (and VC) with their own rules.

Base idea is to distribute the 4 slots of a agent. It checks the guarantee flags (must have a shield, a bow, a polearm,... ?). It checks other flags like primary weapon. It checks the troop skills and proficiencies (can 6ou use this bow, are you good with a spear, ...). Divides slots in groups. Picks from inventory based on value (slot 1 should be a one handed weapon, now choose one). And so on.  On range, IIRC, it only considers the damage. VC, as a example, adds range/reach on the selection process.

Best thingy is to keep your troop design as simple as possible. Otherwise you can check custom scripts to add new behaviours.



PitchPL said:
How he can add script with unassigned  variables when he even dont know how to open modsys files?

Happens when you download old modsys from Native or a mod. It is not like they are bug or even warnings free.
 
InVain said:
@KaToZ
You gotta be trolling....
Your text editor (like Notepad++) has a search function.


@kalarhan
Any idea about this? Also, would you know what the itp_primary and itp_secondary flags actually do?

InVain said:
Does the AI take weapon types into account? E.g. do agents distinguish between 2H weapons and polearms and know when to use which, in case they have both in their inventory? Or do they choose based on the weapon's range?

I'm asking because TLD has a lot of 2H axes flagged as itp_type_polearm, and I wonder if that somehow impedes the AI.
No i'm not trolling i also have notepad++ i just don't know how to enable that search function is it Ctrl + F?
 
Thanks Kalarhan!
So you're saying that itp_primary and itp_secondary play a role in filling the troop inventory slots? Does it do it in a way that ensures that a troop has _both_ one primary and one secondary weapon (sidearm) equipped, or does it rather try to equip primary weapons first and only use secondaries if there's still room?

I'm rather interested how troops choose from their 4 slots _in battle_. For example: If a troop has 1 sword, 1 shield, 1 two handed axe that does a lot of damage, and finally 1 two-handed polearm, will they use sword and shield when under enemy fire, the 2h axe when fighting in melee, and the polearm when cavalry is near? I'm pretty I remember troops switching to polearms when I attack them as a knight.

I think I need to do a few tests...
 
Someone can help-me?

I got this error when I leave my server, just in dedicated. The number of "Invalid Agent ID:" change every time, but LINE NO, and everything another is the same.

SCRIPT WARNING ON OPCODE -2147481941: Invalid Agent ID: 2; LINE NO: 15:
At Script [86] setup_agent_for_respawn

in this script:

  ("setup_agent_for_respawn", # server: when an agent dies, clean up slots and attached props; set up lootable items
  [(store_script_param, ":agent_id", 1),
    (store_script_param, ":killer_agent_id", 2),

    (try_begin),
      (agent_is_active, ":agent_id"),
      (agent_get_attached_scene_prop, ":instance_id", ":agent_id"),
      (try_begin),
        (prop_instance_is_valid, ":instance_id"),
        (agent_set_attached_scene_prop, ":agent_id", -1),
        (call_script, "script_cart_set_detached_position", ":instance_id"),
      (try_end),
      (agent_set_slot, ":agent_id", slot_agent_died_normally, 1),
      (agent_set_slot, ":agent_id", slot_agent_cannot_attack, 0), # so the attack restrictons checking loop will skip this agent
      (agent_get_player_id, ":player_id", ":agent_id"),
      (player_is_active, ":player_id"),
     
      (try_begin),
        (neg|agent_is_non_player, ":player_id"),
        (player_get_slot, ":faction_id", ":player_id", slot_player_faction_id),
      (try_end),
     
      (agent_get_position, pos1, ":agent_id"),
      (set_spawn_position, pos1),
     
      (try_begin),
        (agent_is_active,":killer_agent_id"),
        (agent_get_player_id, ":killer_player_id", ":killer_agent_id"),
        (player_is_active, ":killer_player_id"),
        (neg|agent_is_non_player, ":killer_agent_id"),
        (player_get_slot, ":killer_faction_id", ":killer_player_id", slot_player_faction_id),
      (else_try),
        (assign,":killer_player_id",-1),
      (try_end),

      (try_begin),
        (neq,":killer_player_id",-1),
        #Check for hostile killer
        (call_script, "script_cf_factions_are_hostile", ":killer_faction_id", ":faction_id"),
        #if the two players factions are hostile then drop the loot
       
        (spawn_item, "itm_human_carcass", 0, corpse_prune_timer),# Human meat
        (scene_prop_set_slot, reg0, slot_animal_carcass_meat_count, 1), # Human Meat
       
        (store_random_in_range, ":imod", imod_plain, imod_cracked + 1),
        (spawn_item, "itm_agent_corpse", ":imod", corpse_prune_timer),
        (assign, ":corpse_instance_id", reg0),
        (prop_instance_set_position, ":corpse_instance_id", pos1),
       
        (store_mission_timer_a, ":loot_timer"),
        (val_add, ":loot_timer", corpse_loot_timer),
        (scene_prop_set_slot, ":corpse_instance_id", slot_scene_prop_corpse_owner, ":killer_player_id"),
        (scene_prop_set_slot, ":corpse_instance_id", slot_scene_prop_corpse_loot_timer, ":loot_timer"),
       
        (store_mission_timer_a, ":prune_time"),
        (val_add, ":prune_time", corpse_prune_timer),
        (scene_prop_set_slot, ":corpse_instance_id", slot_scene_prop_prune_time, ":prune_time"),
        (scene_prop_set_slot, ":corpse_instance_id", slot_scene_prop_inventory_count, corpse_inventory_slots),
        (scene_prop_set_slot, ":corpse_instance_id", slot_scene_prop_inventory_max_length, corpse_inventory_max_length),
        (val_add, "$g_last_inventory_unique_id", 1),
        (scene_prop_set_slot, ":corpse_instance_id", slot_scene_prop_inventory_unique_id, "$g_last_inventory_unique_id"),
        (assign, ":inventory_slot", slot_scene_prop_inventory_begin),
        (try_for_range, ":player_equip_slot", slot_player_equip_head, slot_player_equip_gloves + 1),
          (player_get_slot, ":item_id", ":player_id", ":player_equip_slot"),
          (ge, ":item_id", all_items_begin),
          (scene_prop_set_slot, ":corpse_instance_id", ":inventory_slot", ":item_id"),
          (val_add, ":inventory_slot", 1),
        (try_end),
        (try_begin), # if the only items dropped were rubbish default items, remove the corpse now for performance reasons
          (eq, ":inventory_slot", slot_scene_prop_inventory_begin),
          (scene_prop_set_prune_time, ":corpse_instance_id", 1),
        (try_end),
        (try_for_range, ":player_equip_slot", slot_player_equip_item_0, slot_player_equip_end),
          (player_set_slot, ":player_id", ":player_equip_slot", 0),
        (try_end),
        (agent_get_position, pos1, ":agent_id"),
        (agent_get_wielded_item, ":weapon_item_id", ":agent_id", 0),
        (agent_get_wielded_item, ":shield_item_id", ":agent_id", 1),
        (set_fixed_point_multiplier, 100),
        (position_get_z, ":height", pos1), # the engine only drops the wielded items, only if above water level: drop all equipped items
        (try_for_range, ":equip_slot", ek_item_0, ek_item_3 + 1),
          (agent_get_item_slot, ":item_id", ":agent_id", ":equip_slot"),
          (ge, ":item_id", all_items_begin),
          (try_begin),
            (this_or_next|eq, ":item_id", ":weapon_item_id"),
            (eq, ":item_id", ":shield_item_id"),
            (gt, ":height", -50),
            (neq, ":item_id", "itm_money_bag"),
          (else_try),
            (store_add, ":unequip_slot", ":equip_slot", 1),
            (agent_unequip_item, ":agent_id", ":item_id", ":unequip_slot"), # if spawning an item manually, remove it so the engine definitely won't drop a duplicate
            (call_script, "script_set_random_spawn_position", 50),
            (spawn_item, ":item_id", 0, "$g_spawn_item_prune_time"),
            (call_script, "script_check_on_item_dropped", ":agent_id", ":item_id", reg0, 1),
          (try_end),
        (try_end),
        (try_begin),
          (neq, "$g_game_type", "mt_permanent_death"),
          (agent_get_troop_id, ":troop_id", ":agent_id"),
          #Upkeep
          (troop_get_slot, ":upkeep_price", ":troop_id", slot_troop_upkeep_price),
          (try_begin),
            (gt,":upkeep_price",0),
            (try_begin),
              (call_script, "script_cf_check_enough_gold", ":player_id", ":upkeep_price"),
              (call_script, "script_player_adjust_gold", ":player_id", ":upkeep_price", -1),
              (multiplayer_send_3_int_to_player, ":player_id", server_event_preset_message, "str_upkeep_money_take", preset_message_chat_log|preset_message_red, ":upkeep_price"),
            (else_try),
              (try_begin),
                (ge,":faction_id",castle_factions_begin),
                (assign,":troop_id", "trp_serf"),
              (else_try),
                (assign,":troop_id", playable_troops_begin),
              (try_end),
              #Female troop types
              (player_get_gender, ":gender", ":player_id"),
              (try_begin),
                (eq,":gender",tf_female),
                (troop_get_slot, ":female_troop", ":troop_id", slot_troop_has_female),
                (try_begin),
                  (ge,":female_troop",playable_troops_begin),
                    (assign,":troop_id",":female_troop"),
                (try_end),
              (else_try),
                (troop_get_slot, ":male_troop", ":troop_id", slot_troop_female),
                (ge,":male_troop",playable_troops_begin),
                  (assign,":troop_id",":male_troop"),
              (try_end),
              #Female end
              (player_set_troop_id, ":player_id", ":troop_id"),
              (multiplayer_send_3_int_to_player, ":player_id", server_event_preset_message, "str_upkeep_money_fail", preset_message_chat_log|preset_message_red, ":upkeep_price"),
            (try_end),
          (try_end),
          #Upkeep - End
        (try_end),
       
        (agent_get_slot, ":freeze_instance_id", ":agent_id", slot_agent_freeze_instance_id),
        (try_begin),
          (gt, ":freeze_instance_id", -1),
          (call_script, "script_remove_scene_prop", ":freeze_instance_id",0),
          (agent_set_slot, ":agent_id", slot_agent_freeze_instance_id, -1),
        (try_end),
        (troop_get_slot, ":spawn_health_percent", ":troop_id", slot_troop_spawn_health_percent),
        (player_set_slot, ":player_id", slot_player_next_spawn_health_percent, ":spawn_health_percent"),
      (else_try),
        (player_set_slot, ":player_id", slot_player_next_spawn_health_percent, 100),
        (player_set_troop_id, ":player_id", playable_troops_begin),
        (player_set_slot, ":player_id", slot_player_faction_id, factions_begin),
      (try_end),
      (player_set_slot, ":player_id", slot_player_spawn_state, player_spawn_state_dead),
    (try_end),
    ]),
 
Hey, how do I get realistic swordplay from 1429 la guerre cent ans to medival conqests? Ever since I've played the hundred years war the native swordplay looks stupid to me and MC is very appealing.
 
InVain said:
Thanks Kalarhan!
So you're saying that itp_primary and itp_secondary play a role in filling the troop inventory slots? Does it do it in a way that ensures that a troop has _both_ one primary and one secondary weapon (sidearm) equipped, or does it rather try to equip primary weapons first and only use secondaries if there's still room?

I'm rather interested how troops choose from their 4 slots _in battle_. For example: If a troop has 1 sword, 1 shield, 1 two handed axe that does a lot of damage, and finally 1 two-handed polearm, will they use sword and shield when under enemy fire, the 2h axe when fighting in melee, and the polearm when cavalry is near? I'm pretty I remember troops switching to polearms when I attack them as a knight.

I think I need to do a few tests...
itp_primary is necessary to make the weapon usable.
itp_secondary seems to be deprecated, as it has no known functionality.

As fas as I remember, the AI favours either the longest or most damaging weapon, or a mixture of both...
However there's some black magic involved, for sure!
 
Khamukkamu said:
Does the engine do anything different with itp_has_bayonet or it can be used for different purposes?
Applying it to an alternative-mode weapon results in playing a special agent animation when switching weapon modes.
Without the flag weapon mode switching happens instantly without any animation.
 
Status
Not open for further replies.
Back
Top Bottom