Jump to content
Sign in to follow this  
Orions_Stardom

Finally Fixing Anomen's Armour

Recommended Posts

Right. Since the Anomen Component first came into existance, I've been using the most horrid mechanism I could come up with to take his heirlooms from him, and give his armour to him, and there've been numerous bugs over the last few years purely to do with this. These include, off the top of my head: the heirlooms are swapped with non-functioning versions of themselves instead of being taken away, infinite copies of these items can appear, no explanation is ever given in-game for anything, multiple copies of Anomen's Armour can be obtained, and I break Lilarcor somehow.

Now I got Windows 98 working on my BG2-enabled computer again, I have decided to finally lift myself off my arse, and fix these bugs. And since I decided the same about three years ago, and even had something coded which I subsequently forgot to publish and then lost, I'm stickying this topic so people keep bugging me until I actually fix it this time.

 

The current script uses vars that are set in dialogues, so the idea now is to use those dialogues directly to do the appropriates. This should ensure that everything only happens once, gives us a chance to explain what's going on, and should unbreak Lilarcor (however I broke it in the first place). It would probably be good to also have Cor remove the heirlooms from Anomen, rather than replacing them with non-functioning versions. CamDawg has also suggested that we should have a script aswell as this, which just takes the items, as a backup for the case where the heirlooms are put down before talking to Cor, and picked up again afterward. I'm still undecided as to whether we should do this - opinions welcome. :blush:

 

So, without further masses of prose, the technical side of it. According to Near Infinity, we need to:

TakePartyItemAll("ANOHELM");
TakePartyItemAll("NPSHLD");

At COR.DLG state 25 ("If you leave now you are forever banished from this place"), or 26 ("You are nothing, boy, nothing!"). Possibly want an extra state here to say about the items being taken - but the idea is possibly put well enough with what's there now.

 

And,

GiveItemCreate("ANOPLAT", "Anomen", 0, 0, 0)

 

At HPRELATE.DLG, state 6 ("Go, then, Sir Anomen, and serve the cause"). We DO need something here to explain the armour. Something like "You are granted this armour, with which to serve." would work, although it's more than a little corny. But then, so is everything else Anomen - we stick with that, unless something better comes along.

 

Which only leaves writing some Real Code to achieve this, and scrapping completely the old AnoTweak.baf .

Share this post


Link to post

Toss this in a .d file and compile it:

 

EXTEND_BOTTOM COR 24
 IF ~~ THEN DO ~TakePartyItemAll("ANOHELM") TakePartyItemAll("NPSHLD")~ GOTO g3newcor
END

APPEND COR
IF ~~ THEN BEGIN g3newcor SAY ~Gimme that stuff!~
 IF ~~ THEN GOTO 25
END
END

EXTEND_BOTTOM HPRELATE 5
 IF ~~ THEN DO ~SetGlobal("AnomenIsKnight","GLOBAL",1)~ GOTO g3newprelate
END

APPEND HPRELATE
IF ~~ THEN BEGIN g3newprelate SAY ~You are granted this armor, with which to serve.~
 IF ~~ THEN DO ~GiveItemCreate("ANOPLAT", "Anomen", 0, 0, 0)~ EXTERN ANOMENJ 97
END
END

 

This includes an extra line for Cor. If you don't want Cor to have one, replace the EXTEND_BOTTOM and APPEND for Cor with this instead:

 

ADD_TRANS_ACTION COR
BEGIN 24 END
BEGIN END
~TakePartyItemAll("ANOHELM") TakePartyItemAll("NPSHLD")~

Share this post


Link to post

Code! Yay! :blush:

 

But wait, there's more: Cam and I (mostly Cam) have come up with a solution for the meta-gaming problem: if the party is outdoors in Athkatla, and picks up Anomen's heirlooms after you've decided to not kill Saerk, a messenger will appear and take them from you. They'll just dissapear if you pick them up inside the Delryn Estate.

 

Delryn estate code:

/*
* NPCTweak 'Anomen' component.
* AR1001.BCS Extension.
* Take Anomen's heirlooms if he isn't killing Saerk, and is at home.
*/

IF
OR(2)
	PartyHasItem("ANOHELM")
	PartyHasItem("NPSHLD")
GlobalGT("AnomenDecide", GLOBAL, 2) // We're not killing Saerk
THEN
RESPONSE #100
TakePartyItemAll("ANOHELM")
TakePartyItemAll("NPSHLD")
END

Share this post


Link to post

Stuff for the messenger and guard. I'll leave you to test whether any of this works. :blush: tp2:

 

COPY_EXISTING ~kprunn01.cre~ ~override/g3osmsgr.cre~ // messenger
		  ~amng1.cre~	~override/g3osamng.cre~ // guard
 WRITE_EVALUATED_ASCII 0x248 ~%DEST_RES%~ #8 // override script
 WRITE_EVALUATED_ASCII 0x280 ~%DEST_RES%~ #32
 WRITE_EVALUATED_ASCII 0x2cc ~%DEST_RES%~ #8

 

