Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
I have found a new type of error and that time I cannot find out what is wrong and handle it by myself. I was editing some of the items. Done this for the second time. The first time there were no mistakes, but the second...
Traceback (most recent call last):
  File "process_items.py", line 65, in <module>
    write_items(variables,variable_uses,tag_uses,quick_strings)
  File "process_items.py", line 48, in write_items
    save_simple_triggers(ofile,trigger_list, variable_list,variable_uses,tag_use
s,quick_strings)
  File "E:\M&BN modding tools\mb_module_system_0892_0\Module_system\process_oper
ations.py", line 449, in save_simple_triggers
    ofile.write("%f "%(trigger[0]))
TypeError: float argument required
I cannot even understand where that error is. I have modified just module_items.py and got this. And how can I fix it? Haven't touched proces_operations.py, but the eror is there.
 
From the traceback, it seems you've got a simple trigger attached to an item, and the trigger rate (the first field in a simple trigger) is not a decimal (float) value.
 
I am trying to make a desert city:



As you can see, the scene is not very bright. It is a necessity that the scene is very bright. How to make the scene very bright?
 
Im trying to use the sorted loot script from BOW, I have copied it and pasted and it compiles fine, but it doesnt seem to have any effect in game. What else do I need to do to make it work? (sorry for my newbness)

Also:
eljeffe418 said:
(try_for_range, ":troop_iterator", 0, ":num_stacks"),
            (party_stack_get_troop_id, ":cur_troop_id", ":root_winner_party", ":troop_iterator"),
            (troop_is_hero, ":cur_troop_id"),
            (troop_set_slot, ":cur_troop_id", slot_troop_is_prisoner, 0),
            (troop_set_slot, ":cur_troop_id", slot_troop_leaded_party, -1),
            (troop_get_slot,":cur_troop_ranka",":cur_troop_id",slot_troop_renown),
          (party_get_num_companion_stacks, ":num_stacks", ":collective_casualties"),
          (try_for_range, ":troop_iterator", 0, ":num_stacks"),
            (party_stack_get_troop_id, ":cur_troop_id", ":collective_casualties", ":troop_iterator"),
            (troop_is_hero, ":cur_troop_id"),
            (troop_set_slot, ":cur_troop_id", slot_troop_is_prisoner, 0),
            (troop_set_slot, ":cur_troop_id", slot_troop_leaded_party, -1),
            (troop_get_slot,":cur_troop_rank",":cur_troop_id",slot_troop_renown),
            (try_begin),
              (ge, ":cur_troop_ranka", ":cur_troop_rank"),
              (party_add_prisoners, ":nonempty_winner_party", ":cur_troop_id", 1),
              (gt, reg0, 0),
              (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,"str_hero_taken_prisoner"),
            (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),


Modified source code to make it so lords can capture each other. I think it was originally in the source but the variable to see if they can be captured wasn't declared, I think. There's already a string for the lord getting captured. I changed it so that it's based on difference of renown.
Does this require anything else to work?, like dialogs, etc. Again sorry if the questions are dumb.
 
Well, you'll have to make sure you have the line (probably immediately prior) to count the stacks in the enemy troop and assign that to ":num_stacks".  Similarly ":root_winner_party", ":collective_casualties" (which appears to refer to a party, not a number), ":nonempty_winner_party", ":faction_receiving_prisoners", and ":defeated_faction" all need to have values assigned prior to this code.  Some of that's done by Native, IIRC, but not all.  Check all those first.
 
Hellequin said:
Well, you'll have to make sure you have the line (probably immediately prior) to count the stacks in the enemy troop and assign that to ":num_stacks".  Similarly ":root_winner_party", ":collective_casualties" (which appears to refer to a party, not a number), ":nonempty_winner_party", ":faction_receiving_prisoners", and ":defeated_faction" all need to have values assigned prior to this code.  Some of that's done by Native, IIRC, but not all.  Check all those first.

collective_casualties is indeed a party, not a number. How it works is a bit confusing -- it gets assigned to be the losing party in a battle, and is then used for transferring prisoners to p_temp_party.

Sorely,
Winter
 
I just changed the value in module_constants.py (line 363) from 100 to 80.

Code:
hero_escape_after_defeat_chance = 80 #TODO: it should be:80

However, I think the script doesn't have the correct strings attached to it. In other words, "str_hero_taken_prisoner" has no value for s1, s2 and s3. I got wierd message when a hero is capture.

Edit: my code is similar to the code posted by eljeffe418

http://forums.taleworlds.com/index.php/topic,8652.240.html

