Jump to content

Items that simulate spells


Miloch

Recommended Posts

There are some items in BG apparently intended to simulate certain spells. For example, MAGEAMUL for Minor Globe of Invulnerability and MAGEBRAC for Protection from Normal Missiles. The effects on both of these have durations. So if CREs already come pre-equipped with these items, how does this work (or does it)? Does the duration start counting down from when you first see the CREs, enter the area, or what?

Link to comment

Something like that. It wouldn't be attached to the CRE, so it wouldn't persist across save/reload (the duration starts at max each time the creature needs to be loaded when it's no longer in memory). The assumption for these types of things was most likely that you encounter the creature and then kill it, both in a single session.

 

Most of those items aren't really used in the default game anyway.

Link to comment
Most of those items aren't really used in the default game anyway.
Yeah, they don't seem to be used in BG2. But they are used on several CREs in BG1. By that, I mean non-joinable enemies of course, since these are otherwise unobtainable and useful only on adversaries.
The assumption for these types of things was most likely that you encounter the creature and then kill it, both in a single session.
Given this assumption (which I agree with) and the uncertain nature as to when the duration starts, I've patched the items as follows:

BACKUP ~Magefix/backup~
AUTHOR ~Miloch~

BEGIN ~Mage Item Fixer~
ACTION_IF FILE_EXISTS_IN_GAME ~FW0100.ARE~ THEN BEGIN //Tutu
 OUTER_SPRINT ~tutu_var~ ~_~ //Tutu underscore
 OUTER_SPRINT ~tutu_scriptm~ ~_~ //Underscore instead of M
END ELSE BEGIN //BGT or BG1
 OUTER_SPRINT ~tutu_var~ ~~ //No underscore
 OUTER_SPRINT ~tutu_scriptm~ ~M~ //M instead of underscore
END

COPY_EXISTING ~%tutu_var%MAGE02.ITM~ ~override~
		  ~%tutu_scriptm%AGEAMUL.ITM~ ~override~
		  ~%tutu_scriptm%AGEBRAC.ITM~ ~override~
 PATCH_IF (~%SOURCE_SIZE%~ > 0x71) THEN BEGIN
READ_LONG  0x6a fb //Feature offset
READ_SHORT 0x70 fc //Feature count
fn = fc //Update feature count
FOR (ft = (fb + ((fc - 1) * 0x30)); ft > (fb - 1); ft -= 0x30) BEGIN
  READ_SHORT ft pc //Opcode
  READ_BYTE (ft + 0xc) tm //Timing mode
  READ_LONG (ft + 0xe) dr //Duration
  PATCH_IF (tm = 0) THEN BEGIN
	WRITE_BYTE (ft + 0xc) 2
	WRITE_LONG (ft + 0xe) 0
  END
  PATCH_IF ((pc = 7) OR (pc = 8)) THEN BEGIN
	DELETE_BYTES ft 0x30
	fn -= 0x01
	WRITE_SHORT 0x70 fn
  END
END
 END
BUT_ONLY_IF_IT_CHANGES

The duration should really start (if it's to simulate a proper spell) as soon as they turn Enemy(). But I don't see any sensible way of doing that aside from a lot of hackery with scripts. So I set the durations to "while equipped" and while I'm at it, remove the colour effects, since they bug me. There's no reason Amarande should look like a dryad, and if so, why he should have completely different colours in his CRE file.

 

I'd appreciate if someone could check my math, since I suck at it. (If the code looks familiar, it's derived from Auld Nythrunian, though I had to hack it quite a bit to get it to work in this particular case - but it does seem to work.) Also note I don't propose including this in the BG1 Fixpack, since it's too speculative. It'll probably end up in my BG1/Tutu Tweakpack or whatever it ends up becoming.

Link to comment

Yeah. This includes (in BG1/Tutu/BGT):

- for *mage02.itm ("Barkskin"): Amarande the Archdruid

- for *ageamul.itm ("Minor Globe"): Angelo, Dezkiel, Mirror Fiends #3 & #6, Beyn and Kahrk

- for *agebrac.itm ("Prot. from Missiles"): Andris, Angelo, Davaeorn, Flaming Fist Battle Wizard, Kahrk, Semaj and Tellan

(Brought to you by DLTCEP's ITM search on CREs :))

Link to comment

If you change it to while equipped, it should work a bit better -- it will remain dispellable, but should exist on the creature forever until you encounter and kill it.

 

@Avenger -- I'm not sure what you're asking. Items are attached (and loaded) based on the inventory slot table. This is done when the CRE is first loaded into the area. Unassigned items get purged, as do any items that are subsequently destroyed or used up. Effects don't wait for the actor to come into visual range (they start running as soon as the (re)load is done); I don't know all the events that cause the engine to reapply them, however.

Link to comment

Ok, i asked that.

But to make sure we talk about the same stuff:

 

I thought, and from your last note i see it reassured, that creatures equip their items when the area they are in is loaded.

But from Miloch's note i understood it differently like they equip items when they are first activated (which is almost always when they first come in visual range).

Link to comment

Definitely not. You only need to worry about it on-load (either new or from the saved game) and places where the CRE isn't in memory anymore (where you'd have to reapply all other effects anyway). I know some actions cause PC effects to be reevaluated, but I don't know what those actions are or whether it extends to NPCs.

If you change it to while equipped, it should work a bit better
I forgot to mention that you don't need to clear the duration if you change the timing mode (you can zero it just to make things cleaner, but it won't make any real difference).
Link to comment

