Jump to content

Getting rid of a character that has no DV


jastey

Recommended Posts

DC stands for death variable, I think it's also known as script name.

My question is for vanilla BGI, but maybe someone knows a solution for BGII that I can adapt.

 

I want to use the interiors of a house. Inside this house, there is a commoner placed via the .are file. This commoner has no death variale, and uses no special script (only the common ones like SHOUT, RUNENEMY etc.)

 

How would I achieve this commoner to vanish, assuming I have a real good reason to do so?

 

I can't address him via AreaScript, since he has no death variable. I also can't add some block to his script, since I won't go and change things like SHOUT.bcs.

 

Any ideas?

Link to comment

Are there more creatures in that area? If the commoner in question is all alone you can get rid of him by using ActionOverride + DestroySelf tailored to his class/race/alignment. So, for a male, human, true neutral commoner something like this would work:

 

IF
Global("CommonerVanishes","LOCALS",0)
See([NEUTRAL.HUMANOID.HUMAN.INNOCENT.0.MALE.LAWFUL_NEUTRAL])
THEN
RESPONSE #100
	SetInterrupt(FALSE)
	SetGlobal("CommonerVanishes","LOCALS",1)
	ActionOverride(LastSeenBy(Myself),DestroySelf())
	SetInterrupt(TRUE)
END

 

You'd need to assign this script to an invisible creature which should then be spawned by the area script. However, this is entirely too much hassle, IMO. It's much easier to just patch the .CRE and assign him a valid death variable. :(

 

COPY_EXISTING ~SOMEGUY.CRE~  ~override~ // the CRE file in question
 WRITE_ASCII_TERMINATE 0x280 ~SOMEGUY~ // the new death variable
BUT_ONLY_IF_IT_CHANGES

Link to comment

I don't know if this will work in vanilla BG1, but I did just that in Gavin. The house I used for the quest is occupied by two sleeping figures. I assigned them DV's via the tp2--all sleeping figures--gave them a script, and included an area check to make them DestroySelf().

 

For the tp2:

  EXTEND_BOTTOM ~%tutu_var%SLEEPMH.bcs~ ~GAVIN/Quest/QuestBAF/B!SLEEPMH.baf~
  EVALUATE_BUFFER
 EXTEND_BOTTOM ~%tutu_var%SLEEPFH.bcs~ ~GAVIN/Quest/QuestBAF/B!SLEEPFH.baf~
  EVALUATE_BUFFER

COPY_EXISTING ~%tutu_var%SLEEPMH.CRE~ ~override~
 SAY NAME1 @66
 SAY NAME2 @66
 WRITE_ASCII 0x248 ~%tutu_var%SLEEPMH~ #8 // override
 WRITE_ASCII 0x280 ~%tutu_var%SLEEPMH~ #32 //DV
 BUT_ONLY_IF_IT_CHANGES

COPY_EXISTING ~%tutu_var%SLEEPFH.CRE~ ~override~
 SAY NAME1 @67
 SAY NAME2 @67
 WRITE_ASCII 0x248 ~%tutu_var%SLEEPFH~ #8 // override
 WRITE_ASCII 0x280 ~%tutu_var%SLEEPFH~ #32 //DV
 BUT_ONLY_IF_IT_CHANGES

 

And the contents of B!SLEEPFH.baf and B!SLEEPMH.baf:

IF
 AreaCheck("%Beregost_House22_L2%")
THEN
 RESPONSE #100
DestroySelf()
END

Link to comment

- Patch the ARE file and assign the character a custom SPECIFICS script that runs DestroySelf() when you want.

- Patch the ARE file to just delete the actor altogether or just unschedule it.

- Patch the CRE and give it a script name you can use to destroy it from the area script.

 

Personally, I'd go with the first option.

 

included an area check to make them DestroySelf().
There are no AreaCheck() and such triggers in BG1. :(
Link to comment

My respect for Echon (and Jastey, and the other folkks who made BG actually do things) goes up every time I read about all the things the engine couldn't do...

 

and a good deal of respect for the folks that created the game for reinventing themselves.

Link to comment

Other than the ways devSin mentioned, there's another way to do this that would be a bit better from a compatibility standpoint than just assigning him a random deathvar. I wanted to do something similar myself in Improved Watcher's Keep, but didn't want to break compatibility with any other mod that might affect umber hulks.

 

In the TP2:

COPY_EXISTING ~commoner.cre~ ~override~
READ_ASCII DEATHVAR "commoner_death_variable"
PATCH_IF ("%commoner_death_variable%" STRING_COMPARE_CASE "NONE")
 THEN BEGIN
  WRITE_ASCII DEATHVAR "%SOURCE_RES%"
END

 

Then, extend the area script with something like this:

IF
Global("KillCommoner","AR0000",0)
THEN
RESPONSE #100
 ActionOverride("%commoner_death_variable%",DestroySelf())
END

 

And in the TP2:

EXTEND_TOP EVALUATE_BUFFER ~AR0000.BCS~ ~MYSCRIPT.BAF~

 

Personally, I prefer this way because I find that patching areas is a real pain in the backside. The method that DevSin mentioned will work just fine, though. I wouldn't randomly assign a death variable without checking it first because then you risk breaking mod compatibility.

Link to comment

Thank you for your replies!

 

I would like to be able to destroy him without having to change the area, or the cre (assigning a DV via tp2 is easy, more or less, although I'm not pretending I would have known right away how to do it), that is my problem. aVENGER_[RR]'s method comes close but the man is not the only person in the room (definitely not after I spawned my quest creatures). Wait a minute... If I'd combine aVENGER_[RR]'s method with a negativ check of my quest-cres DVs, it could work, couldn't it?

 

Is it possible to assign a script to a cre in the game (via script)? For NPC mods, it's possible to "ChangeAIScript("scriptx",OVERRIDE)", for example, would something like this work, maybe using a spy creature? (I'm sure it does, but haven't looked at it yet. I shouldn't post.)

 

See([NEUTRAL.HUMANOID.HUMAN.INNOCENT.0.MALE.LAWFUL_NEUTRAL])

 

Could there more criteria be included, like check for animation ("girl/commoner") or something like that? (I guess I should just try this tonight).

 

I think I am getting closer.

Link to comment
Is it possible to assign a script to a cre in the game (via script)? For NPC mods, it's possible to "ChangeAIScript("scriptx",OVERRIDE)", for example, would something like this work, maybe using a spy creature? (I'm sure it does, but haven't looked at it yet. I shouldn't post.)

 

Yes, that should work. Use the code you posted in conjunction with an invisible creature and LastSeenBy().

Link to comment
Yes, that should work. Use the code you posted in conjunction with an invisible creature and LastSeenBy().

 

Yes, do all this extra funk for compatability, then watch in dismay as someone just overwrites the .are with their own version... ;)

