kt0's item scripts: BLAM

Users who are viewing this thread

Less than a week I'd think, but it'll probably come with similar caveats to the item script.  Enough people have asked recently that I'm starting work this evening.
 
kt0 said:
Less than a week I'd think, but it'll probably come with similar caveats to the item script.  Enough people have asked recently that I'm starting work this evening.

Thats great news.  I think I may continue to tweak items and just wait for this script to come out.  I read the limitations but I am not sure I understand what the caveats are.  Everything seems to work great with no issues. 

 
For the item script, it screws up aliased flags where they overlap.  So stuff like itc_longsword and itc_scimitar can get screwed up pretty badly depending on which one shows up first in the lookup table.  I noticed it particularly on polearms.  Even where it screws up, the results should always be functionally equivalent.

For the troop script on the way (probably 1/3 to 1/2 done), I've got the same sorts of issues with skills.  There's another real bad issue with weapon proficiencies.  We typically define them with macros like these: 
def wp_melee(x):
  n = 0
  r = 10 + int(x / 10)
  n |= wp_one_handed(x + random.randrange(r))
  n |= wp_two_handed(x + random.randrange(r))
  n |= wp_polearm(x + random.randrange(r))
  return n
Because of the randomness involved, it's super hard to divine what the actual macro values are.  This is especially bad in my mod FWIW.  So I'm stuck with either using the random values as they've been spit out, or having to live with proficiencies that wander more with each successive run.  This is an interesting problem that doesn't seem to have a good solution. 
 
So I'm def bringing it back from the dead. I followed your instructions in thread. I have it all set up like you I believe and I run c:\MB_Ruby\kt_tools>items2tuples.rb and it says "path" is not recognized as an internal or external command, operable program or batch file. Now I'am using Vista and I did run as admin. Also I have only two RB files form your download its csv2tuples.rb and items2csv.rb so I was wondering if maybe I wasn't suppose to type items2tuples and type items2csv.rb either way I get the same error.

Am I suppose to copy over any py files ahead of time to this folder? Do you do it differently in Vista? WHat am I doing wrong?

I'm trying to create the py file with tuples for my items.
 
I realize this topic hasnt been active for some time,but hopefully someone here can help me anyhow..

When i try to run either of the two files included the following error occurs:

<internal:enc/prelude>:3:in `require': code converter not found (ASCII-8BIT to U
TF-:cool: (Encoding::ConverterNotFoundError)
        from <internal:enc/prelude>:3:in `block in <compiled>'
        from <internal:enc/prelude>:1:in `each'
        from <internal:enc/prelude>:1:in `<compiled>'

I installed the RubyInstaller from the ruby-lang website and edited the files in notepad according to the instructions.
I get this error on two different computers and dont know how to fix it.
Ive tried searching for a soloution on the web but couldnt find any.
Anyone have a clue on how i can get this to work?
 
