Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Docm30 said:
I'd have to see your code to know if there's a problem.


turns out ti_on_order_issued wasn't defined in header_triggers. thanks anyway, i've got it working perfectly now.


KrankyMarx said:
Hi all

ive been following Nord Champions guide to creating a faction and it was going great untill i tried to build the .bat file

its coming up with syntax errors

and i've tried finding the file mantioned and it seems fine, i commented it out just to see what would would hapen and it creates a syntax error in the next line . im very new to modding so please help

cheers


when it says there's an error on the last line, it means you've left out a bracket or comma somewhere within the file, not necessarily on the last line. open it up using notepad++ (download it), and clicking the brackets will show you where the bracket ends by highlighting it red.
 
i've checked and checked again and i just cant find it, everything it all matched up nice and it all seems ok

upgrade(troops,"farmer", "watchman")
upgrade(troops,"townsman","watchman")
upgrade2(troops,"watchman","caravan_guard","mercenary_crossbowman")
upgrade2(troops,"caravan_guard","mercenary_swordsman","mercenary_horseman")
upgrade(troops,"mercenary_swordsman","hired_blade")
upgrade(troops,"mercenary_horseman","mercenary_cavalry")

this is the bit of code where it says theres an error
 
it says there's an error there but the error could be anywhere in the file. if you left a bracket or comma out then the game can't tell where an entry ends, and assumes the error is at the end of the file. check the entries you've edited recently, and compare their bracket and comma placement against other entries. sadly there isn't a quick way to solve this, the compiler isn't very specific about errors. :sad:  your best option in future is to compile regularly.
 
jacobhinds said:
it says there's an error there but the error could be anywhere in the file. if you left a bracket or comma out then the game can't tell where an entry ends, and assumes the error is at the end of the file. check the entries you've edited recently, and compare their bracket and comma placement against other entries. sadly there isn't a quick way to solve this, the compiler isn't very specific about errors. :sad:  your best option in future is to compile regularly.

Yep, it is always a good idea to keep backups of stable versions, especially before major changes. That way, you could always compare the 2 versions with WinMerge or other merging programs to find and isolate any problem that arises.
 
Lumos said:
How large exactly was the maximum value a slot can have? Int32?
64 bit numbers seemed to set and get correctly when I tested with module system code (a while ago), but network message values are limited to 32 bits, and network event numbers to 7 bits (0 - 127).
 
Code:
exporting triggers...
Traceback (most recent call last):
  File "process_dialogs.py", line 199, in <module>
    save_triggers(variables,variable_uses,triggers,tag_uses,quick_strings)
  File "process_dialogs.py", line 54, in save_triggers
    save_statement_block(file,0,1,trigger[trigger_consequences_pos], variable_li
st, variable_uses,tag_uses,quick_strings)
  File "C:\Users\Mikkel M\Desktop\kuauik3\source\process_operations.py", line 44
9, in save_statement_block
    save_statement(ofile,opcode,no_variables,statement,variable_list,variable_us
es,local_vars, local_var_uses,tag_uses,quick_strings)
  File "C:\Users\Mikkel M\Desktop\kuauik3\source\process_operations.py", line 40
1, in save_statement
    ofile.write("%d "%operand)
