OtisTDog Posted May 27, 2009 Share Posted May 27, 2009 So I feel reasonably comfortable with dialog and scripting at this point, and I'd like to put together my first mini-quest, in which the PCs will be tasked with going out and killing a group of monsters. These are monsters that already exist in the vanilla game but have no special importance attached to them. Based on what I understand, what I'll need to do is: 1) modify the scripts used by the creatures so that there is a Die() block which increments a global variable when any one of them is killed 2) I can then use GlobalGT("killcount","GLOBAL",x) [where x is one less than the number of monsters to be killed] in dialog options to sense whether they've all been dispatched Since these are just nameless monsters instead of unique individuals, I'm assuming I have to use DLTCEP or NearInfinity to assign a new script to them. Is this the case? I'm not really familiar with either of those tools yet, and would prefer a straight WeiDU solution if there is one. Any suggestions? --Otis Link to comment
Kaeloree Posted May 27, 2009 Share Posted May 27, 2009 You can assign override scripts to creatures in the tp2 like this: COPY_EXISTING ~creature.cre~ ~override/creature.cre~ WRITE_EVALUATED_ASCII SCRIPT_OVERRIDE ~creature~ #8 This will assign the script "creature" to that .cre file. Link to comment
jastey Posted May 27, 2009 Share Posted May 27, 2009 Keep in mind that using "Die()" is a very unreliable thing to do, as it only works if the creature's script gets executed the instant it dies (which is not necessarily the case). Link to comment
devSin Posted May 27, 2009 Share Posted May 27, 2009 Oh, stop it. It works as long as it's the first action to come up after the sprite dies; "the instant it dies" is nonsense. Die() can fail in some extraordinarily rare (but unknown) cases in BG/TotSC, and it also fails there if gore is disabled IIRC. Link to comment
OtisTDog Posted May 27, 2009 Author Share Posted May 27, 2009 You can assign override scripts to creatures in the tp2 like this: COPY_EXISTING ~creature.cre~ ~override/creature.cre~ WRITE_EVALUATED_ASCII SCRIPT_OVERRIDE ~creature~ #8 This will assign the script "creature" to that .cre file. This is interesting. I haven't learned to put together a TP2 file yet. If I create an override script for the CRE, won't that apply to all creatures of that type wherever they are found? Can I apply it only to creatures of that type in a specific area, or will I need to create a special version of the CRE to replace the existing generic monsters with? --Otis Link to comment
devSin Posted May 27, 2009 Share Posted May 27, 2009 Yes, it would apply to all instances of that CRE. You can clone the CRE to a custom resource for use in your quest; in that instance, if BG/TotSC has the NumDead() triggers, you can also simply assign a unique script name to the CRE instead of an override script and then check NumDeadGT("script_name",x) in the script or dialogue for your quest. Link to comment
Icendoan Posted May 27, 2009 Share Posted May 27, 2009 Every time that .cre file is used, yes. Well, you could complicate your script a little while reusing the same file with things like AreaCheck() in every trigger. Icen Link to comment
Miloch Posted May 27, 2009 Share Posted May 27, 2009 Die()... also fails there if gore is disabled IIRC.That would be a rather stupid piece of buggery, causing a lot of stuff in vanilla BG2 to bomb, like vampires turning into gaseous form and going back into their coffins, completely breaking the Bodhi encounter (as mentioned here). I always play with gore of course, but you'd think the faint-hearted and overprotective parents would've reported a lot of bugs on that... Link to comment
Avenger Posted May 27, 2009 Share Posted May 27, 2009 My cc is chunky death, which immediately destroys the creature. In that case, there is no script to run. BG1 used bandit scalps, which seems very reasonable. You need a believable in game method to account for the kills, and it is also a convenient technical solution. Assigning scripts (or items, if you go by my suggestion) to existing creatures is especially not something you would do with dltcep or ni. weidu was created exactly for this kind of patching duty. Link to comment
Miloch Posted May 27, 2009 Share Posted May 27, 2009 You can assign override scripts to creatures in the tp2 like this:COPY_EXISTING ~creature.cre~ ~override/creature.cre~ WRITE_EVALUATED_ASCII SCRIPT_OVERRIDE ~creature~ #8 Not to confuse you with code, but if you are going to use existing creatures, you probably want to make sure you're not overwriting something important. So you want to see if there's already a script there, EXTEND it if so and WRITE one if not, like in one of the methods here. If you're making your own creatures (which sounds like what you want to do) this is less of an issue, since you can specify exactly what script(s) they have or need. Link to comment
devSin Posted May 27, 2009 Share Posted May 27, 2009 That would be a rather stupid piece of buggery, causing a lot of stuff in vanilla BG2 to bomb, like vampires turning into gaseous form and going back into their coffins, completely breaking the Bodhi encounter (as mentioned here).We're on BG/TotSC here. It's quite easy to break every single quest that uses Die() by hitting hard and hanging loose. Die() is completely reliable in BG2 (in accordance with the way it works). Disabling gore there breaks nothing. My cc is chunky death, which immediately destroys the creature. In that case, there is no script to run.With gore enabled, the creature still sticks around. He just gets an animation change to CHUNKS, but can still do all the normal things a dead sprite can. Link to comment
plainab Posted May 27, 2009 Share Posted May 27, 2009 I'm going to share a bit of code from the BG Fixpack. I'm hoping that it will help you. It concerns the 5 rats in the warehouse in Candlekeep. I've noticed in several games that the rats did not always get counted. That's because they had the Die() trigger to tell if they were dead or not. The code below fixes that problem and provides a more reliable solution to counting the rats that are dead. So you could for your quest: 1) Copy some of the basic creatures with your own custom name 2) Apply a scripting variable either custom or using the file name. 3) If you just want something to happen when a certain number are dead, add a script block to the area that looks for X number dead of the given scripting variable. Here's the relevant parts of the rats code I mentioned earlier: COPY_EXISTING ~rat2.cre~ ~override~ PATCH_IF (%SOURCE_SIZE% > 724) BEGIN WRITE_ASCII 0x280 ~ab_bgf_rats~ //scripting/death variable WRITE_ASCII 0x250 ~~ (8) //script slot that had been assigned END BUT_ONLY_IF_IT_CHANGES <<<<<<<< inlined/ar2606.baf IF NumDeadGT("ab_bgf_rats",4) THEN RESPONSE #100 SetGlobal("RatsKilled","GLOBAL",5) END >>>>>>>> COMPILE ~inlined/ar2606.baf~ COPY_EXISTING ~ar2606.are~ ~override~ PATCH_IF (%SOURCE_SIZE% > 284) BEGIN WRITE_ASCII 0x94 ~ar2606~ //area script slot -- it was empty to begin with END BUT_ONLY_IF_IT_CHANGES Link to comment
Miloch Posted May 28, 2009 Share Posted May 28, 2009 ... BGT actually does it this way... I dunno about the rats, but it takes the IF Die()... IncrementGlobal("DrizztGnolls"...) out of gnolldr.bcs and puts a NumDeadGT("gnolld"...) check in the area script. So there must have been some buggery in the BG2 engine too. Of course, gnolld.cre does not have a DV in vanilla BG1 if that makes a difference. I think BGT corrected that too, but apparently that didn't solve things. Link to comment
OtisTDog Posted May 28, 2009 Author Share Posted May 28, 2009 I'm going to share a bit of code from the BG Fixpack. Thanks for the example, plainab, and for all of the suggestions from everyone else. It looks like I'll have to learn to set up a TP2 file to do this correctly. Is there any other good source besides the WeiDU readme for learning how to write TP2 files? I do a lot better with instructive examples than I do with a barebones reference. --Otis Link to comment
Mike1072 Posted May 28, 2009 Share Posted May 28, 2009 Is there any other good source besides the WeiDU readme for learning how to write TP2 files? I do a lot better with instructive examples than I do with a barebones reference. --Otis Take a look at other mods, especially those that have a bit of commenting in them. It's not hard to make an empty .tp2 file (copy and edit the BACKUP/AUTHOR/etc. block from the start of another mod), but the other stuff is better suited to a series of "how do I do X?" questions than a single "how do I do everything?" question. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.