Knight Inquisitor said:
Please, man, re-upload it. All your stuff are broken links ( and also for this 2's: "kt0's troop script"; "kz0's ParyScript")
The M&B Repository has been updated since 2009 (surprise) and the linking system changed. The links to kt0's various contributions have been updated, but the tools may not work with current versions.
 
This is a necro....but.....

The only way I could get this to work with ruby 1.8.6 and warband is to run this python code after you have run items2csv.rb and before you have run csv2tuples.rb.

Code:
removeList = []
removeList.append(",,0,0,imodbits_none,0,0.0000,0,0,0,0,0,0,0,0,0,0,,,0,\n")
removeList.append("0,,0,0,imodbits_none,0,0.0000,0,0,0,0,0,0,0,0,0,0,,,0,\n")
removeList.append("0,,0,0,imodbits_none,0,0.0000,0,0,0,0,0,0,0,0,0,0,,,0,\n")
removeList.append("2,,0,0,imodbits_none,0,0.0000,0,0,0,0,0,0,0,0,0,0,,,0,\n")
removeList.append("1,,0,0,imodbits_none,0,0.0000,0,0,0,0,0,0,0,0,0,0,,,0,\n")


print "starting..."
print
print
f = open("item_kinds1_native.csv", 'r')   #the csv file that items2csv.rb created
fout = open("item_kinds1_native_new.csv", 'w')  #you will need to make this file the source file for csv2tuples.rb

f.readline()

for line in f:
    #print line
    if removeList.count(line) == 0:
        fout.write(line)    
        
f.close()
fout.close()
print
print
print "stopping"

What this does is it strips out the follow which appears after every item in the csv file:
,,0,0,imodbits_none,0,0.0000,0,0,0,0,0,0,0,0,0,0,,,0,
0,,0,0,imodbits_none,0,0.0000,0,0,0,0,0,0,0,0,0,0,,,0,
0,,0,0,imodbits_none,0,0.0000,0,0,0,0,0,0,0,0,0,0,,,0,


Now this means that some items will not be converted into the module_items.py and you will have to double check your work, but it gives you something to go off of when you have tons of items.  If you find that an item looks weird in the output .py file, look at the item_kind1_new.csv and see if any similar lines exist.  For example, on the Steppe horse item I had to add the following 2 lines to the removeList because the Steppe Horse itm contains faction codes:
Code:
removeList.append("2,,0,0,imodbits_none,0,0.0000,0,0,0,0,0,0,0,0,0,0,,,0,\n")
removeList.append("1,,0,0,imodbits_none,0,0.0000,0,0,0,0,0,0,0,0,0,0,,,0,\n")

Here is the itm for Steppe Horse in the native module_items:
["steppe_horse","Steppe Horse", [("steppe_horse",0)], itp_merchandise|itp_type_horse, 0, 192,abundance(80)|hit_points(120)|body_armor(10)|difficulty(2)|horse_speed(40)|horse_maneuver(51)|horse_charge(:cool:|horse_scale(9:cool:,imodbits_horse_basic, [], [fac_kingdom_2, fac_kingdom_3]],
The offending parts of the itm are in bold.

OR, you could just remove the offending itms from the item_kinds1.txt file as they are most likely not what you are looking for.

If I'm crazy, let me know, but this is the only way I could get kt0's item script to work with warband and ruby 1.8.6 from rubyinstaller.  I couldn't get the newest version of ruby to work at all with the scripts.
 
ALSO, you have to edit items2csv.rb because I found a couple of errors.  Search for the following lines

Code:
		elsif ITP_TYPE_BODY_ARMOR == item_type || ITP_TYPE_LEG_ARMOR == item_type

Change it to:

Code:
		elsif ITP_TYPE_BODY_ARMOR == item_type || ITP_TYPE_FOOT_ARMOR == item_type 


And then search for
Code:
			printf( "\tWARNING:  got {itp_doesnt_cover_hair|itp_covers_legs} on a non-armor piece (%s)\n", $item_type_array[itemp_type] )
And change it to:
Code:
			printf( "\tWARNING:  got {itp_doesnt_cover_hair|itp_covers_legs} on a non-armor piece (%s)\n", $item_type_array[item_type] )

From my observations, any item with a trigger or a faction code will cause problems and you will have to double check them.  By fixing these two lines of code I was able to process through the entire native txt file for Warband and produce a WIP module_items.

Edit:  I'm not sure why, but items2csv.rb only seems to process every other two items.

Edit2:  Change the following code in items2csv.rb
Code:
$item_type_flags_hash[ ITP_SPEAR ] = "itp_spear"   

to
Code:
$item_type_flags_hash[ ITP_SPEAR ] = "itp_default_ammo"    #change.  in warband, itp_spear is obsolete and repalced by itp_default_ammo.  see header items

Also, to get all the items, I had to make 3 runs of the code starting at different spots in the items text file.  Each .py file has 1 out of every 3 items, not sure why.
 
Just as a reminder for those interested: swysdk is a vanilla WB 1.153 module system integrated
with kt0's BLAM and many other additions and enhancements. Search for it in the forum.


If you don't want to use it, at least take it a look for reference.
May come in handy for "advanced" modders.
 
Back
Top Bottom