TypeError: %d format: a number is required, not list
Checking global variable usages...
WARNING: Global variable never used: qst_follow_spy_spy_back_in_town
WARNING: Global variable never used: qst_follow_spy_partner_back_in_town
WARNING: Global variable never used: qst_follow_spy_no_active_parties
WARNING: Global variable never used: g_talk_agent
WARNING: Global variable never used: g_talk_troop_last_talk_time
WARNING: Global variable never used: g_time_since_last_talk
WARNING: Global variable never used: g_talk_troop_met
WARNING: Global variable never used: g_enemy_strength
WARNING: Global variable never used: g_ally_strength
WARNING: Global variable never used: g_last_comment_copied_to_s42
WARNING: Global variable never used: npc_quit_morale
WARNING: Global variable never used: g_emissary_selected
WARNING: Global variable never used: fief_selected
WARNING: Global variable never used: g_player_bride
WARNING: Global variable never used: encountered_party_friendly
WARNING: Global variable never used: suggested_to_attack_party
WARNING: Global variable never used: g_leave_town
WARNING: Global variable never used: qst_bring_back_runaway_serfs_party_1
WARNING: Global variable never used: qst_bring_back_runaway_serfs_party_2
WARNING: Global variable never used: qst_bring_back_runaway_serfs_party_3
WARNING: Global variable never used: feast_quality
WARNING: Global variable never used: lady_flirtation_location
WARNING: Global variable never used: troop_to_restore_relations_with
WARNING: Global variable never used: lady_restore_cost_1
WARNING: Global variable never used: lady_restore_cost_2
WARNING: Global variable never used: lady_restore_cost_3
WARNING: Global variable never used: caravan_distance_to_target
WARNING: Global variable never used: caravan_escort_agreed_reward
WARNING: Global variable never used: buy_drinks_last_time
WARNING: Global variable never used: last_lost_companion
WARNING: Global variable never used: traveller_claimants_mentioned
WARNING: Global variable never used: minstrels_introduced
WARNING: Global variable never used: minstrels_discussed_player_role
WARNING: Global variable never used: minstrels_discussed_meetings
WARNING: Global variable never used: minstrels_discussed_love
WARNING: Global variable never used: training_system_explained
WARNING: Global variable never used: training_fight_won
WARNING: Global variable never used: enterprise_cost
WARNING: Global variable never used: g_mayor_given_political_dialog
WARNING: Global variable never used: faction_selected
WARNING: Global variable never used: qst_troublesome_bandits_eliminated
WARNING: Global variable never used: qst_troublesome_bandits_eliminated_by_playe
r
WARNING: Global variable never used: arena_master_first_talk
WARNING: Global variable never used: g_bandit_party_for_bounty
WARNING: Global variable never used: g_tutorial_fighter_talk_before
WARNING: Global variable never used: g_companions_banner_id
WARNING: Global variable never used: do_not_cancel_quest
WARNING: Global variable never used: lair_neighboor_village
WARNING: Global variable never used: g_do_one_more_meeting_with_merchant
WARNING: Global variable never used: dialog_with_merchant_ended
WARNING: Global variable never used: g_constable_training_improved
WARNING: Global variable never used: g_player_affiliated_time
WARNING: Global variable never used: add_1000
WARNING: Global variable never used: next_center_will_be_fired
WARNING: Global variable never used: horse_follower
WARNING: Global variable never used: tom_use_battlefields
WARNING: Global variable never used: tom_sand_storm_chance
WARNING: Global variable never used: g_report_extra__and_wpt
WARNING: Global variable never used: $enable_deahtcam
Exporting postfx_params...
Exporting flora data...
Exporting ground_spec data...
Forkert syntaks for kommandoen.
Forkert syntaks for kommandoen.
Script processing has ended.

______________________________

Press any key to exit. . .

Tried to add Ruthvens Sea Travel to Shadows in the Desert. It works fine for my own project, so super dumbfounded that it is throwing off this error.

EDIT:

module_triggers

