Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
I've browsed this question before but there really was no answer to it. What I want to do is when you're in a battle in single player and you die, you respawn as another one of your troops that is already fighting. This is already coded into the game, but it's on Multiplayer Battle. I'm just curious if it's even remotely possible to take the multiplayer code and transfer it to single player. I've looked over the code and I'm trying to figure out if it's worth even trying or if another mod has it (and has the source released). This would be huge for anyone playing single player and I'm actually quite amazed that there is no source code available for this.

No, Custom Commander is not what I'm looking for. That seems coded more for choosing who you are before a battle even begins, not after death.
 
Hi .o/
I'm trying to play with weather, but it seems that out of all the available functions, only set_fog_distance is working.
I've tried using set_rain, set_fog_distance, scene_set_day_time, set_global_cloud_amount, set_global_haze_amount and out of all of those, I was only able to create fog.
I'm using this on a multiplayer server and I tried triggering this from both the client and the server. Any ideas of what I might be doing wrong? Are there any specific callbacks where those functions have to be used?
 
Rezovor said:
I've browsed this question before but there really was no answer to it. What I want to do is when you're in a battle in single player and you die, you respawn as another one of your troops that is already fighting. This is already coded into the game, but it's on Multiplayer Battle. I'm just curious if it's even remotely possible to take the multiplayer code and transfer it to single player. I've looked over the code and I'm trying to figure out if it's worth even trying or if another mod has it (and has the source released). This would be huge for anyone playing single player and I'm actually quite amazed that there is no source code available for this.

No, Custom Commander is not what I'm looking for. That seems coded more for choosing who you are before a battle even begins, not after death.
The code is called body sliding, and it exists in SilverStag, which is an OSP.

@Kalarhan I've resolved the torch issue almost completly in SP, and mostly in MP, it seems troop_has_item_equipped operation does not take notes of all the 4 slots in the weapon section, rather just the currently wielded ones (Max = 2), I had to delay the trigger firing so that my code which makes units choose their best weapons would fire before the torch code would fire, thus certain polearms get restrited correctly.

Unfornutly, this dosen't work perfectly in co-op because the trigger fires contionusly there (and rightfully so because it seems I can't use ti_once) in there.

Overall the results are satisfactory and acceptable, but not perfect, will try to improvise more on it.
 
Hey there! I'm having this weird issue where my module system doesn't actually... update anything.

I've tried it with a fresh download of the latest version of the module system on a copied folder of Native. I changed the name of one of the claimants, and the troops.txt file was untouched. (I've also done this with my current mod; I discovered this problem after using Cartographer to save the location of the parties, I ran the .bat and loaded into the game, only to see all the parties were in their native locations).

I have no idea what the problem could be. It seems to think it's exporting and running fine, it doesn't give me any errors, it just... doesn't work? Has anybody else had this problem, or know what it could possibly be?

EDIT: Oh god. Oh god. I forgot to add the / at the end of the Export Dir.

I found so many .txt files in my Modules folder. Augh.
 
kalarhan said:
CutContent said:
How do you make animated menu items like the clouds/fog in the main menu of star wars battlefront and the reckoning

You can download Reckoning modules/assets and check how the modder did it. There is even a post on that mod subforum about it IIRC

Link? I searched on google and couldn't find it
 
_Sebastian_ said:
CutContent said:
Link? I searched on google and couldn't find it
Took me 10 seconds to find it...
https://forums.taleworlds.com/index.php/topic,331444.0.html

:lol: Kids these days, if its not on Yahoo Answers or first result of Google then it doesn't exist.

La Grandmaster said:
The whole mod is now OSP so you can check it out in the module system and use the art assets if you wish. The start up screen is done via a (horribly written and messy) presentation.



troycall said:
troop_has_item_equipped operation does not take notes of all the 4 slots
Without a code snippet I have no idea why you would use that particular operation, but in any case remember that a troop is not a agent. Why are you checking the troop gear?

The four slots for weapons, as a example, should be checked on the particular agent. The troop may have 20 weapons in the inventory and once it spawns (a agent) the game selects 4 for that agent, which may not be the same for all agents of that troop.

If its a lady troop, as a example, and you gave that NPC only one dress (chest piece), then the game will assume that its the piece equipped by its agent. What if you had given 3 different dresses to that lady?