EXTEND_BOTTOM any area scripts where it's appropriate to spawn the guard, i.e. outdoor Athkatla areas:

 

IF
 GlobalGT("AnomenDecide","GLOBAL",4)
 OR(2)
PartyHasItem("ANOHELM")
PartyHasItem("NPSHLD")
 !GlobalTimerNotExpired("G3OSTakeStuff","MYAREA")
THEN
 RESPONSE #100
CreateCreatureOffScreen("g3osmsgr",0)
SetGlobalTimer("G3OSTakeStuff","MYAREA",3600)
END

 

Compile this as the messenger's override script, g3osmsgr.bcs:

 

IF
 !PartyHasItem("ANOHELM")
 !PartyHasItem("NPSHLD")
THEN
 RESPONSE #100
EscapeArea()
END

IF
 Global("G3GuardSpawn","LOCALS",0)
THEN
 REPONSE #100
SetGlobal("G3GuardSpawn","LOCALS",1)
CreateCreature("g3osamng",[-1.-1],0)
END

IF
See([PC])
NumTimesTalkedTo(0)
THEN
RESPONSE #100
	Dialogue([PC])
END

IF
 !See([PC])
THEN
 RESPONSE #100
MoveToObject([PC])
END

 

Compile this as the guard's override script, g3osamng.bcs:

 

IF
 !PartyHasItem("ANOHELM")
 !PartyHasItem("NPSHLD")
THEN
 RESPONSE #100
EscapeArea()
END

IF
 !Range("g3osmsgr",5)
THEN
 RESPONSE #100
MoveToObjectFollow("g3osmsgr")
END

 

And toss this in a d file and compile (you'll definitely want to change the cheesy dialogue):

 

BEGIN G3OSMSGR
IF ~True()~ THEN BEGIN G3OSGimmeThat SAY ~Those items are the property of Cor Delryn and he demands their return, as is his right under Amnish law.~
 IF ~~ THEN DO ~TakePartyItemAll("ANOHELM") 
			 TakePartyItemAll("NPSHLD")~ GOTO G3OSGimmeThat2
END				 

IF ~~ THEN BEGIN G3OSGimmeThat2 SAY ~Thank you for your cooperation citizen.~
 IF ~~ THEN EXIT
END
END

Share this post


Link to post

Given the vast differences in power between the average adventurer and unarmed townsfolk, I've never been a fan of seeing Commoners blithely ignoring their own frailty, doing stuff like wandering around in areas full of monsters, or walking right up to a heavily armed Fighter->Cleric and yanking his helmet right off his head.

 

Personally, instead of the Messenger script, I would favor the 'Unusable Item' method, where the items simply get replaced to reflect the fact that Anomen's gear has rejected him as he rejected his father's orders.

 

About ANOPLAT.ITM: Is this the version that grants NPP, or the one that grants immunity to Blindness & Backstab?

Share this post


Link to post
Given the vast differences in power between the average adventurer and unarmed townsfolk, I've never been a fan of seeing Commoners blithely ignoring their own frailty, doing stuff like wandering around in areas full of monsters, or walking right up to a heavily armed Fighter->Cleric and yanking his helmet right off his head.

Well, there is a guard. :)

 

Personally, instead of the Messenger script, I would favor the 'Unusable Item' method, where the items simply get replaced to reflect the fact that Anomen's gear has rejected him as he rejected his father's orders.

I'll think about changing this again,

 

About ANOPLAT.ITM: Is this the version that grants NPP, or the one that grants immunity to Blindness & Backstab?

According to the description, it grants NPP. Which means there's probably still the old bug where it casts NPP as soon as its put on, rather than granting it while equipped. Damn. This is what happens when I don't actually play the game, least of all with my own mod, for about 4 years.

The immunity-to-b-things one is what you sent me a couple of years ago, with your feedback on the mod, yes? If so, I think it unlikely that I would have ever put it in the public mod, for the same reason that I took this long to fix the rest of this component - various personal things got in the way, and I lost interest in this stuff. And, naturally, that email fell victim to my reliance on free-of-charge webmail - the ones that say 'if you don't login for x days, all your mail gets deleted... (I have logged into that account about once in the last 2 years - since I got gmail. I will find a proper solution one day.)

Rambling aside, though, it is the same plate that was in 2.7, unless I've done more work in the last 12 months than I think, but I don't think I have.

Share this post


Link to post

I've just received the Armour but can't equip Anomen with it as if i were trying to equip it to an another NPC. Is it a known bug ? Is there something to do about it ?

Share this post


Link to post
Guest
You are commenting as a guest. If you have an account, please sign in.
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.

Sign in to follow this  

×