Also how do you copy an existing resource, but rename the copy?
PS: this is relating to using WIEDU.
Edited by rhomboidspace, 04 February 2009 - 08:12 AM.
Posted 04 February 2009 - 08:08 AM
Edited by rhomboidspace, 04 February 2009 - 08:12 AM.
Posted 04 February 2009 - 09:33 AM
You can check which item types a bag can 'buy'. Something likeI would like to make a patch that increases the capacity of bags, but make the capacity different based on what the bag carries.
COPY_EXISTING_REGEXP GLOB ~.*\.sto~ ~override~ READ_LONG 0x8 store_type PATCH_IF (store_type=5) BEGIN // if container SET arrow=0 SET amulet=0 SET armor=0 SET scroll=0 // ... and so on... READ_LONG 0x2c type_off READ_LONG 0x30 type_num FOR (i=0;i<type_num;i+=1) BEGIN READ_LONG (type_off+i*0x4) item_type PATCH_IF (item_type=1) BEGIN // if buys amulets SET amulet=1 END PATCH_IF (item_type=5) BEGIN SET arrow=1 END PATCH_IF (item_type=11) BEGIN SET scroll=1 END //... and so on... END // end of the FOR loop PATCH_IF ( (amulet=1) AND (armor=0) ) BEGIN // buy amulets but not armor, a bit unreliable with just two checks but I hope you've got the idea WRITE_SHORT 0x22 100 // set the capacity to 100 END PATCH_IF (armor=1) BEGIN // if it buys armor then it likely buys everything WRITE_SHORT 0x22 200 END //... and so on again... END // initial PATCH_IF (store_type=5) BUT_ONLY_IF_IT_CHANGES
COPY_EXISTING ~oldname~ ~dir/newname~Also how do you copy an existing resource, but rename the copy?
Edited by GeN1e, 04 February 2009 - 09:35 AM.
Retired from modding.
Posted 04 February 2009 - 03:09 PM
COPY_EXISTING ~oldname~ ~dir/newname~
Posted 04 February 2009 - 04:27 PM
First off what you are wanting is hard to do on the fly. It's not impossible but hard. You have to do somethings that really should not be done because if you screw up the code it can cause untold problems anything from a continues loop during install to a full crash during the game.COPY_EXISTING ~oldname~ ~dir/newname~
i'm looking for a method for using regexp, how to search for files who's names follow a pattern, and change some characters in the filename and keep others, i guess the regexp tutorial isn't quite fully understandable to me.
OUTER_SET count = 0 OUTER_SPRINT modprefix ~ab~ //that's mine don't use it COPY_EXISTING_REGEXP GLOB ~^.+\.sto$~ ~override~ PATCH_IF (~%SOURCE_FILE%~ STRING_EQUALS_CASE ~^bag.*~) BEGIN SET count = %count% + 1 SPRINT newfilename ~%modprefix%_bag%count%~ SPRINT oldfilename ~%SOURCE_FILE%~ INNER_ACTION BEGIN COPY_EXISTING ~%oldfilename%.sto~ ~override\%newfilename%.sto~ //make your patch changes here to increase or decrease a bag's container capacity BUT_ONLY_IF_IT_CHANGES END END BUT_ONLY_IF_IT_CHANGES
OUTER_SET num = 0 OUTER_SPRINT modprefix ~ab~ //that's mine don't use it COPY_EXISTING_REGEXP GLOB ~^bag.*\.sto$~ ~override\%ab%_bag%num%.sto~ SET num = %num% + 1 //make your patch changes here to increase or decrease a bag's container capacity BUT_ONLY_IF_IT_CHANGES
My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altheri...s.com/index.htm
Posted 04 February 2009 - 06:18 PM
I think this could be done a little less dodgily (but probably not any quicker) if you used arrays. One pass through the files to add the ones you want to the array, and then another that copies, renames, and modifies those as you see fit.First off what you are wanting is hard to do on the fly. It's not impossible but hard. You have to do somethings that really should not be done because if you screw up the code it can cause untold problems anything from a continues loop during install to a full crash during the game.
It is generally a bad idea to copy a resource into weidu's memory and then to copy the same resource again. However, if you are careful not to make any changes to the outer instance of the resource and you rename the resource when you do make changes then you should be safe.
Posted 06 February 2009 - 09:52 AM
Posted 06 February 2009 - 01:04 PM
If you have a concrete list of the files you wish to copy, it's probably easier to just do COPY_EXISTING on that list, renaming each one individually. Given this list of files, a text editor with regular expression search/replace capability can be a quick way to generate the renamed files if you are renaming on some sort of pattern.i've figured out how to selectively increase the quanities of bags, but what i'm still having trouble with is copying animation bams for my nice little 1h crossbow. for now i'm just using normal crossbow animations for all the non-attack animations, and untill i get the patience to make 1h animations that work just using dagger thrust animations for attacking. on my system i just found all the animations needed and manually copied and renamed them, but I really would like to find some kind of method using COPY_EXISTING_REGEXP to extract all proper animations, and rename them, that way none of possible the animations are missed, to prevent crashes. any sugestions. even if someone could slightly explain better how _REGEXP works in renaming might allow me to be able to figure it out myself.
COPY_EXISTING ~file1~ ~override/renamed1~ ~file2~ ~override/renamed2~ ~file3~ ~override/renamed3~
Posted 06 February 2009 - 01:37 PM
You may be right. I don't know everything there is to know about weidu. I certainly don't know how to use an array or how to even create one...I think this could be done a little less dodgily (but probably not any quicker) if you used arrays. One pass through the files to add the ones you want to the array, and then another that copies, renames, and modifies those as you see fit.First off what you are wanting is hard to do on the fly. It's not impossible but hard. You have to do somethings that really should not be done because if you screw up the code it can cause untold problems anything from a continues loop during install to a full crash during the game.
It is generally a bad idea to copy a resource into weidu's memory and then to copy the same resource again. However, if you are careful not to make any changes to the outer instance of the resource and you rename the resource when you do make changes then you should be safe.
My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altheri...s.com/index.htm