If you look at Native code you will see how this operation is only used once, to check lady dress, and decide if she should have a head piece or not.


Rezovor said:
No, Custom Commander is not what I'm looking for. That seems coded more for choosing who you are before a battle even begins, not after death.
As a modder you should be able to check a OSP pack, like Custom Commander, which has a few features, and copy only the stuff you need.

If you only want body slid/battle continuation, then check the mission template trigger and see what else you need to copy from there. Should take a few minutes.

Alternative is to create the code yourself. Its quite simple. The hard part was to create the first mod with it, solve all the bugs, use poor documentation, etc, back in the day. Now you know it works, you should be able to create your own version without much trouble.

If you expected that particular feature to have a "one install button", you should check the OSP section, it may even have one there. But this kind of thing may become common with Bannerlord. For WB/MB, you need to put in the work and change the code yourself.


 
@Kalarhan I assumed that operation affected the agents after they spawn as well, and that it would take note of the items they have equipped, rather than currently wielded, for example say they have a sword and a shield out, that means both slots are being used, but we don't know what else they have, as they have the other 2 weapon slots still in the back.

I assumed that operation counts all 4 slots, I'll use your approach and see if I can finalize patching this issue.

I'm having a different issue, I haven't tried adding a ti_on_shield_hit to a raw native yet as the issue might be from something else in my mod, however if anyone knows a solution to this, it'd be good to know.

I added a ti_on_shield_hit in module_items to certain shields, in this test its just for one shield.

Here is the full code for the shield, with the trigger:
Code:
	["lithuanian_shield9", "Heavy Lithuanian Shield", [("lithuanian_shield9", imodbits_none)], itp_type_shield|itp_merchandise|itp_wooden_parry, itcf_carry_board_shield, 276, hit_points(70)|spd_rtng(81)|abundance(100)|weight(5.5)|shield_width(40)|resistance(67)|shield_height(60), imodbits_shield,
	[(ti_on_shield_hit, [
      (store_trigger_param, ":var0", 1),
      (agent_get_scale, pos1, ":var0", 13),
      (agent_get_position, pos2, ":var0"),
      (position_transform_position_to_parent, pos3, pos2, pos1),
      (position_move_z, pos3, 3),
      (position_move_x, 3, 10),
      (position_move_y, pos3, 10),
      (particle_system_burst, "psys_dummy_straw", pos3, 10),
	  ]), [fac_kingdom_2]],

When I go in-game the trigger errors and does not fire correctly with the following error:

Code:
WSE ERROR on operation agent_get_item_slot_flags: item_slot_no is above maximum (9); LINE NO: 1: 
 At Item Kind [892] itm_lithuanian_shield9 Trigger [0]. At Item Kind [892] itm_lithuanian_shield9 Trigger [0].

Edit: Tested on Native, Native lacks the ti_on_shield_hit trigger (WSE), and the agent_get_scale operation (WSE).
I was able to resolve those issues by adding their required code from WSE, unfornutly the same issue persists - even in raw Native.
 
troycall said:
@Kalarhan I assumed that operation affected the agents after they spawn as well, and that it would take note of the items they have equipped, rather than currently wielded, for example say they have a sword and a shield out, that means both slots are being used, but we don't know what else they have, as they have the other 2 weapon slots still in the back.

I assumed that operation counts all 4 slots, I'll use your approach and see if I can finalize patching this issue.

Nope, agent is a instance of a troop. Use agent operations instead to check gear in a scene/mission.

The troop has a standard equipment that is calculated once (or when you call the auto equip operations). It is used to display gear when you open party screen. It does not apply any of the mission template gear selection algorithm that adds the random distribution.



Code:
WSE ERROR on operation
you are missing a "]" to close the trigger

 
kalarhan said:
troycall said:
@Kalarhan I assumed that operation affected the agents after they spawn as well, and that it would take note of the items they have equipped, rather than currently wielded, for example say they have a sword and a shield out, that means both slots are being used, but we don't know what else they have, as they have the other 2 weapon slots still in the back.

I assumed that operation counts all 4 slots, I'll use your approach and see if I can finalize patching this issue.

Nope, agent is a instance of a troop. Use agent operations instead to check gear in a scene/mission.

The troop has a standard equipment that is calculated once (or when you call the auto equip operations). It is used to display gear when you open party screen. It does not apply any of the mission template gear selection algorithm that adds the random distribution.



Code:
WSE ERROR on operation
you are missing a "]" to close the trigger
I closed it properly now, however same issue.


Here is my test in Native, its closed properly:

Code:
   [ (ti_on_shield_hit, [
      (store_trigger_param, ":var0", 1),
      (agent_get_scale, pos1, ":var0", 13),
      (agent_get_position, pos2, ":var0"),
      (position_transform_position_to_parent, pos3, pos2, pos1),
      (position_move_z, pos3, 3),
      (position_move_x, 3, 10),
      (position_move_y, pos3, 10),
      (particle_system_burst, "psys_dummy_straw", pos3, 10),
    ])],
   ],

