An effect that is canceled by a healing spell would be canceled if this healing spell is made during the rest?
No, heal-on-rest only applies opcode 17, nothing else in the spell is run. There isn't much logic behind it.
It ignores the projectile, each Mass Cure will heal 1 party member.
It also ignores "target - Party/Everyone/etc...", instead affecting only 1 party member.
But it doesn't ignore "target - Self", restricting it to only be used to heal the character with the spell.
Likewise, because it ignores the projectile, it assumes "Target - Preset" can heal any party member.
It does not consider the amount - it will cast spells that reduce HP through opcode 17, on anyone not at full health.
It does at least respect the opcodes other parameters: timing/delay, probability, savingthrow, dispel/resist.
Hello. For quite some time now I've been working on my NPC mode codenamed 'Ray'. It's my first time affair but I managed to grasp the concepts of writing dialogs with WeiDO and basic scripting. But when I started creating creatures for the quests I encountered a few problems that moved me to ask for advice.
1. What is your favorite approach in creating creatures (specifically people)? Currently I see two ways: blank (or template) creature that you fully customize yourself, or copying the most similar to yours with modification of differing fields. I think the second one is quicker and safer for newbie as me but the problem is that not all kits can be found in the game (I don't recall any skalds in BG2).
2. How do ability modifiers get applied and how are they displayed in the NI. Specifically:
a) Is strength bonus applied in NI (THAC0 field) or does it work as some runtime effect in the game? Example: fighter level 7 has THAC0 14; if I want to create level 7 fighter with strength 17 (+1 to hit), do I set THACO 14 or 13 in NI?
b) Same question for dexterity, specifically: what is natural and effective AC and what do I write in NI for character with dex 18, 6 AC or 10 AC (and in what field)?
c) Same for constitution. Through new game I created kensai with 16 CON. At level 12 he has 117 hp. When I convert save game to CRE, NI shows 99 hp. Which is actually bewildering because CON bonus should be 2 * 12 = 24...
3. Effects (or are they known as opcodes in IE modding community?). It's a whole separate topic because I'm completely clueless in this area and can't even formulate exact questions. I think my condition can be improved by basic explanation of effect system. So in this paragraph I just ask: is there are some tutorial about effects?
But, actually, I do have some vague effect questions:
4. I created kensai lvl 12 and converted it to created to .CRE. When I open it I see a whole bunch of effects that (as I understand) emulate kit bonuses: x4 increase THAC0 (278), x4 increase damage(73), x4 increase speed factor(190). But there are some very confusing moments:
a) Why each THAC0 and damage effect increases corresponding stat by 1 ('value' field) but speed factor increases incrementally 1,2,3,4 ('amount' field)?
b) It's logical to assume that only last of the speed factor effect gets applied, but how is it implemented? As plausible explanation I discovered that only last of the effects has coordinates set to valid values but then why all of the THAC0 and damage effects works properly? I mean that both THAC0 and damage effect has coordinates set only in the last effect too so, consequently, I would expect to see +1 bonus in game and not + 4.
c) Some questions about "Target" field in effect structure. Specifically: when should I use "None (0)", why "Preset target (2)" is used for above effects and not "Self (1)" and what is "Self (1)" then.
d) Why MODIFYPROFICIENCY is "None (0)" and is it applied in runtime (its bonuses to THAC0, damage, etc)?
e) What is "Used internally" field?
5. Do I have to add all the memorization info (7 priest levels, 9 wizard, etc) even for non-casting creatures?
6. So in the end I need to create enemy kensai creature. Do I emulate kensai bonuses via effects or do I hardcode it into stats, if possible? Looking through game creatures I see that hardcoding is a go-for method but I still want to hear it from experienced people.
7. My Ray NPC is assassin so I based it upon Yoshimo creature file. When I studied yoshi10.cre I noticed that innate profession skills are not memorized but he still has them in the game. Why/How?
b) It's logical to assume that only last of the speed factor effect gets applied, but how is it implemented? As plausible explanation I discovered that only last of the effects has coordinates set to valid values but then why all of the THAC0 and damage effects works properly?
In a creature file, effects are listed in the order they were applied, from oldest to newest. (The last effects will always be "Set Local Variable", if there are any, because these are re-applied by the engine each time you save.)
5. Do I have to add all the memorization info (7 priest levels, 9 wizard, etc) even for non-casting creatures?
The NPC will be fine so long as no one attempts to level them up in a class that uses one of those spell tables without having it, as the game will crash.
7. My Ray NPC is assassin so I based it upon Yoshimo creature file. When I studied yoshi10.cre I noticed that innate profession skills are not memorized but he still has them in the game. Why/How?
NPC's get their kits (re)applied every time they join the party.
Internally, Innate abilities are both known and memorized. It's just that every in-game action that adds an innate to the known list also increments it's memorization by 1. Adding an innate to their known list manually will not grant use of the ability.
@subtledoctor: A regeneration effect on a custom item isn't working. I thought it was because the duration was set to 0 (I think I heard you mention this issue before), but when I switched it to 1, it still had no impact. It's an Instant/While Equipped 1HP/sec regeneration effect in IWD:EE, if it matters.
@semiticgod: Opcode #98 is one of the opcodes that pretty much side steps the duration type, as it basically turns around and applies another internal effect, failing to transfer over the original duration type in some cases.
Specifically for Opcode #98, Amount HP per second (0) and Amount HP percentage per second (1) always act as if they are a limited type. The other modes do consider permanent timings, though they are really just setting the internal duration to an absurdly high amount and using Instant / Limited for the secondary effect.
@semiticgod: Opcode #98 is one of the opcodes that pretty much side steps the duration type, as it basically turns around and applies another internal effect, failing to transfer over the original duration type in some cases.
Specifically for Opcode #98, Amount HP per second (0) and Amount HP percentage per second (1) always act as if they are a limited type. The other modes do consider permanent timings, though they are really just setting the internal duration to an absurdly high amount and using Instant / Limited for the secondary effect.
The joys of the Infinity Engine.
By another internal effect, are you referring to opcode 17 (which I know it applies to actually adjust HP), or to another internal effect?
Though it does set an arbitrarily high duration when using timing mode 1 or 9, it does not terminate when that duration is reached (the portrait icon remains), though it does stop healing.
@kjeron: Here's a description of what I was referring to, though I don't know how relevant it is:
There's another level of "effects" that are designated as the type "CPersistantEffect". These effects are not linked directly to opcode entries, though certain opcodes construct and add persistent effects to an internal list. These persistent effects are processed in a completely different manner than normal opcodes:
1) They don't have any sort of timing system; every persistent effect decides for itself when it terminates.
2) There is no way to force a persistent effect to end once it is applied.
3) They aren't saved.
4) Certain "persistent" effects have to be reconstructed every effect-list processing cycle; the persistent effect for regeneration is an example of such behavior.
The part of the code that constructs and attaches Opcode #17 to a regenerating creature originates from the persistent effect portion of the regeneration system, not directly from Opcode #98.
Now, if you ask me why the engine feels a need to have a portion of the regeneration system completely immune to being removed before it's 6 second cycle is up, I have no idea. It seems this system is used by the engine when it needs to poll something at a variable frequency...
Here's a list of all the persistent effects, if you're interested:
The various Burning/Electric/FireDeath make some sense, each of those death types provide a constant discoloring(darkening) of the creatures avatar without any saved effect. STATE_FLAME_DEATH does something similar. Which might also explain why ColorEffect is there.
FadeEffect also makes sense - Using OP66 with FadeIn or FadeOut causes transparency to gradually alter (per tick) without any saved effect.
Disease/Poison/Regeneration are all frequency effects, curious - is ApplyEffect the equivalent for opcode 272?
Now, if you ask me why the engine feels a need to have a portion of the regeneration system completely immune to being removed before it's 6 second cycle is up, I have no idea. It seems this system is used by the engine when it needs to poll something at a variable frequency...
Hmm... calculating frequency under the effects of haste/slow?
NPC's get their kits (re)applied every time they join the party.
Internally, Innate abilities are both known and memorized. It's just that every in-game action that adds an innate to the known list also increments it's memorization by 1. Adding an innate to their known list manually will not grant use of the ability.
Does it mean that I have to properly set both known spells section and memorized info section for innate abilities of non-party creatures? (e.g. kensai lvl12: known spells - "Kai"; memorized info (innate) - x3 "Kai")
[quote="sufflaminandus;c-1048282"Does it mean that I have to properly set both known spells section and memorized info section for innate abilities of non-party creatures? (e.g. kensai lvl12: known spells - "Kai"; memorized info (innate) - x3 "Kai")
[/quote]At least the memorization part, unless they are just scripted to cheat.
Edit: The install failed (after 20 minutes Copying and patching 1215 files). An error I never had before:
ERROR: [SPWI526.SPL] -> [override/SPWI526.SPL] Patching Failed (COPY) (Out of memory)
Stopping installation because of error.
Stopping installation because of error.
Here is the code I'm using (with the BUT_ONLY added and a PRETTY_PRINT that IDK if is used correctly) - it runs after the ADD_KIT routine and after both RAUS1.spl and RAUS2.spl are installed.
//Thanks for helping me out with this one Kjeron, Grammarsalad and Subtledoctor.
COPY_EXISTING ~kit.ids~ ~override~
COUNT_2DA_COLS cols
READ_2DA_ENTRIES_NOW rows cols
FOR (row = 1; row < rows; ++row) BEGIN
READ_2DA_ENTRY_FORMER rows row 1 ~kit~
PATCH_IF ~%kit%~ STRING_EQUAL_CASE ~RAHUUS~ BEGIN
SET necro_row = %row%
READ_2DA_ENTRY_FORMER rows necro_row 0 RAUS_code
END
END
BUT_ONLY
APPEND ~splprot.2da~ ~RAUS_CHECK%TAB%152%TAB%-1%TAB%1~
COPY_EXISTING ~splprot.2da~ ~override~
COUNT_2DA_COLS cols
READ_2DA_ENTRIES_NOW rows cols
FOR (row = 1; row < rows; ++row) BEGIN
READ_2DA_ENTRY_FORMER rows row 0 ~stat~
PATCH_IF ~%stat%~ STRING_EQUAL_CASE ~RAUS_CHECK~ BEGIN
SET RAUS_row = %row%
END
END
BUT_ONLY
COPY_EXISTING_REGEXP ~^.+\.spl$~ override
READ_LONG 0x1c sp_type
READ_BYTE 0x25 school
READ_LONG 0x34 sp_level
READ_LONG 0x64 ab_off
READ_SHORT 0x68 ab_num
READ_LONG 0x6a fx_off
FOR (i = 0; i < ab_num; ++i) BEGIN
READ_SHORT (ab_off + i * 0x28 + 0x1e) fx_num
READ_SHORT (ab_off + i * 0x28 + 0x20) fx_idx
READ_SHORT (ab_off + i * 0x28 + 0x0c) target
FOR (j = 0; j < fx_num; ++j) BEGIN
READ_SHORT (fx_off + (fx_idx + j) * 0x30) opcode
READ_SHORT (fx_off + (fx_idx + j) * 0x30 + 0x4) parameter1
PATCH_IF (opcode = 17 AND parameter1 > 0) BEGIN
LPF ADD_SPELL_EFFECT INT_VAR opcode = 321 target = 2 timing = 1 insert_point = 0 STR_VAR resource = EVAL ~RAUS1~ END
END
PATCH_IF (school = 7 AND sp_level > 0 AND sp_type = 1 AND (target = 1 OR 4) ) BEGIN
LPF ADD_SPELL_EFFECT INT_VAR opcode = 326 target = 1 parameter1 = %RAUS_code% parameter2 = %RAUS_row% timing = 1 insert_point = 0 STR_VAR resource = EVAL ~RAUS2~ END
END
END
END
BUT_ONLY
COPY_EXISTING_REGEXP ~^.+\.itm$~ override
READ_LONG 0x64 ab_off
READ_SHORT 0x68 ab_num
READ_LONG 0x6a fx_off
FOR (i = 0; i < ab_num; ++i) BEGIN
READ_SHORT (ab_off + i * 0x38 + 0x1e) fx_num
READ_SHORT (ab_off + i * 0x38 + 0x20) fx_idx
FOR (j = 0; j < fx_num; ++j) BEGIN
READ_SHORT (fx_off + (fx_idx + j) * 0x30) opcode
READ_SHORT (fx_off + (fx_idx + j) * 0x30 + 0x4) parameter1
PATCH_IF (opcode = 17 AND parameter1 > 0) BEGIN
LPF ADD_ITEM_EFFECT INT_VAR opcode = 321 target = 2 timing = 1 insert_point = 0 STR_VAR resource = EVAL ~RAUS1~ END
END
END
END
BUT_ONLY
COPY_EXISTING ~splprot.2da~ ~override~
PRETTY_PRINT_2DA
Comments
Thanks!
An effect that is canceled by a healing spell would be canceled if this healing spell is made during the rest?
It ignores the projectile, each Mass Cure will heal 1 party member.
It also ignores "target - Party/Everyone/etc...", instead affecting only 1 party member.
But it doesn't ignore "target - Self", restricting it to only be used to heal the character with the spell.
Likewise, because it ignores the projectile, it assumes "Target - Preset" can heal any party member.
It does not consider the amount - it will cast spells that reduce HP through opcode 17, on anyone not at full health.
It does at least respect the opcodes other parameters: timing/delay, probability, savingthrow, dispel/resist.
Back to sketch.
Thanks.
1. What is your favorite approach in creating creatures (specifically people)? Currently I see two ways: blank (or template) creature that you fully customize yourself, or copying the most similar to yours with modification of differing fields. I think the second one is quicker and safer for newbie as me but the problem is that not all kits can be found in the game (I don't recall any skalds in BG2).
2. How do ability modifiers get applied and how are they displayed in the NI. Specifically:
a) Is strength bonus applied in NI (THAC0 field) or does it work as some runtime effect in the game? Example: fighter level 7 has THAC0 14; if I want to create level 7 fighter with strength 17 (+1 to hit), do I set THACO 14 or 13 in NI?
b) Same question for dexterity, specifically: what is natural and effective AC and what do I write in NI for character with dex 18, 6 AC or 10 AC (and in what field)?
c) Same for constitution. Through new game I created kensai with 16 CON. At level 12 he has 117 hp. When I convert save game to CRE, NI shows 99 hp. Which is actually bewildering because CON bonus should be 2 * 12 = 24...
3. Effects (or are they known as opcodes in IE modding community?). It's a whole separate topic because I'm completely clueless in this area and can't even formulate exact questions. I think my condition can be improved by basic explanation of effect system. So in this paragraph I just ask: is there are some tutorial about effects?
But, actually, I do have some vague effect questions:
4. I created kensai lvl 12 and converted it to created to .CRE. When I open it I see a whole bunch of effects that (as I understand) emulate kit bonuses: x4 increase THAC0 (278), x4 increase damage(73), x4 increase speed factor(190). But there are some very confusing moments:
a) Why each THAC0 and damage effect increases corresponding stat by 1 ('value' field) but speed factor increases incrementally 1,2,3,4 ('amount' field)?
b) It's logical to assume that only last of the speed factor effect gets applied, but how is it implemented? As plausible explanation I discovered that only last of the effects has coordinates set to valid values but then why all of the THAC0 and damage effects works properly? I mean that both THAC0 and damage effect has coordinates set only in the last effect too so, consequently, I would expect to see +1 bonus in game and not + 4.
c) Some questions about "Target" field in effect structure. Specifically: when should I use "None (0)", why "Preset target (2)" is used for above effects and not "Self (1)" and what is "Self (1)" then.
d) Why MODIFYPROFICIENCY is "None (0)" and is it applied in runtime (its bonuses to THAC0, damage, etc)?
e) What is "Used internally" field?
5. Do I have to add all the memorization info (7 priest levels, 9 wizard, etc) even for non-casting creatures?
6. So in the end I need to create enemy kensai creature. Do I emulate kensai bonuses via effects or do I hardcode it into stats, if possible? Looking through game creatures I see that hardcoding is a go-for method but I still want to hear it from experienced people.
7. My Ray NPC is assassin so I based it upon Yoshimo creature file. When I studied yoshi10.cre I noticed that innate profession skills are not memorized but he still has them in the game. Why/How?
Internally, Innate abilities are both known and memorized. It's just that every in-game action that adds an innate to the known list also increments it's memorization by 1. Adding an innate to their known list manually will not grant use of the ability.
Specifically for Opcode #98, Amount HP per second (0) and Amount HP percentage per second (1) always act as if they are a limited type. The other modes do consider permanent timings, though they are really just setting the internal duration to an absurdly high amount and using Instant / Limited for the secondary effect.
The joys of the Infinity Engine.
Though it does set an arbitrarily high duration when using timing mode 1 or 9, it does not terminate when that duration is reached (the portrait icon remains), though it does stop healing.
There's another level of "effects" that are designated as the type "CPersistantEffect". These effects are not linked directly to opcode entries, though certain opcodes construct and add persistent effects to an internal list. These persistent effects are processed in a completely different manner than normal opcodes:
1) They don't have any sort of timing system; every persistent effect decides for itself when it terminates.
2) There is no way to force a persistent effect to end once it is applied.
3) They aren't saved.
4) Certain "persistent" effects have to be reconstructed every effect-list processing cycle; the persistent effect for regeneration is an example of such behavior.
The part of the code that constructs and attaches Opcode #17 to a regenerating creature originates from the persistent effect portion of the regeneration system, not directly from Opcode #98.
Now, if you ask me why the engine feels a need to have a portion of the regeneration system completely immune to being removed before it's 6 second cycle is up, I have no idea. It seems this system is used by the engine when it needs to poll something at a variable frequency...
Here's a list of all the persistent effects, if you're interested:
CPersistantEffectBurningDeath
CPersistantEffectColorEffect
CPersistantEffectDamage
CPersistantEffectDisease
CPersistantEffectElectricDeath
CPersistantEffectFadeEffect
CPersistantEffectFireDeath
CPersistantEffectMove
CPersistantEffectPoison
CPersistantEffectRegeneration
The various Burning/Electric/FireDeath make some sense, each of those death types provide a constant discoloring(darkening) of the creatures avatar without any saved effect. STATE_FLAME_DEATH does something similar. Which might also explain why ColorEffect is there.
FadeEffect also makes sense - Using OP66 with FadeIn or FadeOut causes transparency to gradually alter (per tick) without any saved effect.
Disease/Poison/Regeneration are all frequency effects, curious - is ApplyEffect the equivalent for opcode 272?
Which leaves Damage and Move.
Hmm... calculating frequency under the effects of haste/slow?
[/quote]At least the memorization part, unless they are just scripted to cheat.
Thank you for the answers.
What is D5_KIT_IS and why there is a 152 in the middle of this? Are those arbitrary values?
Thanks!
Edit: I hate when I forget the BUT_ONLY.
Here is the code I'm using (with the BUT_ONLY added and a PRETTY_PRINT that IDK if is used correctly) - it runs after the ADD_KIT routine and after both RAUS1.spl and RAUS2.spl are installed.
What I did wrong?
Thanks!
Where can I download it?
I think I found it.
Thanks!
I'm trying to understand your first solution, but my brain is failing me in this part:
I think I got this.
Nope, still failing.
Thanks
Thanks.
The spells patched with RAUS1 are not the same that RAUS2.
#17 is modify HP, the same used for healing. It is important that the code checks its p1 because I just want to touch healing spells.