Jump to content

Photo

Upgradeable items with Cespenar and Cromwell


2 replies to this topic

#1 CamDawg

CamDawg

    ALL GLORY TO THE HYPNOTOAD

  • Gibberling Poobah
  • 9685 posts
  • Gender:Not Telling

Posted 05 April 2006 - 09:14 AM

I've been meaning to turn this into a full blown tutorial for a loooong time now, so: here we are. This assumes familiarity with some basic WeiDU functionality and dialogue files.

____________
This originally came about in the course of creating an upgradeable spear sequence for Delainy in a way that would not conflict with other mods. It is fully extensible, install order independent, and should work for as many items you wish to pile on.

This is a simple example. Let's say you wish to create an item, CDItem4, by combining three items: CDItem1, CDItem2, and CDItem3. First you need to extend Cromwell's dialogue in the critical state where he starts looking through your items, state 13, with the following .d code:

EXTEND_BOTTOM WSMITH01 13
IF ~OR(3)
      PartyHasItem("CDItem1")
      PartyHasItem("CDItem2")
      PartyHasItem("CDItem3")~ THEN GOTO PartyHasAtLeastOneItem
END

APPEND WSMITH01
IF ~~ THEN BEGIN PartyHasAtLeastOneItem SAY ~What's this then? Shards of a broken sword?~
  IF ~PartyHasItem("CDItem1")
      PartyHasItem("CDItem2")
      PartyHasItem("CDItem3")~ THEN GOTO PartyHasAllParts
  IF ~OR(3)
      !PartyHasItem("CDItem1")
      !PartyHasItem("CDItem2")
      !PartyHasItem("CDItem3")~ THEN GOTO PartyDoesNotHaveAllParts
END

IF ~~ THEN BEGIN PartyDoesNotHaveAllParts SAY ~These are the remnants of an ancient, powerful blade. If ye find more of it, I can forge a mightly blade for ye.~
  IF ~~ THEN GOTO MovingRightAlong
END

IF ~~ THEN BEGIN PartyHasAllParts SAY ~Aye, ye've collected the remains of an ancient blade . I can forge it into a mighty blade for ye.~
  IF ~~ THEN REPLY ~What's would that take?~ GOTO HowMuch
  IF ~~ THEN REPLY ~No, I'm not interested. Is there anything else you can use?~ GOTO MovingRightAlong
END

IF ~~ THEN BEGIN HowMuch SAY ~It'll cost ye 7,500 gold and without me apprentice, you'll need to stay on a day and help me run the forge.~
  IF ~PartyGoldGT(7499)~ THEN DO ~SetGlobal("CDItems","GLOBAL",1)
                                  SetGlobal("ForgeStuff","GLOBAL",1)
                                  TakePartyGold(7500)
                                  DestroyGold(7500)~ REPLY ~Yes, let's do it.~ GOTO 56
  IF ~~ THEN REPLY ~No, I'm not interested. Is there anything else you can use?~ GOTO MovingRightAlong
END

IF ~~ THEN BEGIN MovingRightAlong SAY ~Well, let's see what ye've got then.~
  COPY_TRANS WSMITH01 13
END
END

We branch Cromwell's dialogue in state 13 into our new dialogues, added via APPENDs. The last state--MovingRightAlong--then provides all of the options from the original state 13, preserving the original Cromwell upgrades and any added by mods. One thing to note here--even after you extend state 13 with your new branches, the COPY_TRANS WSMITH01 13 only copies the transitions that existed before you compile your .d file. So if you want to add multiple items, you'll need to add additional transitions for your other items in addition to the COPY_TRANS directive. Be sure to add them 'pyramid style' so the dialogue won't infinitely loop.

Cromwell actually creates the items via his area script. The ForgeStuff global is what trips the upgrade process; the extra variable that is set (in this case, the CDItems global variable) determines what is forged. You can use the same variable for all of your items with different values--the original Bioware items are all handled with the ForgeItem variable, for example. Extend Cromwell's area script (ar0334.bcs) with the following:

IF
  Global("CDItems","GLOBAL",1)
  Global("ForgeStuff","GLOBAL",1)
THEN
  RESPONSE #100
      SetGlobal("CDItems","GLOBAL",0)
      TakePartyItem("CDItem1") 
      TakePartyItem("CDItem2")
      TakePartyItem("CDItem3")
      DestroyItem("CDItem1") 
      DestroyItem("CDItem2")
      DestroyItem("CDItem3")
      GiveItemCreate("CDItem4",PLAYER1,0,0,0) // completed item
      ActionOverride("wsmith01",StartDialogueNoSet([PC]))
END

If two mod upgrades require the same item(s), using the code above the player will see the second upgrade option if they decline (or are not eligible for) the first one. This is not unprecedented in the game: on some upgrades that require mutual items, Cespy will offer a choice between the two if the player has more than one eligible upgrade with the item, and other times he won't. For example, he does offer a choice between Taralsh and Darkfire upgrades with the Bowstring of Gond, but the option for upgrading Firetooth only gets shown if these are declined. The same is true for Purifier and Carsomyr upgrades--if the player has Carsomyr, Purifier and the Eye of Tyr, the Carsomyr upgrade is only offered if the Purifier upgrade is declined. This same technique can be used with Cespenar.

Comments and discussion should be directed to the comments and discussion thead.

Why is this Hypnotoad video so popu... ALL GLORY TO THE HYPNOTOAD.


#2 jastey

jastey
  • Gibberlings
  • 7440 posts
  • Gender:Female

Posted 13 March 2010 - 05:41 AM

This same technique can be used with Cespenar.


Some details to Cespenar: dialog file is "BOTSMITH.dlg".

Its dialogue is structured that there does not exist one main "search for components" state like for Cromwell state 13. Instead, it is a tree where every new search through the inventory is a new state. I decided to add to state 4, the first "search" state. This means the mod items will be covered first. Then, state 4 will be repeated for the original game items.

In the dialogue, the required items have to be taken and a modvariable has to be set. Dialogue state 11 starts the universal cutscene. The variable "Global("ImpForgeStuff","GLOBAL",1)" is set in this cutscene, too, and doesn't have to be set in the dialogue.

Cespenar then creates the items via his own script, "BOTSMITH.bcs", like the following example:

IF
	Global("ItemMaker","GLOBAL",1)
	Global("ImpForgeStuff","GLOBAL",1)
THEN
	RESPONSE #100
		SetGlobal("ImpForgeStuff","GLOBAL",0)
		GiveItemCreate("sw1h59",Player1,0,0,0) // Short Sword of Mask +5
		StartDialogueNoSet(Player1)
END

Edited by jastey, 13 March 2010 - 05:42 AM.


#3 lroumen

lroumen
  • Members
  • 176 posts
  • Gender:Male
  • Location:Netherlands

Posted 17 March 2010 - 11:33 PM

Nice tutorial. I find it quite handy to have this explained in greater detail than the bits and pieces I had to put together from different threads.

I do find upgrading items at Cromwell/Cespy becoming a problem. If I do a (not even) mega-modification on BG2 with several mods tampering with weapon upgrading at Cromwell/Cespy I find that the dialogue becomes rather slow.
It would be nice if some mods choose a different armorer since there are quite a few smithies spread around the realms.



Reply to this topic



  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users