Still same issue.
 
I added new icon for forest_bandit_lair, then changed forest bandit lair icon in module_party_templates, then build module and I opened new save and find a forest bandit lair but there is no changes associated with the icon.Anyone idea?
party_templates
  ("forest_bandit_lair" ,"Forest Bandit Camp",icon_icon_haydutkamp|carries_goods(2)|pf_is_static|pf_hide_defenders,0,fac_neutral,bandit_personality,[(trp_forest_bandit,15,5:cool:]),
module_map_icons
("icon_haydutkamp",mcn_no_shadow,"map_bandit_lair", 0.45, 0),
Id map icons
icon_icon_haydutkamp = 70
icon_icon_bandit = 71
icon_icon_haydutkamp2 = 72
icon_icon_kamp = 73
icon_camp = 74
icon_ship = 75
icon_ship_on_land = 76
forest bandit lair icon still old bandit lair icon.
edit:
I found my mistake :grin:
("icon_haydutkamp",mcn_no_shadow,"map_bandit_lair", 0.45, 0), this must be icon_haydutkamp
 
kalarhan said:
show your code and explain/detail what are you trying to do

In module_mission_templates:
Code:
key_check_proof = ( #testing whether KEYBOARD key codes can be used as check intervals in mission triggers
  key_left_mouse_button, 0, 0, [],
  [
	(display_message,"@This mission trigger has been executed, hopefully by clicking LMB.",0xFFFFFFFF),
  ]
)

gamekey_check_proof = ( #testing whether GAMEKEY codes can be used as check intervals in mission triggers
  gk_kick, 0, 0, [],
  [
	(display_message,"@This mission trigger has been executed, hopefully by pressing gk_kick.",0xFFFFFFFF),
  ]
)

Even if using key and gamekey codes as check intervals is possible, I'm not sure if it's the most effective way for what I want to do, which is basically just to have hotkeys (like 1-:cool: for activating abilities. For this question I mainly want to confirm that using key and gamekey codes as check intervals is impossible, but I'm also curious if they have any use outside of the operations I mentioned earlier. My own testing seemed to deny the check interval possibility: The original code used key_1 and gk_jump--they executed ~once every few seconds without any prompting and would not respond to the actual key presses. For this code, the key_left_mouse_button trigger never executed, while the gk_kick trigger executed in a similar manner to the key_1 and gk_jump triggers.

Currently I'm testing something like this:
Code:
ability_use_check = (
  0, 0, 0,
  [
    (try_begin),
	  (key_clicked, key_1),
	  (assign, "$current_ability", 1),
	(else_try),
	  (key_clicked, key_2),
	  (assign, "$current_ability", 2),
	(else_try),
	  (key_clicked, key_3),
	  (assign, "$current_ability", 3),
	(else_try),
	  (key_clicked, key_4),
	  (assign, "$current_ability", 4),
	(else_try),
	  (key_clicked, key_5),
	  (assign, "$current_ability", 5),
	(else_try),
	  (key_clicked, key_6),
	  (assign, "$current_ability", 6),
	(else_try),
	  (key_clicked, key_7),
	  (assign, "$current_ability", 7),
	(else_try),
	  (key_clicked, key_8),
	  (assign, "$current_ability", 8),
	(else_try),
	  (key_clicked, key_9),
	  (assign, "$current_ability", 9),
	(else_try),
	  (key_clicked, key_0),
	  (assign, "$current_ability", 0), ...
 
Khamukkamu said:
Can I make a mission template trigger 'conditional'? (i.e put it in a try statement?)

"If encountered_party is X, this MT trigger occurs, else do Y"

MST triggers are full triggers. They have condition and consequence block. Put your test on the condition, if it fails it won't execute the consequence...

(trigger_xxx, 0, 0,
[ my conditions go here, all of them must be true, any failure and the next block won't be called],
[ consequence block]
),

if you have multiple conditions you can do something like this:
Code:
(trigger_xxxx, 0, 0,
[
  (assign, ":continue", 0),

  (try_begin),
    ... some tests
    (assign, ":continue", 1),
  (try_end),

  (try_begin),
    ... some tests
    (assign, ":continue", 1),
  (try_end),

  (eq, ":continue", 1), #consequence only happens if this variable was set to 1
],
[ consequence]
),



Nate said:
key and gamekey codes as check intervals is impossible

sure thingy. Check the OSP section you will find a couple (maybe more) packs of abilities that do that (taunt, call horse, make npcs run from you, buffs, etc)

This is a warcry from VC modules:
Code:
  (0, 0, 3,
    [
      (key_clicked, key_t),
      (this_or_next|eq, "$player_trait", 1),
      (				eq, "$player_trait", 2),
    ],
    [
      (try_begin),
        (eq, "$player_trait", 1),
        (call_script,"script_berserk_trigger"),
        #
      (else_try),
        (eq, "$player_trait", 2),
        (le, "$warcry_loading", 0),
        (assign, "$warcry_loading", 10),
        (try_for_agents, ":cur_agent"),#effect
          (agent_is_human, ":cur_agent"),
          (agent_is_alive, ":cur_agent"),
          (agent_is_active,":cur_agent"),
          (agent_is_ally, ":cur_agent"),
          (agent_set_damage_modifier, ":cur_agent", 105),
          (call_script,"script_agent_perform_warcry", ":cur_agent"),
        (end_try),
      (end_try),
  ]),
 
How do you make green normal maps like the ones used in the game? I can't get them to work properly.
 
frozenpainter said:
Change this "party_set_marshall" with this "party_set_marshal" in module_scrips(5 times),module_presentation(1 times) and module_game_menus(1 times).
thanks, but there were 2 error messages left, so I went with kalarhans way:
kalarhans said:
don't, instead download a non buggy version of the modules, like the one from Lav's, which also has better documentation anyway
http://forums.taleworlds.com/index.php/topic,324874.0.html

Now the compiling worked, thanks!!
 
Is it possible to have conditional inventory screen background imagery? For example, if player is of X faction, have them see Inventory Window A; if of faction Y, inventory window B?

Or am I messing with hardcoded stuff here.. ? :smile:
 
I Am using a new module system with all of natives missions gone. The Module does not handle AI.
I am trying to implement a way of giving Orders to certain troops spawned by a player.

--> spawn troop --> set team -->try to issue order via team_give_order

Code:
(team_give_order, team_bot_roman, grc_everyone, mordr_form_2_row),
when i give the order i get an invalid group id Error.
Ive tried almost everything possible with team operations and its always the same error.
Any help would be appriciated. I have not slept all night so i might be missing something.


Its a multiplayer Mod and i'm actually making the function inside module_items.py.


Code:
def give_order_rome():
  return (ti_on_weapon_attack,
    [(store_trigger_param_1, ":attacker_id"),
     (agent_get_player_id, ":player_id", ":attacker_id"),
     (agent_get_action_dir, ":attack_dir", ":attacker_id"),
     #(agent_set_group, <agent_id>, <player_leader_id>),
     (try_begin),
         (eq, ":attack_dir", 0),
         (multiplayer_send_string_to_player, ":player_id", server_event_local_chat, "@Units!!! Form 2 Rows!"),
         (team_give_order, team_bot_roman, grc_everyone, mordr_form_2_row),
         #(agent_get_group, ":group_id", ":attacker_id"),
         #(assign, reg1, ":group_id"),
         #(multiplayer_send_string_to_player, ":player_id", server_event_local_chat, "@group: {reg1}"),


     (try_end),




    ])







 
Status
Not open for further replies.
Back
Top Bottom