I have the following code that allows the infinite use of spells and that I'm using a lot for a kit:
PATCH_IF (~%SOURCE_SIZE%~ > ~0x71~) BEGIN
READ_SHORT 0x1c spell_type
PATCH_IF (%spell_type% = 4) BEGIN
READ_LONG 0x64 ab_off // Abilities Offset
READ_SHORT 0x68 ab_num // Number of Abilities
READ_SHORT 0x6a fx_off // Effects Offset
READ_SHORT 0x70 glob_fx // Number of Global Effects
SET glob_add = 0
INSERT_BYTES (fx_off) 0x30
WRITE_SHORT (fx_off) 171 // opcode
WRITE_BYTE (fx_off + 0x2) 1 // Target (self)
WRITE_LONG (fx_off + 0xc) 9 // timing (Perm)
WRITE_BYTE (fx_off + 0x12) 100 // Probability 1
WRITE_ASCII (fx_off + 0x14) ~RADW71~ // resource
++glob_add
INSERT_BYTES (fx_off) 0x30
WRITE_SHORT (fx_off) 172 // opcode
WRITE_BYTE (fx_off + 0x2) 1 // Target (self)
WRITE_LONG (fx_off + 0xc) 9 // timing (Perm)
WRITE_BYTE (fx_off + 0x12) 100 // Probability 1
WRITE_ASCII (fx_off + 0x14) ~RADW71~ // resource
++glob_add
glob_fx += glob_add
WRITE_SHORT 0x70 glob_fx // Increment Number of Global Effects
FOR (i = 0; i < ab_num; ++i) BEGIN // Offset Effect Index for all Abilities
READ_SHORT (ab_off + i * 0x28 + 0x20) fx_idx
WRITE_SHORT (ab_off + i * 0x28 + 0x20) (fx_idx + glob_add)
END
END
END
I want to turn this code into a macro (LPM ~INFINITE_SPELLS~). The problem is, I have to define one variable (the spell that will have infinite uses - for the code above it is RADW71), so I know I can't just pack the thing inside a "DEFINE_PATCH_MACRO".
Every time I use insert_point at the INT_VAR side I end up with several unwanted copies of the effect (three to five), but when I use it at the STR_VAR side of the function everything behaves fine: only one copy is added and the order is respected.
Thanks for this beauty!
I'll save it in my archive of macros and try to use it in my current project.
What is the difference between the Charm from #5 and #241?
Thanks!
Absolutely nothing functionality wise - they actually redirect to the same code in the exe. The only difference is that the "immunity to opcode" and "remove opcode" effects can target each one separately.
Beyond that, Undead are given immunity to opcode 5, but not 241. Spells like Control Undead therefor use opcode 241, while charm/domination use opcode 5.
Only second block displays messages. No problems with See trigger. Probably worth reporting it on Beamdog redmine.
I see you made a bug report. I've looked into it, and the problem is that while processing m_pendingTriggers, the engine doesn't make a copy of the trigger's CAIObjectType. When it runs Decode() it wipes out m_SpecialCase, preventing the structure from being properly decoded again. I think every trigger with an IDS value below 0x400A is affected.
Not sure if I understand "below" in this context correctly, but if Heard (0x002F) is also affected then that's another 80+ broken script blocks among vanilla BG:EE and BG2:EE, since Heard is often used with NearestMyGroupOfType @Bubb, if you have redmine account consider adding your insights to the report.
All of those that use an object are subject to the bug. I've been able to fix it myself using an EEex hex edit; I'll make a note on your bug report what the problem is / how the devs could fix it.
Ok, here are two things I want to learn how to do:
A-
A1) Based on a text (or part of a text), identify the number of a string.
A2) Replace this string's text for one of my own.
---
B-
I want to make a spell where a specific group of creatures (by Race of using General) completely ignores a character under this spell's effect unless this character takes hostile action against the aforementioned creature (that's why I can't just use #100).
At the moment I'm using the STRING_SET option, but if for some reason the string change the thing will misbehave. So my idea was to let Weidu discover the string at the install to prevent this. Maybe I'm being overzealous.
At the moment I'm using the STRING_SET option, but if for some reason the string change the thing will misbehave. So my idea was to let Weidu discover the string at the install to prevent this. Maybe I'm being overzealous.
Well it depends what string you're talking about. Some strings are findable in various ways... e.g. by parsing .2da files. Class strings are in clastext.2da/sodcltxt.2da; kit strings are in kitlist.2da; proficiency strings are in weapprof.2da; etc.
In this case, I'm talking about a kit string. To be even more specific, about the kit description string.
Comments
Thanks, that did the trick!
I have the following code that allows the infinite use of spells and that I'm using a lot for a kit:
I want to turn this code into a macro (LPM ~INFINITE_SPELLS~). The problem is, I have to define one variable (the spell that will have infinite uses - for the code above it is RADW71), so I know I can't just pack the thing inside a "DEFINE_PATCH_MACRO".
How can I solve this situation?
Thanks!
Weird.
Every time I use insert_point at the INT_VAR side I end up with several unwanted copies of the effect (three to five), but when I use it at the STR_VAR side of the function everything behaves fine: only one copy is added and the order is respected.
Thanks for this beauty!
I'll save it in my archive of macros and try to use it in my current project.
Example:
Thanks!
Absolutely nothing functionality wise - they actually redirect to the same code in the exe. The only difference is that the "immunity to opcode" and "remove opcode" effects can target each one separately.
Is there a ninja-coding-high-tech style to do so or I need to open the table, save it manually and all that jazz?
I confess that since I've learned to use CREATE I dislike creating things outside of Weidu.
Just that? The highlight plugin for the Notepad++ is not recognizing this last command and I couldn't find it at the Weidu Readme
I knew there was an easy way to do it.
Thanks!
Edit: Got it working with another thing
Now I've discovered that when the Weidu Readme says that something is applied to REGEXP it can also be applied to single files.
Let's say I have an array with X rows and Y columns.
I want to learn how to look for a value at column Ya and:
1) If it finds an exact match, delete the entire row.
2) If it finds an exact match, change one entry in the row it belongs.
Thanks!
I'll see if a find some of those examples.
Thanks!
Thanks, all try it later!
I see you made a bug report. I've looked into it, and the problem is that while processing m_pendingTriggers, the engine doesn't make a copy of the trigger's CAIObjectType. When it runs Decode() it wipes out m_SpecialCase, preventing the structure from being properly decoded again. I think every trigger with an IDS value below 0x400A is affected.
0x0002 AttackedBy(O:Object*,I:Style*AStyles)
0x0003 Help(O:Object*)
0x0004 Joins(O:Object*)
0x0005 Leaves(O:Object*)
0x0006 ReceivedOrder(O:Object*,I:Order ID*)
0x0007 Said(O:Object*,I:Dialog ID*)
0x0008 TurnedBy(O:Object*)
0x0009 Unusable(S:ResRef*)
0x0020 HitBy(O:Object*,I:DameType*Damages)
0x0021 HotKey(I:Key*HotKey)
0x0022 TimerExpired(I:ID*)
0x0024 Trigger(I:TriggerNum*)
0x0025 Die()
0x0026 TargetUnreachable(O:Object*)
0x002F Heard(O:Object*,I:ID*SHOUTIDS)
0x0033 BecameVisible()
0x0036 OnCreation()
0x004A Died(O:Object*)
0x004B Killed(O:Object*)
0x004C Entered(O:Object*)
0x0052 Opened(O:Object*)
0x0053 Closed(O:Object*)
0x0054 Detected(O:Object*)
0x0055 Reset(O:Object*)
0x0056 Disarmed(O:Object*)
0x0057 Unlocked(O:Object*)
0x005C BreakingPoint()
0x005D PickPocketFailed(O:Object*)
0x005E StealFailed(O:Object*)
0x005F DisarmFailed(O:Object*)
0x0060 PickLockFailed(O:Object*)
0x0070 Clicked(O:Object*)
0x0087 TrapTriggered(O:Triggerer*)
0x0088 PartyMemberDied(O:Object*)
0x0091 SpellCast(O:Object*,I:Spell*Spell)
0x0091 SpellCastRES(S:Spell*,O:Object*)
0x0093 PartyRested()
0x0097 Summoned(O:Object*)
0x00A1 SpellCastOnMe(O:Caster*,I:Spell*Spell)
0x00A1 SpellCastOnMeRES(S:Spell*,O:Caster*)
0x00A6 SpellCastPriest(O:Object*,I:Spell*Spell)
0x00A6 SpellCastPriestRES(S:Spell*,O:Object*)
0x00A7 SpellCastInnate(O:Object*,I:Spell*Spell)
0x00A7 SpellCastInnateRES(S:Spell*,O:Object*)
0x00CC TookDamage()
0x00D6 WalkedToTrigger(O:Object*)
0x00EB CutSceneBroken()
0x0101 reserved()
All of those that use an object are subject to the bug. I've been able to fix it myself using an EEex hex edit; I'll make a note on your bug report what the problem is / how the devs could fix it.
A-
A1) Based on a text (or part of a text), identify the number of a string.
A2) Replace this string's text for one of my own.
---
B-
I want to make a spell where a specific group of creatures (by Race of using General) completely ignores a character under this spell's effect unless this character takes hostile action against the aforementioned creature (that's why I can't just use #100).
---
Thanks!
At the moment I'm using the STRING_SET option, but if for some reason the string change the thing will misbehave. So my idea was to let Weidu discover the string at the install to prevent this. Maybe I'm being overzealous.
B- Damn.
Thanks!
I guess you can also use #337 (Remove opcode).......
In this case, I'm talking about a kit string. To be even more specific, about the kit description string.