ptifab Posted January 21, 2020 Author Share Posted January 21, 2020 Thanks @Jarno Mikkola, i wasn't aware of that code, now i know how it work. Do you know, for modding purpose, if i create an item wich i want to have similar drow properties, how it will be handled by the game ? because this is just a script from a specific area. Like if a mod gives me an item like this, how the engine will know that it must be turned to dust if i don't update this one specifically and/or i'm teleported to another exterior area ? Is the flag at 0x19 BIT15 : EE:adamantine (15) is supposed to fulfill that state without script ? Quote Link to comment
Jarno Mikkola Posted January 21, 2020 Share Posted January 21, 2020 Nope. What you want to do is triggered event... aka, just like the above, you setup a GLOBAL that controls it. Set it to 1 after you want to trigger the even, and use this: TakeItemReplace("customitemname without the .itm","replacing item name without the .itm",Player1) -thing, with Player1-6 when the GLOBAL is one, and when it's over set the GLOBAL to two, very similarly like the above. PS, the .itm's have a max of 8 characters, should you not know that, now you do. Quote Link to comment
jastey Posted January 21, 2020 Share Posted January 21, 2020 In SoD I found the action: ActionOverride("npcname",DestroyAllFragileEquipment(ADAMANTINE)) I would assume this would destroy any items flagged with this flag. This flag is not available in original BGII (I don't know about ToBEx), hence the very long script to catch all available items. If the party teleports elsewhere, the items would not be destroyed unless such a script runs in the new area, too. Quote Link to comment
ptifab Posted January 21, 2020 Author Share Posted January 21, 2020 Thanks a lot to you both, i don't want to add too much global scripts events, so i will stay away from that kind of items ! Quote Link to comment
ptifab Posted January 26, 2020 Author Share Posted January 26, 2020 (edited) I'm trying to create a function (based on some already functionning existing code) to exclude specifics items from the file itemexcl.2da, but i would like to automate the process. I've already made it work for all armors, but for specific items i don't know how to procede. Here's my existing code for specific items : 1st part OUTER_SPRINT item_exclusion ~%specific_itemname%~ <- insert the item name here 2nd part COPY_EXISTING ~itemexcl.2da~ ~override~ READ_2DA_ENTRIES_NOW num_rows 2 FOR (i = 1; i < num_rows; i += 1) BEGIN READ_2DA_ENTRY_FORMER num_rows i 0 current_item SET isToExclude = 0 PATCH_IF (FILE_EXISTS_IN_GAME ~%current_item%.itm~) BEGIN INNER_PATCH_FILE ~%current_item%.itm~ BEGIN PATCH_IF (current_item STRING_EQUAL_CASE ~%item_exclusion%~) BEGIN SET isToExclude = 1 END END END PATCH_IF (isToExclude == 1) BEGIN REPLACE_TEXTUALLY ~[%LNL%%MNL%%WNL%][ %TAB%]*%current_item%[ %TAB%].*~ ~~ END END BUT_ONLY the file is actually not removed, if someone can help me on this one ? Edited January 26, 2020 by ptifab typos Quote Link to comment
subtledoctor Posted January 26, 2020 Share Posted January 26, 2020 Might try something like DEFINE_ACTION_FUNCTION no_exclude_item STR_VAR item_to_remove = ~null~ BEGIN COPY_EXISTING ~itemexcl.2da~ ~override~ READ_2DA_ENTRIES_NOW num_rows 2 FOR (i = 1; i < num_rows; i += 1) BEGIN READ_2DA_ENTRY_FORMER num_rows i 0 current_item PATCH_IF (FILE_EXISTS_IN_GAME ~%current_item%.itm~) BEGIN PATCH_IF (~%current_item%~ STRING_EQUAL_CASE ~%item_to_remove%~) BEGIN REMOVE_2DA_ROW i 2 END END END BUT_ONLY END LAF no_exclude_item STR_VAR item_to_remove = ~sw1h04.itm~ END That will probably need some fiddling - to make sure the row count is right and it removes the correct row, and maybe a sanity check in case an item appears in two or more rows. But once fine-tuned, it should get the job done. Quote Link to comment
Jarno Mikkola Posted January 26, 2020 Share Posted January 26, 2020 Or you could just replace the file with an premade empty file. COPY ~modfolder/itemexcl.2da~ ~override~ Cheese luice, people don't just think. Quote Link to comment
ptifab Posted January 26, 2020 Author Share Posted January 26, 2020 15 minutes ago, subtledoctor said: Might try something like DEFINE_ACTION_FUNCTION no_exclude_item STR_VAR item_to_remove = ~null~ BEGIN COPY_EXISTING ~itemexcl.2da~ ~override~ READ_2DA_ENTRIES_NOW num_rows 2 FOR (i = 1; i < num_rows; i += 1) BEGIN READ_2DA_ENTRY_FORMER num_rows i 0 current_item PATCH_IF (FILE_EXISTS_IN_GAME ~%current_item%.itm~) BEGIN PATCH_IF (~%current_item%~ STRING_EQUAL_CASE ~%item_to_remove%~) BEGIN REMOVE_2DA_ROW i 2 END END END BUT_ONLY END LAF no_exclude_item STR_VAR item_to_remove = ~sw1h04.itm~ END That will probably need some fiddling - to make sure the row count is right and it removes the correct row, and maybe a sanity check in case an item appears in two or more rows. But once fine-tuned, it should get the job done. i just had to remove the .itm from the command setting, but it worked. Thanks a lot @subtledoctor Quote Link to comment
subtledoctor Posted January 26, 2020 Share Posted January 26, 2020 Whoops, yeah, invoking the function would be: LAF no_exclude_item STR_VAR item_to_remove = ~sw1h04~ END Quote Link to comment
ptifab Posted January 27, 2020 Author Share Posted January 27, 2020 (edited) Does anyone knows if monsters ability scores have the same functionalities as for players ? I mean, sometimes i see .CRE with 9 everywhere and AC and THAC0 sets by hand obviously, but what if i changed it to, say, Strength 20 for example ? Does its damage score and thac0 are changed by the stat bonuses given by a Strength that high ? Or will it use the THAC0 given by hand ? Edited January 27, 2020 by ptifab typos Quote Link to comment
subtledoctor Posted January 28, 2020 Share Posted January 28, 2020 Stat bonuses apply to monster .CREs. (Well, STR and DEX at least. I dunno about CON, and the mental stats will have no effect.) Quote Link to comment
ptifab Posted January 28, 2020 Author Share Posted January 28, 2020 (edited) thanks @subtledoctor I forgot to ask if the class has any impact on the abilities and/or the stats. If a demon is a thief, can it hide in shadows ? if a basilisks is a mage, can he cast spells ? does they gets the bonus effects from levels (thac0 from warriors does not progress like these of mages for example) Edited January 28, 2020 by ptifab Quote Link to comment
subtledoctor Posted January 28, 2020 Share Posted January 28, 2020 Not really. Any active abilities like spells need a creature script to be used; and once the creature is controlled by a script, there’s nothing stopping the script from having a fighter cast spells or a cleric hide in shadows. Even passive abilities like an Archer’s to-hit bonus have to be specifically added to the creature. The only exception is if you install SCS. In that case creatures will actually get passive kit abilities applied, and in some cases might be scripted to use some active abilities. Likewise, with my feats mod some fighters and thieves will be coded to get the benefit of a few passive feats. (Not active abilities though - I don’t do scripting.) But in these cases the modder has specifically programmed enemies to get those abilities... the game engine doesn’t do it by itself. Thac0, AC, saves, and similar values are coded into the .CRE file... they are modified by stats and spell effects, but not by class or level. Quote Link to comment
kjeron Posted January 28, 2020 Share Posted January 28, 2020 5 hours ago, ptifab said: thanks @subtledoctor I forgot to ask if the class has any impact on the abilities and/or the stats. If a demon is a thief, can it hide in shadows ? if a basilisks is a mage, can he cast spells ? does they gets the bonus effects from levels (thac0 from warriors does not progress like these of mages for example) Their class will affect which level the creature casts spells at. A creature with a player-class will cast wizard/priest spells at their wizard/priest caster level, or level 1 if they lack it. A creature with a monster-class cast wizard/priest spells at their character/innate level (1st class level). Quote Link to comment
ptifab Posted January 28, 2020 Author Share Posted January 28, 2020 Thanks you both for your explanations, that enlightens to me some dark parts of the game since a lot of time ! Quote Link to comment
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.