Jump to content

Way to programmatically tell if magic item is identified?


OtisTDog

Recommended Posts

Hello, experts!

 

I'm wondering if anyone can tell me whether it's possible to write a dialog REPLY in such a way that it is available only if:

 

1) the party has a certain kind of magic item, and

2) the magic item has been identified.

 

The idea here is that if they have at least one of the item that has been identified, then they would know what they have and be able to use that knowledge in a conversation. If it's not yet identified, they won't be allowed to mention having it.

 

Obviously, there is a flag or something attached to the item that indicates it has been identified, but I haven't been able to find a trigger that it related to it. Would the Unusable() trigger work here? I just assumed that one was related to red shading (like when you can't use a weapon due to your class).

 

--Otis

Link to comment

A "simple" way to do this maybe to separate the unidentified items in two items : the unidentified version and the identified one. Then you can just check which item the party has.

 

To identify the unidentified version, I suppose there could be way, like a button "Use item" and a little script, but I don't remember if BG1 allows all of that.

Link to comment

Just had an idea...

 

Create two items.... One that is unidentified and one that is identified.

 

Then drop a script block into dplayer3.bcs:

IF
HasItem("unidentified_file",Myself)
CheckStatGT(Myself,X,LORE) //where X is the lore value you have assigned to the item.
Global("ab_item_identified","GLOBAL",0)
THEN
RESPONSE #100
DestroyItem("unidentifed_file")
GiveItemCreate("identified_file",Myself,1,0,0)
SetGlobal("ab_item_identified","GLOBAL",1)
END

The global gets set so that you can use it in the dialog as the trigger that the item has been identified. Unfortunately, you'll get a hard coded string that says something like "the party has gained an item."

 

This will work great for the party to identify the item, but if the party has a shopkeeper identify the item then this won't work.

 

However, you could modify the shopkeepers to see that the party has the item. They could then tell the party what it is for the cost of 100. You wouldn't be using the store to identify it. But using dialog directly. With the right weighting or adjustments to other state triggers (better to add additional trigger checks than mess with the weighting) you can prevent the player from getting the option to go into the store until this item has been identified. Something like...

 

APPEND ~merchant_dialog_file~
IF ~Global("ab_item_identified","GLOBAL",0)
PartyHasItem("unidentified_file")~
SAY ~That looks to be an interesting item... If I could have a closer look, I might be able to tell what it is. It'll cost 100 gold though.~
THEN
SAY ~Sure, here you go.~ 
DO ~TakePartyGold(100)
TakePartyItem("unidentified_item")~ 
GOTO next_state
SAY ~Nah, I'll figure it out on my own eventually.~ EXIT

next_state
IF ~~
SAY ~Why it's a whatever it is. I wrote out a thorough description and slipped it inside.~
DO ~GivePartyItem("identified_file")
SetGlobal("ab_item_identified","GLOBAL",1)~
EXIT

The code is not correct for a dialog file but you hopefully get the idea of what I'm suggesting.

 

BTW ab in the global variable name is my prefix. don't use it. it's just there as an example.

Link to comment
Then what about party using Identify spell and equivalent effects? Not a workable idea, I think.

Is it possible to give the unidentified item an immunity to the identify spell?

 

If it's not possible to give immunity to the identify spell, why not make the 'unidentified' version not able to do anything, but sit there and take up space in the inventory. The identified description that appears can say something about 'Despite all attempts at identifying this object it simply remains elusive. Perhaps stronger magics are at work...'

 

Also, the identify spell modifies the characters lore value. There is a remote possibility that the script block will catch the adjustment and set the global. It would require in game testing to see how it reacts.

 

The identify spell (the scroll just casts the spell) could have an additional effect given that sets a variable. That variable could then be used to trigger the item swap and global variable for dialog checks. Player wouldn't even have to right click on the item, they could identify something else and get a freebie with this bit.

 

To further expound upon that, I believe it would go something like this...

The identify spell would get opcode 177 use eff file. the eff file would get opcode 187 set local variable. The dplayer3.bcs would have a block that looked for the local variable, the 'unidentified' item, and that it's not be identified before. It would then set the global used in the dialog checks and swap out the item.

 

Check out the learn through use mod for the BG2 engine for detailed examples in using those opcodes. BTW those opcodes are present in the BG1 list of effects in both DLTCEP and NI. So I'm guessing that they will work...

Link to comment

Archived

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

×
×
  • Create New...