I only add 3 lines to get the value for s1, s2 and s3. I think it should work

             (try_begin),
               (ge, ":rand", hero_escape_after_defeat_chance),
               (party_add_prisoners, ":nonempty_winner_party", ":cur_troop_id", 1),
               (gt, reg0, 0),
               (troop_set_slot, ":cur_troop_id", slot_troop_is_prisoner, 1),
               (str_store_troop_name, s1, ":cur_troop_id"), #new line
               (str_store_faction_name, s2, ":faction_receiving_prisoners"), #New line
               (str_store_faction_name, s3, ":defeated_faction"), #New line

               (display_log_message,"str_hero_taken_prisoner"),
             (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),
 
If someones already posted about this then I'm sorry, I searched and found nothing.

When I load up my mod on the main loading screen the error 'num_params < 16' comes up and cannot be ignored. I've added one string and edited the menus slightly but I cannot see anything wrong with them. I've also looked at the header files for reference but I don't think I've managed to edit one of them by accident. Any clue what the error means?
 
The error stopped appearing when I removed a '\' that was being used to break up the main text in a menu. I have no clue why that's causing an error as it's used in several other menus with no problems.
 
How do you people create a quick and clean .sco file so that it can be edited to make a scene? Cos at the moment, I'm forced to copy some scene and then mechanically delete every object on it.
 
Thanks Highlander, that's twice today, you've helped me out.

edit: Third time?  :grin:

How do you check the distance to the closest party? or get the closest party?
 
D'Sparil said:
Im trying to use the sorted loot script from BOW, I have copied it and pasted and it compiles fine, but it doesnt seem to have any effect in game. What else do I need to do to make it work? (sorry for my newbness)

MBX is where it's at.

http://mbx.streetofeyes.com/index.php/topic,43.msg79.html#msg79
 
Ok, I have the most gigantic, enourmous, ginormous and large problem ever had by enyone in existance. Assertion Error!!!

I posted a thread about this earlier, and I got a few replies but no solution, and the thread has long since died. I'll quickly tell you what the problem is:

Whenever I start up my mount and blade mod after compiling it, I get that error thingy where if you say ignore a few times it goes away. Fine, everyone gets that. However, when I try and start a new game in my module, I get another assertion error which stops the game from loading, and won't go away however many times you say ignore. It looks something like this:

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

I should make it clear that all I did was to rename the castles and cities - no new troops, skills, weapons etc, just new names for castles and cities. I don't even have to do anything to get this error. If I make a new mod and compile without changing anything in the module system files (apart from the module directory of course) then I still get the error. This implies to me that it is something to do with the module system, but then again, I only know one other person who has this error. Just so you know, I'm using version 0.894 of Mount&Blade, 0.894 of module system, and 2.5 of python. Whoever solves this problem for me will have their name put in the credits of my mod in massive writing.
 
That error is a familiar one - hint, try here for help in identifying errors - which means that a unit is being given a skill over ten (or, less commonly, under zero).  Often this is by accident; stacking knows_common|knows_riding_10 would do it, for example (because "knows_common" includes a point or two of Riding skill itself).

Since you get this error even during a "clean" Native recompile, suggesting a blip in the code somewhere, then I suggest strongly that you do a completely clean install.  Re-download both M&B and the mod system; install them into a completely new directory (this won't interfere with your old one); compile Native (remember to change the dir to the new, not old, path).  If the error persists, go so far as to uninstall the previous M&B and try this all again.  If neither step works, come back to us and let us know and we'll see what else we can do to help.  (In previous modsys versions this has occasionally cropped up, and IIRC this is the recommended fix, so you're not alone here.)
 
How do you find the distance between you and the closest party on the map... or how do you just identify the closest party to you?
 
Try this:

Code:
(assign, ":closest_approach", 100000),
(assign, ":nearest_party", "p_player_party"), # Default so that an enemy-empty map can't crash game
(try_for_parties, ":this_party"),
  (neq, ":this_party", "p_player_party"),
  (neg|is_between, ":this_party", centers_begin, centers_end), # Assuming you want to discount towns, castles, etc.
  (neg|is_between, ":this_party", spawn_points_begin, spawn_points_end), # Ditto spawn points
  (store_distance_to_party_from_party, ":this_approach", ":this_party", "p_player_party"),
  (lt, ":this_approach", ":closest_approach"),
  (assign, ":closest_approach", ":this_approach"),
  (assign, ":nearest_party", ":this_party"),
(try_end),
 
Status
Not open for further replies.
Back
Top Bottom