Code:
## SEA BATTLES BEGIN
(0.1, 0, 0, [(party_get_current_terrain,":terrain","p_main_party"),
      (neq,":terrain", 7),], # 5 or whatever the number of your retextured terrain in header_terrain_types.
   [(try_begin),
       (troop_get_inventory_slot, ":cur_horse", "trp_player",8), #horse slot
       (assign, ":new_icon", -1),
       (try_begin),
        (eq, "$g_player_icon_state", pis_normal),
        (try_begin),
         (ge, ":cur_horse", 0),
         (assign, ":new_icon", "icon_player_horseman"),
        (else_try),
         (assign, ":new_icon", "icon_player"),
        (try_end),
       (else_try),
        (eq, "$g_player_icon_state", pis_camping), # All of this is thanks to Lumos bein' generous, and not being as much of a lazy arse as I am
        (assign, ":new_icon", "icon_camp"), 
      (try_end),
    (party_set_icon, "p_main_party", ":new_icon"),
    (try_end),
]),
  

    (0.1, 0, 0, [(party_get_current_terrain,":terrain","p_main_party"),
      (eq,":terrain", 7),], #Oh shi- ALL HAIL HYPNOTOAD
   [(party_set_icon,"p_main_party", "icon_ship"),
 #  (display_message,"@Not water"),
   ]),
  
 (0.1, 0, 0.0, [],
[(try_for_parties, ":cur_party"),
   (party_get_current_terrain, ":terrain", ":cur_party"),
   (eq, ":terrain", 7),
  (party_get_template_id, ":cur_template", ":cur_party"),
 (this_or_next|eq, ":cur_template", "pt_kingdom_hero_party"),
 (this_or_next|eq, ":cur_template", "pt_forest_bandits"),
 (this_or_next|eq, ":cur_template", "pt_taiga_bandits"),
 (this_or_next|eq, ":cur_template", "pt_steppe_bandits"),
 (this_or_next|eq, ":cur_template", "pt_sea_raiders"),
 (this_or_next|eq, ":cur_template", "pt_mountain_bandits"),
 (this_or_next|eq, ":cur_template", "pt_desert_bandits"),
 (this_or_next|eq, ":cur_template", "pt_deserters"),
 (this_or_next|eq, ":cur_template", "pt_merchant_caravan"),
 (this_or_next|eq, ":cur_template", "pt_troublesome_bandits"),
 (this_or_next|eq, ":cur_template", "pt_bandits_awaiting_ransom"),
 (this_or_next|eq, ":cur_template", "pt_kidnapped_girl"),
 (this_or_next|eq, ":cur_template", "pt_village_farmers"),
 (this_or_next|eq, ":cur_template", "pt_spy_partners"),
 (this_or_next|eq, ":cur_template", "pt_runaway_serfs"),
 (this_or_next|eq, ":cur_template", "pt_spy"),
 (this_or_next|eq, ":cur_template", "pt_sacrificed_messenger"),
 (this_or_next|eq, ":cur_template", "pt_forager_party"),
 (this_or_next|eq, ":cur_template", "pt_scout_party"),
 (this_or_next|eq, ":cur_template", "pt_patrol_party"),
 (this_or_next|eq, ":cur_template", "pt_messenger_party"),
 (this_or_next|eq, ":cur_template", "pt_raider_party"),
 (this_or_next|eq, ":cur_template", "pt_raider_captives"),
 (this_or_next|eq, ":cur_template", "pt_kingdom_caravan_party"),
 (this_or_next|eq, ":cur_template", "pt_prisoner_train_party"),
 (this_or_next|eq, ":cur_template", "pt_default_prisoners"),
 (this_or_next|eq, ":cur_template", "pt_routed_warriors"),
 (this_or_next|eq, ":cur_template", "pt_center_reinforcements"),
 (this_or_next|eq, ":cur_template", "pt_dplmc_spouse"),
 (this_or_next|eq, ":cur_template", "pt_dplmc_gift_caravan"),
 (eq, ":cur_template", "pt_dplmc_recruiter"),
   (party_set_icon, ":cur_party", "icon_ship"),
 (else_try),
   (neq,":terrain",7),
   (party_get_template_id, ":cur_template", ":cur_party"),
   (eq, ":cur_template", "pt_kingdom_hero_party"),
 (party_set_icon,":cur_party","icon_flagbearer_a"),
 (else_try),
 (this_or_next|eq, ":cur_template", "pt_kingdom_hero_party"),
 (this_or_next|eq, ":cur_template", "pt_forest_bandits"),
 (this_or_next|eq, ":cur_template", "pt_taiga_bandits"),
 (this_or_next|eq, ":cur_template", "pt_steppe_bandits"),
 (this_or_next|eq, ":cur_template", "pt_sea_raiders"),
 (this_or_next|eq, ":cur_template", "pt_mountain_bandits"),
 (this_or_next|eq, ":cur_template", "pt_desert_bandits"),
 (this_or_next|eq, ":cur_template", "pt_deserters"),
 (this_or_next|eq, ":cur_template", "pt_merchant_caravan"),
 (this_or_next|eq, ":cur_template", "pt_troublesome_bandits"),
 (this_or_next|eq, ":cur_template", "pt_bandits_awaiting_ransom"),
 (this_or_next|eq, ":cur_template", "pt_kidnapped_girl"),
 (this_or_next|eq, ":cur_template", "pt_village_farmers"),
 (this_or_next|eq, ":cur_template", "pt_spy_partners"),
 (this_or_next|eq, ":cur_template", "pt_runaway_serfs"),
 (this_or_next|eq, ":cur_template", "pt_spy"),
 (this_or_next|eq, ":cur_template", "pt_sacrificed_messenger"),
 (this_or_next|eq, ":cur_template", "pt_forager_party"),
 (this_or_next|eq, ":cur_template", "pt_scout_party"),
 (this_or_next|eq, ":cur_template", "pt_patrol_party"),
 (this_or_next|eq, ":cur_template", "pt_messenger_party"),
 (this_or_next|eq, ":cur_template", "pt_raider_party"),
 (this_or_next|eq, ":cur_template", "pt_raider_captives"),
 (this_or_next|eq, ":cur_template", "pt_kingdom_caravan_party"),
 (this_or_next|eq, ":cur_template", "pt_prisoner_train_party"),
 (this_or_next|eq, ":cur_template", "pt_default_prisoners"),
 (this_or_next|eq, ":cur_template", "pt_routed_warriors"),
 (this_or_next|eq, ":cur_template", "pt_center_reinforcements"),
 (this_or_next|eq, ":cur_template", "pt_dplmc_spouse"),
 (this_or_next|eq, ":cur_template", "pt_dplmc_gift_caravan"),
 (eq, ":cur_template", "pt_dplmc_recruiter"),
 (party_set_icon,":cur_party","icon_vaegir_knight"),
 (try_end),]),
   
]),
]
 
