IF
!GlobalTimerNotExpired("gt_detect_illusion","locals")
CheckStatGT(Myself,50,DETECTILLUSIONS)
!ModalState(DETECTTRAPS)
OR(13)
See(NearestEnemyOfType([0.0.0.0.0.ILLUSIONARY]))
StateCheck(NearestEnemyOf(Myself),STATE_MIRRORIMAGE)
StateCheck(SecondNearestEnemyOf(Myself),STATE_MIRRORIMAGE)
StateCheck(ThirdNearestEnemyOf(Myself),STATE_MIRRORIMAGE)
StateCheck(FourthNearestEnemyOf(Myself),STATE_MIRRORIMAGE)
StateCheck(NearestEnemyOf(Myself),STATE_INVISIBLE)
StateCheck(SecondNearestEnemyOf(Myself),STATE_INVISIBLE)
StateCheck(ThirdNearestEnemyOf(Myself),STATE_INVISIBLE)
StateCheck(FourthNearestEnemyOf(Myself),STATE_INVISIBLE)
StateCheck(NearestEnemyOf(Myself),STATE_IMPROVEDINVISIBILITY)
StateCheck(SecondNearestEnemyOf(Myself),STATE_IMPROVEDINVISIBILITY)
StateCheck(ThirdNearestEnemyOf(Myself),STATE_IMPROVEDINVISIBILITY)
StateCheck(FourthNearestEnemyOf(Myself),STATE_IMPROVEDINVISIBILITY)
THEN
RESPONSE #100
SetGlobalTimer("gt_detect_illusion","locals",ONE_ROUND)
DisplayStringHead(Myself,~*Attempts to detect illusions*~)
FindTraps()
I'm sure that CheckStatGT(Myself,50,DETECTILLUSIONS) and StateCheck(NearestEnemyOf(Myself),STATE_INVISIBLE) are true (I'm testing this script in the Watcher's Keep where there are the Anti-Paladins: some of them drink POTN10), still nothing happens (i.e., the CRE in question doesn't use FIND TRAPS.....)
It could be that object specifiers, such as NearestEnemyOf(), don't work with invisible creatures.
Does this code work better? Detect([ENEMY])
OR(4)
Gender(LastSeenBy(Myself),ILLUSIONARY)
StateCheck(LastSeenBy(Myself),STATE_INVISIBLE)
StateCheck(LastSeenBy(Myself),STATE_IMPROVEDINVISIBILITY)
StateCheck(LastSeenBy(Myself),STATE_MIRRORIMAGE)
What is the correct way of setting KIT (offset 0x244) for a certain CRE? I'm trying following the Big-endian notation, but I keep failing..... Let's consider KIT_ASSASSIN (0x400A0000) as an example: the following piece of code is wrong. Why?
Here is what I use for my mods (Charlatan as a model):
COPY_EXISTING ~kitlist.2da~ ~override~ COUNT_2DA_ROWS ~9~ "rows" FOR ( index = 31 ; index < rows ; index = index + 1 ) BEGIN READ_2DA_ENTRY "%index%" 5 9 "clab" PATCH_IF ("%clab%" STRING_COMPARE_CASE "RAChar" = 0) BEGIN READ_2DA_ENTRY "%index%" 0 9 "RAChar" SET "rows" = 0 END END BUT_ONLY_IF_IT_CHANGES
OUTER_SET kit = "%RAChar%" ACTION_FOR_EACH creature IN eldotd eldoth eldoth5 BEGIN
ACTION_IF FILE_EXISTS_IN_GAME ~%creature%.cre~ THEN BEGIN
ADD_MEMORIZED_SPELL doesn't seem to work with innate SPLs... The following piece of code does nothing:
ADD_MEMORIZED_SPELL ~SPCL423~ #0 ~innate~ (4)
What's the difference between LastSeenBy and LastSeenBy(Myself)? Does the former stand for "Last seen by anyone with my Allegiance (and not just myself)"?
Yeah but is the 2nd part even necessary? Shouldn't just making the innate known, make it usable?
I'm thinking ADD_KNOWN is analogous to opcode 171: with an innate spell it will make it usable immediately. With a wizard spell, it will add it to your spellbook but you will still have to memorize it before you can cast it.
Internally they still have to be memorized. Innates don't function too differently from priest/wizard spells in this regard. All Innates effectively just share the same "spell level", you just cannot manually alter which spells are memorized in which slot. Opcode 171 adds to the known list, to the memorized count, and the maximum memorized count, for innates. For wizard/priest spells, it just adds to the known list.
Knowning an Innate isn't necessary to use it - it serves no purpose beyond the "HaveKnownSpell()" trigger.
@Luke93 if you don't want to spend time fiddling with that, another way to achieve the same thing is to use ADD_CRE_EFFECT with opcode 171 to grant the innate ability. I use that a lot and it works fine.
Yeah, you're right. If I use ADD_CRE_EFFECT with opcode #171, then ADD_MEMORIZED_SPELL works fine (I just need to put "#x - 1" because opcode #171 already gives you 1 charge....)
Having said that, I think that ADD_MEMORIZED_SPELL should work even with innate SPLs (i.e., there is probably a bug in the current version of WeiDU.....)
Does anyone know if there's a different trick to naming the dream script files for TOB than SOA? The Tob dream script for Mazzy doesn't already exist, so I need to make one and I can't get it to trigger.
The basic script file is Mazz25.bcs but I've tried Mazz25d.bcs and several other variations and none of them are working. The files install because I can see them in near infinity, but the script never actually goes off. My non dream scripts and the additional SOA scripts were all working fine.
Suggestions?
Also, on a related note, if the only thing I'm doing is changing a variable and but using and "myself" triggers, does it matter whose bcs file I put my code in? Could I just stick my dream scripts in the existing file of a different npc?
Does anyone know if there's a different trick to naming the dream script files for TOB than SOA? The Tob dream script for Mazzy doesn't already exist, so I need to make one and I can't get it to trigger.
The basic script file is Mazz25.bcs but I've tried Mazz25d.bcs and several other variations and none of them are working. The files install because I can see them in near infinity, but the script never actually goes off. My non dream scripts and the additional SOA scripts were all working fine.
Suggestions?
NPC scripts are defined in PDIALOG.2DA. It looks like Mazzy uses MAZZYD.BCS for both SoA and ToB. The file doesn't exist in unmodded BG2EE though.
You can probably define your own MAZZY25D.BCS and register it in PDIALOG.2DA. In this case you should make a copy of MAZZYD.BCS (if it exists) before adding your own content.
allows a certain CRE to make use of different ammos. The only problem is that the corresponding weapon slot is not selected (i.e., there is no green square around the launcher) ---> See the attached screenshot. Is this intended or a bug?
@argent77 Thanks for the quick reply. I can definitely try Mazzy25d.bcs again and see if that works. I thought I'd tried that one but maybe I'm missing a step.
So, this may sound like a stupid question but how exactly do I register a script in the pdialog.2da? For all the other scripts, I just used extend_bottom in the tp2 and that worked even for the ones that didn't already exist in SOA. That's where mazzyd.bcs in my mod came from since it doesn't exist naturally.
I should probably mention, I'm having the same issue with Korgand in TOB as well. But hopefully the same fix will work once I figure out his d script name.
By default MAZZYD.BCS is registered as the dream script for Mazzy in SoA and ToB. So the simplest way is to add your script to that file (or create it if it doesn't exist yet).
If you want to use another file, then you have to update the reference in PDIALOG.2DA. Look for the row starting with MAZZY. The seventh column (labeled as 25DREAM_SCRIPT_FILE) contains the name of the ToB dream script name for that character. Replace it with the new filename (without file extension).
Korgan and many other NPCs are similar. They also don't have separate dream scripts for SoA and ToB, or none at all.
By default MAZZYD.BCS is registered as the dream script for Mazzy in SoA and ToB. So the simplest way is to add your script to that file (or create it if it doesn't exist yet).
If you want to use another file, then you have to update the reference in PDIALOG.2DA. Look for the row starting with MAZZY. The seventh column (labeled as 25DREAM_SCRIPT_FILE) contains the name of the ToB dream script name for that character. Replace it with the new filename (without file extension).
Korgan and many other NPCs are similar. They also don't have separate dream scripts for SoA and ToB, or none at all.
So, it sounds like you're saying I could just put my tob d script code for those 2 in the same d.bcs files as my soa code, yeah? I'd just have to give them different triggers so I don't get any weird duplicates.
Thank you. I'm going to try that. I'd rather not mess with the 2da if I can help it in case some other mod usees those same scripts.
EDIT- That worked. Thank you. I knew it had to be something simple but I never would have checked the 2da file.
Comments
I'm sure that CheckStatGT(Myself,50,DETECTILLUSIONS) and StateCheck(NearestEnemyOf(Myself),STATE_INVISIBLE) are true (I'm testing this script in the Watcher's Keep where there are the Anti-Paladins: some of them drink POTN10), still nothing happens (i.e., the CRE in question doesn't use FIND TRAPS.....)
Does this code work better?
Detect([ENEMY]) OR(4) Gender(LastSeenBy(Myself),ILLUSIONARY) StateCheck(LastSeenBy(Myself),STATE_INVISIBLE) StateCheck(LastSeenBy(Myself),STATE_IMPROVEDINVISIBILITY) StateCheck(LastSeenBy(Myself),STATE_MIRRORIMAGE)
It's better now, thanks for your help!
Example code for Assassin:
SET kit_id = IDS_OF_SYMBOL(~kit~ ~ASSASIN~) WRITE_SHORT 0x244 (kit_id >> 16) & 0xffff WRITE_SHORT 0x246 kit_id & 0xffff
Thanks for clarifying, it works now....
ADD_MEMORIZED_SPELL ~SPCL423~ #0 ~innate~ (4)
Opcode 171 adds to the known list, to the memorized count, and the maximum memorized count, for innates. For wizard/priest spells, it just adds to the known list.
Knowning an Innate isn't necessary to use it - it serves no purpose beyond the "HaveKnownSpell()" trigger.
Having said that, I think that ADD_MEMORIZED_SPELL should work even with innate SPLs (i.e., there is probably a bug in the current version of WeiDU.....)
The basic script file is Mazz25.bcs but I've tried Mazz25d.bcs and several other variations and none of them are working. The files install because I can see them in near infinity, but the script never actually goes off. My non dream scripts and the additional SOA scripts were all working fine.
Suggestions?
Also, on a related note, if the only thing I'm doing is changing a variable and but using and "myself" triggers, does it matter whose bcs file I put my code in? Could I just stick my dream scripts in the existing file of a different npc?
You can probably define your own MAZZY25D.BCS and register it in PDIALOG.2DA. In this case you should make a copy of MAZZYD.BCS (if it exists) before adding your own content.
allows a certain CRE to make use of different ammos. The only problem is that the corresponding weapon slot is not selected (i.e., there is no green square around the launcher) ---> See the attached screenshot. Is this intended or a bug?
So, this may sound like a stupid question but how exactly do I register a script in the pdialog.2da? For all the other scripts, I just used extend_bottom in the tp2 and that worked even for the ones that didn't already exist in SOA. That's where mazzyd.bcs in my mod came from since it doesn't exist naturally.
I should probably mention, I'm having the same issue with Korgand in TOB as well. But hopefully the same fix will work once I figure out his d script name.
If you want to use another file, then you have to update the reference in PDIALOG.2DA. Look for the row starting with MAZZY. The seventh column (labeled as 25DREAM_SCRIPT_FILE) contains the name of the ToB dream script name for that character. Replace it with the new filename (without file extension).
Korgan and many other NPCs are similar. They also don't have separate dream scripts for SoA and ToB, or none at all.
Thank you. I'm going to try that. I'd rather not mess with the 2da if I can help it in case some other mod usees those same scripts.
EDIT- That worked. Thank you. I knew it had to be something simple but I never would have checked the 2da file.
It seems the Wait(80) command is ignored.... Why?
COMPILE ~path to my file/Xxxx.d~
the resulting file is: Xxxx.D.dlg (Note the double extension) ----> Where that extra D comes from?
BEGIN ~filename~
Compiling dialogs.d will result in creating as many dialogs you defined in it: dialog1.dlg, dialog2.dlg...