Link to comment
I would like to be able to destroy him without having to change the area, or the cre (assigning a DV via tp2 is easy, more or less, although I'm not pretending I would have known right away how to do it), that is my problem. aVENGER_[RR]'s method comes close but the man is not the only person in the room (definitely not after I spawned my quest creatures). Wait a minute... If I'd combine aVENGER_[RR]'s method with a negativ check of my quest-cres DVs, it could work, couldn't it?
So, rather than change the CRE or the ARE, you're going to change the area script (or add it) to spawn your new invisible creature, add your new creature, and add a new script for your creature (and hope the player doesn't cast Detect Invisibility, because none of the useful effects to make invisible creatures exist in BG)? (IIRC, there aren't really any suitable invisible dummy creatures that you can steal. The spies first appeared in BG2.)

 

Object specs return the nearest visible object specified. If you said See([128]), it's only ever going to pick the closest EA NEUTRAL character to the script runner (this will not change until another NEUTRAL comes closer than the previous one). Adding !Name("MY_NAME",LastSeenBy()) won't affect who the creature's looking at (if the closest neutral is "MY_NAME," the block will never be true). You can test your luck with nthNearest(), but I still don't know why you'd bother with all this when you can just patch a single field in the ARE or CRE file?

Link to comment
Yes, that should work. Use the code you posted in conjunction with an invisible creature and LastSeenBy().

 

Yes, do all this extra funk for compatability, then watch in dismay as someone just overwrites the .are with their own version... ;)

 

I suspected that the suggestion meant patching the area, not overwriting it. Nothing here would overwrite...

Link to comment

I suspect that igi isn't talking about what Jastey should do in her mod, but what others will do/have done with theirs. Since BG1 isn't exactly a modder's paradise, many BG1 modders have not given patching, which is more tedius than overwriting, more consideration.

Link to comment

Archived

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

×
×
  • Create New...