I have a question, this "ModSys" as referred in this guide (http://forums.taleworlds.com/index.php/topic,240255.0.html), what is it and how do I find it, I am having trouble understanding that part.

NVM, figured it out.
 
just5tme1989 said:
I have a question, this "ModSys" as referred in this guide (http://forums.taleworlds.com/index.php/topic,240255.0.html), what is it and how do I find it, I am having trouble understanding that part.

Lumos' guide is just about the best, most lucid guide extant to the Module  System (ModSys).  If you are not able to  understand what you have read, modding may be beyond you.

TA
 
@Cozur, you have one to many "])," i think, also I presume this at the very end of your module triggers as you have "]" at the very end? If its not at the end I would remove that as well.
 
Suppose I have a can-fail script "cf_is_positive" that checks if its argument is >= 0. I call it inside the conditions block of a game menu option, eg:

Code:
#conditions of the option "Go back"
[
    (call_script, "script_cf_is_positive", 2)
]

This will obviously pass the check for that option. But what if I do this:

Code:
#conditions of the option "Go back"
[
    (neg|call_script, "script_cf_is_positive", -2)
]

This to me should have made the script return "false", which then is negated and make the condition block pass.

Instead the script fails and the whole condition block fails too. So I guess a can-fail script can either succeed or fail hard, never return false.

Is this correct, ie does it make any sense to use "neg" for can-fail scripts? I have included a mod that does this and would like a confirmation it is not supposed to work.

I hope this is clear enough. Thanks!

EDIT: found an old request by Caba`drin about (almost) the same issue: http://forums.taleworlds.com/index.php/topic,6575.msg4964618.html#msg4964618

Apparently we can't neg or put this_or_next in a call_script line. Good to know.
 
Can i make grass grow in the desert? I'm trying to make it more scrubland-like (sand dunes are dull to look at). I added some dry looking grass to flora_kinds.py. if i treat it like the other bushes, it appears only in a tiny corner and has a puny draw distance. But if i add fkf_grass, it doesn't appear at all. Not to mention the fact that no flora at all appear in normal desert (I'm using forest desert for the most part).

Is this hardcoded?
 
For some reason the spawn item cheat wont work for my debugging purposes, menus after about time 650 are just blank. The only error it gives me is an invalid value error at line 2 in the spawn item menu in module_game_menus.
 
I am trying to put in a trigger so that every 2 weeks the king has a chance of getting some extra troops. The trigger is working and the troops are being added. The problem is that I added this line:

(neq, ":party_id", -1),

which I figured was meant to stop the trigger running when a lord is defeated and has no party yet when that happens I get a script error saying invalid party id (iirc). Is the line correct or is there a better line to stop this happening?
 
Nameless Warrior said:
I am trying to put in a trigger so that every 2 weeks the king has a chance of getting some extra troops. The trigger is working and the troops are being added. The problem is that I added this line:

(neq, ":party_id", -1),

which I figured was meant to stop the trigger running when a lord is defeated and has no party yet when that happens I get a script error saying invalid party id (iirc). Is the line correct or is there a better line to stop this happening?

(party_is_active, ":party_id"),
 
The_dragon said:
Nameless Warrior said:
I am trying to put in a trigger so that every 2 weeks the king has a chance of getting some extra troops. The trigger is working and the troops are being added. The problem is that I added this line:

(neq, ":party_id", -1),

which I figured was meant to stop the trigger running when a lord is defeated and has no party yet when that happens I get a script error saying invalid party id (iirc). Is the line correct or is there a better line to stop this happening?

(party_is_active, ":party_id"),

Thanks dragon. Is a party considered inactive if they are in a battle or siege? The chances are small the trigger may go when the King is in combat but it may happen.
 
Status
Not open for further replies.
Back
Top Bottom