Jump to content

Help getting area script to work.


Recommended Posts

I am working on a mod called curseshop.  It is a shop that sells cursed items like that old cliche - ie the creepy shop opens up in town ala needful things or Something Wicked this Way Comes.  For a somewhat recent example, rick and Morty did a parody on this in the episode Something Ricked this Way Comes.  I am hoping to have it done in time for halloween.

 

So with some assistance from chat gpt, my shopkeep has a bit of a personality, and given that this is a shop that sells cursed things, I felt that the items should remain unidentified.  Instead of a normal unidentified description I've written little sales pitches for the items, and  I want the store item description window to display these pitches instead of unidentified description, which ought to be unavailable until the player ids the item.

 

The workaround I've come up with for this is to have two versions of each cursed item, one that has the sales pitch, and one that has the actual item descriptions.  I do this through a simple tp2 manipulation

COPY ~curseshop/dbboot1.itm~ ~override/dbboot1.itm~
	SAY NAME1 @3
	SAY NAME2 @4
	SAY UNIDENTIFIED_DESC @5
	SAY DESC @5 // the sales pitch version
	
COPY ~curseshop/dbboot1.itm~ ~override/dbbootA.itm~
	SAY NAME1 @3
	SAY NAME2 @4
	SAY UNIDENTIFIED_DESC @5
	SAY DESC @6  // the identified description

So in override dbboot1 is split into two files one with the sales pitch description dbboot1,  and one with the normal description dbbootA.  Then I wrote an area script to keep checking for checking party inventory for the presence of dbboot1 and if found remove it from player inventory, and replace it with the unidentified version dbbootA.  For now I am using area AR0812 because it lacks any other script and is a convenient location.  It is one of the tombs in the Athkatla graveyard.  So I wrote a script AR0812.baf, compiled it with weidu and dropped the .bcs in override folder - I also pointed AR0812 to the new bcs and saved it to override.  (I know this is improper mod practice but  I am just trying to get the quick and dirty version to work with basic functionality so I can test)

IF
	PartyHasItem("dbboot1") // boots pitch version
THEN
	RESPONSE #100
		TakePartyItem("dbboot1")
		GiveItemCreate("dbbootA",Player1,0,0,0) //boots normal version
		DisplayStringHead(Myself,46150)
END

This is the code I'm trying to run but it just doesn't work.  I'm not sure if the game isn't calling the script or if there's something else wrong with it.  The display stringhead is just "gulp" like if you drank a potion - it's just there for troubleshooting.  I've tried a few variations as well like adding a true() to the IF, and also wrote this(below) version based on the script bg2 uses to destroy the underdark gear.  (Global cursehopcheck is initialized in my shopkeeps dialog script, which works fine).

IF
	Global("curesshopcheckdone","GLOBAL",0)
	HasItem("dbboot1",Player1)  // pitch version
THEN
	RESPONSE #100
		TakeItemReplace("dbboot1","dbbootA",Player1)  // replace with reg version
		Continue()
END

Anyway if anyone has any insights as to why my scripts don't work I would very much appreciate it if you shared them.  I am also open to other ideas to get this functionality I am open to them, I just really like the idea of having the pitches in the shop window.
 

Link to comment

Are you testing from a save game? Areas are stored in the save game, so if you visited the area prior to assigning the area script, then (as far as that save is concerned) the area has no script.

edit: It looks like this topic was double-posted, so I'm going to lock this one and reply in the other.

Edited by CamDawg
Link to comment
Guest
This topic is now closed to further replies.
×
×
  • Create New...