The CREs come pre-equipped with these items. They don't have any special scripts allowing them, for example, to equip the items when a PC approaches. That might make sense, but like I said, would involve a lot of hackery.

I forgot to mention that you don't need to clear the duration if you change the timing mode (you can zero it just to make things cleaner, but it won't make any real difference).
Well, I like things clean I guess. It's only a couple extra lines of code... no big deal.
Link to comment

Enemy()

FillSlot()

 

isn't exactly a lot of hackery :(

 

It also has no advantages over

 

Enemy()

ReallyForceSpell(Myself,2406)

 

 

I don't think retard.cre (etc) is ever used, and no one should be toting around droppable versions of these items anyway. These items are pointless.

Link to comment
These items are pointless.
Yeah, they don't seem to be used in BG2. But they are used on several CREs in BG1. By that, I mean non-joinable enemies of course, since these are otherwise unobtainable and useful only on adversaries.
I would have to change scripts on all the following creatures:
This includes (in BG1/Tutu/BGT):

- for *mage02.itm ("Barkskin"): Amarande the Archdruid

- for *ageamul.itm ("Minor Globe"): Angelo, Dezkiel, Mirror Fiends #3 & #6, Beyn and Kahrk

- for *agebrac.itm ("Prot. from Missiles"): Andris, Angelo, Davaeorn, Flaming Fist Battle Wizard, Kahrk, Semaj and Tellan

And then mods like SCS might come along and overwrite my changes, since it uses alternate scripts for mages. I'd rather change the items I think.

 

(Why does everyone assume "modding" means "BG2 modding"? :()

Link to comment

Make sure they actually have the items in their inventory (unless you just want to be safe and patch them all). A ton of creatures in BG have a standard assortment of items that aren't actually used (the engine doesn't even care about the item list; anything not referenced in the slot list is auto-purged when the CRE is attached). I don't know if DLTCEP is pulling up references from the item list or if it's being hot and only listing equipped items, so "Angelo, Dezkiel, Mirror Fiends #3 & #6, Beyn, and Kahrk" may not actually be using "*ageamul" for instance.

 

Otherwise, I agree with Nythrun that it's pretty silly (really, who came up with the idea of applying spell effects this way?), but I think this is a case where patching the items is clearly the best approach (it's super-lazy, which is almost always something I'd advocate).

 

(Why does everyone assume "modding" means "BG2 modding"? )
Uh, because you're the only person who uses it differently? SNAP!

 

I've always known you're referring to BG and TotSC, so you've probably been assuming that I'm assuming something that I wasn't really assuming.

Link to comment
Make sure they actually have the items in their inventory
They're all equipped, even in the right slots (ring, amulet and gloves, respectively).
really, who came up with the idea of applying spell effects this way?
Apparently this is a legacy of BG1 they decided was a bad idea in BG2.

 

(Why does everyone assume "modding" means "BG2 modding"? )
Uh, because you're the only person who uses it differently?
Well, going back to my first sentence:
There are some items in BG apparently intended to simulate certain spells.
I guess I should've specified "BG1" rather than "BG" - though CamDawg would say "there was no game called Baldur's Gate 1" :(.
Link to comment

They do use MAGE01 a ton in BG2 (and have a couple other items to accomplish the same thing). Of course, it's used inappropriately 99% of the time, so I have a hard time lauding them for not using those other stupid items in the sequel. ;)

 

Well, going back to my first sentence:
The first sentence was fine. "BG" is clear. Nowhere do I suggest anything specific to BG2. Rather than thinking I was wrong when I suggested that most weren't used (which I still believe; there are like 10 of those dumb items hanging around, no?), you immediately concluded that I was talking about BG2.

 

I haven't even looked at BG since I finished my work on BG1UB, so I don't know the specifics of resource usage or remember exactly all of the differences between the BG2 and BG engines. If it doesn't make sense, it's because I don't know what I'm talking about, not because I'm talking about something else.

Link to comment
there are like 10 of those dumb items hanging around, no?
Which other "dumb items"? The two I mentioned in my initial post are used quite extensively. It would be logical to assume someone thinking otherwise would be thinking of BG2. For that matter, all the other "MAGE" rings are also equipped on various CREs. But those are all already set to "while equipped." So I don't know what other items you're talking about.

 

Edit: Now that I've looked at these closer, I think think they actually copied the related .spl files to .itm files for these and forgot to change the timing/duration on some.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...