All of those spells use custom summoning tables, which must have an entry in smtables.2da. Your summoning spell then has to reference the entry number from smtables. The macro I used to do that is also published.
Quick question, does anyone know if I can use (if file exists) with interject copy trans? I have a few interjections into other mods that I need to only install when they're around.
Oh, and one more thing too. Is there code for making a interjection play only if another one hasn't?
Hello folks. Hopefully someone can answer this since I'm out of ideas. I'm trying to code the summoning for my added npc in TOB and they keep showing up dead.
Any ideas on how to fix that? I feel like I must be missing something obvious. Or the "dead" check just isn't working properly.
Thanks in advance.
Edit- so I figured out my death problem, and I can get my npc summoned in tob, but the game will not stop crashing as soon as she tries to talk. This one I really can't seem to figure out. There's something wrong with the dialogue file or the cre file, but I don't know what.
Not sure if anyone is checking this these days, but does someone know the naming rules for making new tob d scripts for Canon NPCs that don't have them already? I have 2 that are refusing to trigger and I don't know why.
I know how to assign new strings to items and spells, but how do you create a custom string that you can use in the Display String opcode?
I want a spell to display a custom string in the dialog box or over a character's head.
There are several options.
1. If your spell contains only a single Display String opcode you can use ALTER_SPELL_EFFECT to modify an existing opcode that you have already added to the spell via NI or DLTCEP: COPY ~%MOD_FOLDER%/spells/myspell.spl~ ~override~
LPF ALTER_SPELL_EFFECT
INT_VAR
match_opcode = 139 // Display String
parameter1 = RESOLVE_STR_REF(@123) // resolves tra reference into strref
END
2. You can also create new opcodes completely in WeiDU: COPY ~%MOD_FOLDER%/spells/myspell.spl~ ~override~
LPF ADD_SPELL_EFFECT
INT_VAR
opcode = 139 // Display String
target = 2 // Preset target
parameter1 = RESOLVE_STR_REF(@123) // resolves tra reference into strref
timing = 1 // Instant/Permanent until death
resist_dispel = 1
END
You can use opcode 330 (Float text) if you want to display text over the target's head instead.
I'm trying to implement this for a different mod, but I'm having trouble. WeiDU says there is no string reference provided for @115, but I do have such a reference. Here's my error message: Here's my patch code:
COPY ~SeducerKit/spl/USSD15X.spl~ ~override~
LPF ALTER_SPELL_EFFECT
INT_VAR
match_opcode = 330 // Display String
parameter1 = RESOLVE_STR_REF(@115) // resolves tra reference into strref
END
And here's my TRA line: @115 = ~(subject is too high-level for Seduction)~ Why isn't the TRA reference being recognized? Could it be that my TP2 file doesn't link to it properly? I assumed this line at the start of the TP2 would make that a non-issue? AUTO_TRA ~SeducerKit/tra/%s~
@Gwendolyne: My TRA file location is C:\Games\BG2\SeducerKit\tra\English\SeducerKit.tra
@argent77: Sorry; the @1 reference in my error message screenshot is a relic. I've tried patching the opcode 330 both with @115 and @116, and then with @1 and @2. My code is from the first attempt; my screenshot is from the second. I get error messages no matter which TRA reference I use, even @0.
This is my entire TRA file, which I previously haven't been using in this mod due to writing strings via the TP2 file.
@0 = ~Seducer~
@1 = ~test~
@2 = ~test2~
@5 = ~Betrayal~
@105 = ~Breaks free of the Seducer's spell~
@115 = ~(subject is too high-level for Seduction)~
@116 = ~(subject is too high-level for Recruit Follower)~
@Gwendolyne: How do I use the LOAD_TRA function? I've never had to use it before. I've only ever had the AUTO_TRA line: AUTO_TRA ~SeducerKit/tra/%s~ The correct pathway for my TRA would be:
@Ardanis: I think that's the LOAD_TRA line I attempted before. I copied and pasted your code and I get the same result, a parsing error. Here's the start of my TP2 (I get an error message whether or not I comment out the old AUTO_TRA line):
BACKUP "SeducerKit/backup"
AUTHOR semiticgod
VERSION "v1.20"
//AUTO_TRA ~SeducerKit/tra/%s~
LOAD_TRA ~SeducerKit/tra/English/SeducerKit.tra~
BEGIN "Seducer Kit for Thieves" //
INCLUDE "SeducerKit/lib/fl#add_kit_ee.tpa"
LOAD_TRA is a component action, so it should be either put into ALWAYS section, or individually into each component:
BACKUP "SeducerKit/backup"
AUTHOR semiticgod
VERSION "v1.20"
//AUTO_TRA ~SeducerKit/tra/%s~
BEGIN "Seducer Kit for Thieves" //
LOAD_TRA ~SeducerKit/tra/English/SeducerKit.tra~
INCLUDE "SeducerKit/lib/fl#add_kit_ee.tpa"
That said... I don't see any LANGUAGE definition in your code quote. If you don't have any, AUTO_TRA won't pick up the files correctly. Try this:
BACKUP "SeducerKit/backup"
AUTHOR semiticgod
VERSION "v1.20"
AUTO_TRA ~SeducerKit/tra/%s~
LANGUAGE ~English~ ~English~ ~SeducerKit/tra/English/SeducerKit.tra~ // the first strref is the prompt WeiDU will display during installation, the second is the variable used in AUTO_TRA
BEGIN "Seducer Kit for Thieves" //
INCLUDE "SeducerKit/lib/fl#add_kit_ee.tpa"
Note that AUTO_TRA is mostly for when you have a lot of .D/.TRA pairs, each with individual strref count. It will automatically match the .TRA in designated folder (which can be depend on language, hence the variable substitution for the folder name defined by LANGUAGE) to the processed .D dialog file.
The best practice with tra files is to load them in ALWAYS block or LANGUAGE sections. Sometimes, you may call them inside components codes with LOAD_TRA or WITH_TRA/PATCH_WITH_TRA commands, but it may become very messy.
I'm trying to patch an item differently depending on whether the mod's being installed on BG:EE or BGII:EE. Thing is, I need this to happen in the middle of a patching routine in which most items are patched the same regardless of the game being modded.
So here's the basic code (macros courtesy of @erephine with her permission):
ACTION_IF (FILE_EXISTS_IN_GAME ~bow09.itm~) THEN BEGIN COPY_EXISTING ~bow09.itm~ ~override~ PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN LAUNCH_PATCH_MACRO ~clear~ SET gradient = 25 // colour index SET location = wgrey // location LAUNCH_PATCH_MACRO ~colour~ SET gradient = 69 // colour index SET location = wred // location LAUNCH_PATCH_MACRO ~colour~ END BUT_ONLY END
Now, this is for BG:EE. For BGII:EE, I want to use different offsets.
I tried to insert an "ACTION_IF GAME_IS" after the check for whether the file exists, but the installer threw an error message. If I put the GAME_IS check before, however, when I close it with an END the patching routine stops and doesn't do the items that come afterward. What am I missing?
Be warned that GAME_IS checks are slow, so I now try to avoid them in patching (especially regexps). It won't be noticeable for a handful of checks, but if you find yourself having to do this repeatedly you might consider doing one check up front and then using a variable everywhere else. My first pass to make Tweaks Anthology multiplatform was slow as molasses because I was abusing GAME_IS in massive regexp patches.
Now, for example, I use this in a lot of mods:
ACTION_IF GAME_IS ~bgee bg2ee eet iwdee~ BEGIN OUTER_SET ee_game = 1 END ELSE BEGIN OUTER_SET ee_game = 0 END
This allows you to do variable checks--which are fast--in patches instead.
Does anyone know if there's a version of interject that works like interject_copy_trans3 where every line has a transition, not just the first, so it will run even if the first line isn't true?
I have to use interject because I need player replies but I have a conditional line for every single party member and I hate writing random extra dialogue for the person they're talking after just so my interject will run.
@CamDawg: I'm almost done with my simple Korax NPC mod, but I don't know how to make sure Korax's dialog stays when he joins the party. Currently, he just switches to a default .dlg file after he becomes a party member. How do I make sure he can still speak with the party normally after he joins?
Say hello to pdialog.2da and interdia.2da. Joinables have four dialogue files (the naming here is conventional but could be anything): foo.dlg, for all dialogues prior to joining; Bfoo.dlg handles all banters when in party (e.g. all Interact() calls and the engine's automatic banters), fooJ.dlg is the main dialogue file when joined and handles all Dialogue() calls; and fooP.dlg is the dialogue file assigned when the joinable is kicked out.
Interdia sets the creatures banter file and pdialog sets the joined and post dialogue files, as well as the dream script (it gets checked when resting for additional banters or dialogues).
@CamDawg: How would I patch new lines onto pdialog.2da and interdia.2da? Would the fooJ.dlg file just be Korax's normal dialog file? I assume I'd just copy and tweak other NPC dialogs to give Korax dialogs to fill in the other entries in those .2da files.
For adding lines to a 2da, it's APPEND. The first column in both files is the script name. I'm guessing from Korax that it's a BGEE mod; however I'm going to show the slightly more complicated but universal way to do this. Games with ToB have an extra set of columns since ToB uses a different set of dialogue files and dream scripts. So:
APPEND ~pdialog.2da~ ~foo fooP fooJ fooD~ UNLESS ~25POST~ // for games w/o ToB
APPEND ~pdialog.2da~ ~foo fooP fooJ fooD foo25P foo25J foo25D foo25~ IF ~25POST~ // for games w ToB
APPEND ~interdia.2da~ ~foo Bfoo~ UNLESS ~25FILE~ // for games w/o ToB
APPEND ~interdia.2da~ ~foo Bfoo Bfoo25~ IF ~25FILE~ // for games w ToB
The UNLESS/IF clauses on the end of those tell WeiDU when to append these. The text 25POST/25FILE is present in the ToB version of these files, and as you can see 25 is generally used to distinguish ToB files from SoA files.
While it's probably a bit of a pain to do it now, I'd suggest separating the dialogue file into the four traditionally used for joinables:
foo - This should contain all dialogue prior to joining the party and is assigned in the creature file. This gets discarded once the NPC joins.
Bfoo - Used by the engine for random banters and, traditionally, scripted love talks for the romanceable NPCs. Call dialogues in this file via Interact(). Is only assigned and active while the NPC is in the party.
fooJ - The NPC's main dialogue file while in the party, replacing foo upon joining. Call dialogues here through one of the Dialogue() actions. Interjections traditionally go here as well.
fooP - The NPC's main dialogue file once they've been kicked out of the party. Rejoin dialogues go here. If the NPC rejoins, the main dialogue switches back to fooJ.
Now, there's certainly no reason why you couldn't use one file for foo/fooJ/fooP and simply ignore fooB. Organizationally, though, it's a lot easier to weight your states and stagger dialogue triggers by using all three.
Now, there's certainly no reason why you couldn't use one file for foo/fooJ/fooP and simply ignore fooB. Organizationally, though, it's a lot easier to weight your states and stagger dialogue triggers by using all three.
Mostly it depends on whether character will have extensive plot involvement regardless of whether they're in party or not. This is prime reason SoD doesn't have dedicated "fooP" dialogs for its party members, as I couldn't bear dealing with nearly the same dialog duplicated, or even triplicated in worst cases, in multiple files - meaning twice or thrice more maintenance, testing and risks of malfunction.
Otherwise keeping the (re-)joining routine outside of first introduction, which perhaps may involve its own quest before NPC can join, is usually a good idea.
Comments
----
I made a copy of some spells from IWD in BGEE (Summon Shadow, Shades, Shadow Monsters, Demi-Shadow Monsters).
The problem is: I'm getting some random creatures (Worg, Kobold, Ogrillon, Rabid Dog) instead of what I was supposed to get.
What's the catch with these spells? I've imported summoning spells before without this problem.
Thanks!
It will save your life... and your time.
And to not make my mod dependent on other mods.
(And ok, I'm sometimes too dumb to understand CamDawg's coding)
Edit: @CamDawg altered the spell's code, apparently (there's no SPWI525, as an example). Or I am missing something?
Edit2: Found the spells, but they are exactly as my version. I'm really missing something here.
Thanks!
Oh, and one more thing too. Is there code for making a interjection play only if another one hasn't?
Thanks :-)
Any ideas on how to fix that? I feel like I must be missing something obvious. Or the "dead" check just isn't working properly.
Thanks in advance.
Edit- so I figured out my death problem, and I can get my npc summoned in tob, but the game will not stop crashing as soon as she tries to talk. This one I really can't seem to figure out. There's something wrong with the dialogue file or the cre file, but I don't know what.
Here's my patch code: And here's my TRA line:
@115 = ~(subject is too high-level for Seduction)~
Why isn't the TRA reference being recognized? Could it be that my TP2 file doesn't link to it properly? I assumed this line at the start of the TP2 would make that a non-issue?
AUTO_TRA ~SeducerKit/tra/%s~
@argent77: Sorry; the @1 reference in my error message screenshot is a relic. I've tried patching the opcode 330 both with @115 and @116, and then with @1 and @2. My code is from the first attempt; my screenshot is from the second. I get error messages no matter which TRA reference I use, even @0.
This is my entire TRA file, which I previously haven't been using in this mod due to writing strings via the TP2 file.
It looks like SeducerKit.tra is not loaded.
AUTO_TRA ~SeducerKit/tra/%s~
The correct pathway for my TRA would be:
SeducerKit/tra/English/SeducerKit.tra
How would I load that TRA file?
AUTO_TRA uses variable defined by LANGUAGE command, maybe it's not ~english~ in your tp2 for whatever reason?
If you have no dialog, or all your strrefs have a single count across all files, you can just skip it and go with LANGUAGE alone http://www.weidu.org/~thebigg/README-WeiDU.html#Language
The best practice with tra files is to load them in ALWAYS block or LANGUAGE sections. Sometimes, you may call them inside components codes with LOAD_TRA or WITH_TRA/PATCH_WITH_TRA commands, but it may become very messy.
COPY_EXISTING ~bow09.itm~ ~override~
PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN
LAUNCH_PATCH_MACRO ~clear~
SET gradient = 25 // colour index
SET location = wgrey // location
LAUNCH_PATCH_MACRO ~colour~
SET gradient = 69 // colour index
SET location = wred // location
LAUNCH_PATCH_MACRO ~colour~
END
BUT_ONLY
END
OUTER_SET ee_game = 1
END ELSE BEGIN
OUTER_SET ee_game = 0
END
I have to use interject because I need player replies but I have a conditional line for every single party member and I hate writing random extra dialogue for the person they're talking after just so my interject will run.
Interdia sets the creatures banter file and pdialog sets the joined and post dialogue files, as well as the dream script (it gets checked when resting for additional banters or dialogues).
The UNLESS/IF clauses on the end of those tell WeiDU when to append these. The text 25POST/25FILE is present in the ToB version of these files, and as you can see 25 is generally used to distinguish ToB files from SoA files.
While it's probably a bit of a pain to do it now, I'd suggest separating the dialogue file into the four traditionally used for joinables:
Now, there's certainly no reason why you couldn't use one file for foo/fooJ/fooP and simply ignore fooB. Organizationally, though, it's a lot easier to weight your states and stagger dialogue triggers by using all three.
Otherwise keeping the (re-)joining routine outside of first introduction, which perhaps may involve its own quest before NPC can join, is usually a good idea.