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.  Main idea is just that I want my pitch items to be the ones sold, and then transformed into the normal unidentified version once acquired.

Edited by dbianco87
Link to comment
24 minutes ago, dbianco87 said:

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.  Main idea is just that I want my pitch items to be the ones sold, and then transformed into the normal unidentified version once acquired.

GiveItemCreate("dbbootA",Player1,1,0,0). You currently have it to give 0 items of that item. I'd personally recommend doing something like the below and having it check player1 through player6, so the item gets created in the correct character's inventory. I haven't tested, so please let me know if it works.

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

 

Edited by morpheus562
Link to comment
48 minutes ago, CamDawg said:

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.

Oh wow I was testing with a save.  hah.  I spent so much time trying different things and had so many wild theories.

Cheers, and thanks I'm a fan of lots of your work.

 

Link to comment
1 hour ago, morpheus562 said:

GiveItemCreate("dbbootA",Player1,1,0,0). You currently have it to give 0 items of that item. I'd personally recommend doing something like the below and having it check player1 through player6, so the item gets created in the correct character's inventory. I haven't tested, so please let me know if it works.

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

 

That sounds better.  I will implement this suggestion thanks.  The way you put it is similar to how the adamantium item destruction script works in underdark exit.

Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...