jastey Posted September 16, 2004 Share Posted September 16, 2004 Hi, I have two questions to BG1 coding: 1. If I want to have a nice visual effect, e.g. one creature dissappears with a lot of glowing light.. whatever, how do I code that? (For BGII, I would use: CreateVisualEffectObject("effect",Myself) Is there something similar for BG1?) 2. I have problems to put an item into an existing container. I have the following code in the area.baf: IF Global("C#ItemInTruhe","GLOBAL",0) THEN RESPONSE #100 SetGlobal("C#ItemInTruhe","GLOBAL",1) ActionOverride("Container1",CreateItem("ITEM",0,0,0)) END which is the only way I see, but this puts the item in front of the container. How would the correct code have to be, to place the item inside? Thanks! Link to comment
Echon Posted September 16, 2004 Share Posted September 16, 2004 1. If I want to have a nice visual effect, e.g. one creature dissappears with a lot of glowing light.. whatever, how do I code that? (For BGII, I would use: CreateVisualEffectObject("effect",Myself) Is there something similar for BG1?) I would make a custom spell that either has the desired animation as the casting graphics or one that uses Lighting Effect opcodes. 2. I have problems to put an item into an existing container. I have the following code in the area.baf: IF  Global("C#ItemInTruhe","GLOBAL",0) THEN  RESPONSE #100     SetGlobal("C#ItemInTruhe","GLOBAL",1)     ActionOverride("Container1",CreateItem("ITEM",0,0,0)) END which is the only way I see, but this puts the item in front of the container. How would the correct code have to be, to place the item inside? I do not know how this can be done. -Echon Link to comment
jastey Posted September 17, 2004 Author Share Posted September 17, 2004 I would make a custom spell that either has the desired animation as the casting graphics or one that uses Lighting Effect opcodes. Hi Echon! You gave me the "what", now we come to the "how"... No, it's OK, I think I have an idea now of what to do to solve question one, thanks! For question two: Is there really nobody out there who ever coded an additional item into an existing chest in BG1? Link to comment
igi Posted September 17, 2004 Share Posted September 17, 2004 You could perhaps try GiveItemCreate instead of CreateItem. Maybe. Link to comment
Smoketest Posted September 17, 2004 Share Posted September 17, 2004 2. I have problems to put an item into an existing container. I have the following code in the area.baf: IF  Global("C#ItemInTruhe","GLOBAL",0) THEN  RESPONSE #100     SetGlobal("C#ItemInTruhe","GLOBAL",1)     ActionOverride("Container1",CreateItem("ITEM",0,0,0)) END which is the only way I see, but this puts the item in front of the container. How would the correct code have to be, to place the item inside? BG2 uses this method (see AR0602.BCS) and it works great. Assuming Container1 is the actual label of a container in your target area (it's okay to ignore spaces in labels), then it's likely that BG1 wasn't designed with that particular use of CreateItem in mind; perhaps it was an oversight that was later corrected in BG2. There's apparently no way to change a CRE's vocal constants in BG1 either, short of making duplicate CREs but with different constants. I'm not convinced enough of BG1Tutu's compatibility (I expect 100% or no go) and stability to use it, but sometimes it's very tempting. Link to comment
jastey Posted September 18, 2004 Author Share Posted September 18, 2004 @igi: I tried ActionOverride("Container1",GiveItemCreate("ITEM",Myself,0,0,0)) but then actually nothing happened (no item was added) @Smoketest: What do you mean by a CRE's vocal constant? I'm sure I know what it is, but I'm not familiar with the term. I'm not convinced enough of BG1Tutu's compatibility (I expect 100% or no go) and stability to use it, but sometimes it's very tempting. Yes, being used to mod for BGII I felt a bit "handicapped" with all the missing triggers and actions in BGI... As for items into chests: Could you imagine a different way of doing this? How do I add a whole new item into an existing area, is it possible? Perhaps someone has an idea... Link to comment
Smoketest Posted September 18, 2004 Share Posted September 18, 2004 What do you mean by a CRE's vocal constant? I'm sure I know what it is, but I'm not familiar with the term. I'm not convinced enough of BG1Tutu's compatibility (I expect 100% or no go) and stability to use it, but sometimes it's very tempting. Yes, being used to mod for BGII I felt a bit "handicapped" with all the missing triggers and actions in BGI... As for items into chests: Could you imagine a different way of doing this? How do I add a whole new item into an existing area, is it possible? Perhaps someone has an idea... What do you mean by a CRE's vocal constant? I'm sure I know what it is, but I'm not familiar with the term. Maybe I should have said verbal constant. Heh. A character's soundset (selected, injured, etc.) consists of verbal constants, which are little more than references to strings that have attached WAV files. In BG2 you can change these constants with a script action (Edwin does this to become Edwina, and so on), but no such action exists in BG1. As for items into chests: Could you imagine a different way of doing this? How do I add a whole new item into an existing area, is it possible? Perhaps someone has an idea... I don't think there's a way to do it in-game, short of creating the item on the ground as you've already done unintentionally. The risk there is that the item will likely be considered temporary, like drops from monsters are, and will disappear after awhile. You can do it outside a gaming session by using an editor like WeiDU or Near Infinity. With NI just open up the ARE file of choice, find a container, open it for viewing and then add a new item. Save the file and you're done. WeiDU is a bit more complicated and I'm not sure how to do it since I don't use WeiDU for anything but dialog editing. (You probably already know this, but I'll mention it just in case.) Link to comment
jastey Posted September 18, 2004 Author Share Posted September 18, 2004 Maybe I should have said verbal constant. (...) no such action exists in BG1. Ah, good to know. I also deeply missed the "EscapeAreaMove(.)" !! I helped myself with DestroySelf() in front of the door and CreateCreature inside the house. And then I spend 2 hours debugging to set the triggers right, and to realize that the counting of "NumTimesTalkedTo" now was set to zero again. You can do it outside a gaming session by using an editor like WeiDU or Near Infinity. Well, how to do it by WeiDU was my question, actually, because that's what I used and how it can be done "in game" by mod-installation.I know I can change whatever I want by using NI, but I was asking for a way how to include it in a mod, and there NI doesn't help very much (I know you know this, I just wanted to point it out again.) Just imagine: "Hi, this is my new mod. After installation, please open NI and do the following..." Link to comment
hlidskialf Posted September 18, 2004 Share Posted September 18, 2004 There's one other "cheat" way of doing it. If you have a container that ALREADY has an item in it, and you don't mind losing it, you can write your new item in to replace the old at the existing offset. It's cheesy, but if you just have a little gem or something in the container already you don't mind sacrificing, it'll work. As for the NI method mentioned, I think he meant that you could patch the area as you like on your end, then just overwrite the existing area in the end-user's game. It'd work fine so long as no other mod already tweaked that .are file and that the player hasn't been to that area before. (Since that will be in his/her savegame and won't reflect your changes.) Link to comment
jastey Posted September 18, 2004 Author Share Posted September 18, 2004 If you have a container that ALREADY has an item in it, and you don't mind losing it, you can write your new item in to replace the old at the existing offset. That's an interesting idea! Sounds as if you've already done that? Could you give me a hint how to code that? It'd work fine so long as no other mod already tweaked that .are file and that the player hasn't been to that area before. (Since that will be in his/her savegame and won't reflect your changes.) And that's exactly the problem: IMHO, compatibility with other mods is one of the highest priorities for mods, so replacing an existing .AR is no alternative for me. Link to comment
hlidskialf Posted September 19, 2004 Share Posted September 19, 2004 What you need to do is first find out where that item is. I find it easiest to use NI. (Make sure you're set up to show hex offsets!) Then open the area, open the container and check for the offset of your sacrificial item. I can't give you a "real" example from BG1 as I don't have it installed atm. (I'm running a BP-BGT installation and given the size of my archives, I need to have some wiggle room on my HD. ) But using the BGT version of Beregost, here's an example to replace the dagger in Container 1 in that area. COPY_EXISTING ~AR6700.are~ ~Override/AR6700.are~ WRITE_ASCII 0x77c0 ~NewItem~ Do not use the .itm extention for the item in the code. Clear as mud? Link to comment
jastey Posted September 19, 2004 Author Share Posted September 19, 2004 Thanks for the hint with the hex offsets... OK, so what I see for the item is: Item MISC07.ITM (Goldmünze) 3c8 h Unknown 00 00 h 3d0 h Quantity/Charges 1 7 3d2 h Quantity/Charges 2 0 3d4 h Quantity/Charges 3 0 3d6 h Flags ( No flags set ) 3d8 h Does the code now look like this: WRITE_ASCII 0x3c8 ~myitem~ WRITE_ASCII 0x3d2 ~1~ (To consider it's actually only one) (never worked with these asci and hex features before ) Link to comment
hlidskialf Posted September 19, 2004 Share Posted September 19, 2004 Looks okay to me. (Unless someone else knows whether the number being assigned requires a WRITE_xxxxx or something instead.) Give it a try, it'd only take a few minutes to test. Link to comment
jastey Posted September 19, 2004 Author Share Posted September 19, 2004 Give it a try, it'd only take a few minutes to test. That's what I thought...... Then I discovered, that I don't know how to put in the WRITE_ASCII: my .tp2 looks like this: ... COPY ~Modfolder/Items/myitem.ITM~ ~Override~ SAY NAME1 @8 SAY NAME2 @8 SAY UNIDENTIFIED_DESC @9 SAY IDENTIFIED_DESC @9 COMPILE ~Modfolder/Dialogues~ COMPILE ~Modfolder/Scripts~ EXTEND_TOP ~AR3344.bcs~ Modfolder/Scripts/C#AR3344.baf~ I don't use COPY_EXISTING. Link to comment
hlidskialf Posted September 19, 2004 Share Posted September 19, 2004 Well, for this one you'd need to use COPY_EXISTING, otherwise the game doesn't know wtf file you're attempting to patch. Why don't you use it? Anyway, it should look like this: COPY ~Modfolder/Items/myitem.ITM~ ~Override~ SAY NAME1 @8 SAY NAME2 @8 SAY UNIDENTIFIED_DESC @9 SAY IDENTIFIED_DESC @9 COMPILE ~Modfolder/Dialogues~ COMPILE ~Modfolder/Scripts~ EXTEND_TOP ~AR3344.bcs~ Modfolder/Scripts/C#AR3344.baf~ COPY_EXISTING ~AR6700.are~ ~Override/AR6700.are~ //Replace with your area name. WRITE_ASCII 0x3c8 ~myitem~ WRITE_ASCII 0x3d2 ~1~ Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.