Guest Warren Posted May 26, 2023 Posted May 26, 2023 Hi! I seem to remember that neutral NPC would go Enemy() if targeted with a spell marked as hostile, which SPWI607 is. (at least they would when failing their saving throw, otherwise I don't remember 100%.) Even after being unpetrified they stay blue-circled in both BG1 and 2 EE 2.6.6. Am I misremembering something, or did something change? The IESDP doesn't seem to note anything special, though I don't know which script "SPECIFIC script" refers to. Quote
lynx Posted May 26, 2023 Posted May 26, 2023 Check what scripts the NPC you're targetting has set, maybe you're just unlucky. Quote
jmerry Posted May 26, 2023 Posted May 26, 2023 The arcane Flesh to Stone spell does have the hostile flag, so any creature targeted by it should treat that as a hostile act, even if they make the save.[1] But ... if you petrify the creature, they're dead. Can they still become an enemy after that? Checking IESDP on STATE_STONE_DEATH ... "Creature may only take actions listed in both ACTSLEEP.IDS and INSTANT.IDS". The "Enemy()" action is in both of those lists, but I still don't know whether a stoned creature can go hostile at all. Normally, all statues are neutral; they only ever become enemies after waking up. By the way, the "specifics" script is a slot that can be filled through script actions or actor parameters. It's not in the CRE file. [1] Dealing damage and inflicting some negative states also count as hostile acts even if the spell/ability that caused them isn't flagged hostile; for example, the Wand of Paralyzation (stun) counts as hostile if the enemy fails the save. Quote
kjeron Posted May 26, 2023 Posted May 26, 2023 If they aren't lacking the script block to turn hostile, then they likely have a higher priority script block preventing it from running (which may be a intentional or due to bad scripting). The following script block found in some creatures at the top of their OVERRIDE script will intentionally prevent the rest of their scripts from processing while they are frozen/stoned: IF OR(2) StateCheck(Myself,STATE_STONE_DEATH) StateCheck(Myself,STATE_FROZEN_DEATH) THEN RESPONSE #100 SmallWait(5) END Quote
jmerry Posted May 26, 2023 Posted May 26, 2023 That block is also present at the top of SHOUT.BCS and several related shout scripts; they're not override scripts, but they run at higher priority than combat scripts do. Which covers ... most neutral NPCs. Quote
Guest Warren Posted May 26, 2023 Posted May 26, 2023 Found the culprit. Neutral doesn't go Enemy() when the script is located in the CRE's DEFAULT "slot", even with the other 4 slots set to None. Why is that? Putting the script in any other "slot" works fine. What's going on behind the scenes? Details to reproduce: Picking BFTOWN1.CRE, I set to None all 5 CRE scripts and then added the following one as DEFAULT. I also set her current and max HP to 20000 and removed her loot (by setting "Gold" to 0, "Inventory 7" to -1 and removing "Item 0"). Everything done through the latest version of Near Infinity on BG2EE 2.6.6.0 (Windows). IF AttackedBy([GOODCUTOFF],DEFAULT) Allegiance(Myself,NEUTRAL) THEN RESPONSE #100 Enemy() END (Side note: the IESDP's Enemy() entry has a copy pasta error, it should replace AttackedBy()'s "Myself" with "DEFAULT".) Quote Dealing damage and inflicting some negative states also count as hostile acts even if the spell/ability that caused them isn't flagged hostile; for example, the Wand of Paralyzation (stun) counts as hostile if the enemy fails the save. I did notice that yes. Damage (12) triggers AttackedBy() and apparently Sleep (39, no waking up on damage) or Pause target (165) too, given Color Spray (SPWI105) doesn't have the hostile flag. Do we have a detailed list of things that trigger AttackedBy() other than weapon attacks (including misses), and (on a failed save) Damage (12) or the hostile flag? Quote
lynx Posted May 26, 2023 Posted May 26, 2023 Make sure the assigned scripts are not overriden in the area, if you're not spawning the creature yourself. Quote
jmerry Posted May 26, 2023 Posted May 26, 2023 Checking the creature used as an example here ... BFTOWN1 shows up as two actors in the Bridge District. Neither of those has any scripts assigned. Quote
Guest Warren Posted May 26, 2023 Posted May 26, 2023 Summoned her in the Pocket Plane through console command. Sorry the reproduce case was more complete, but a CTRL+Z in the forum's comment form reverted WAY back and CTRL+Y didn't work to restore it. Turns out I didn't retype everything after that :/ That CRE has "None" as her script name in Near Infinity, not sure area script could catch that even if it tried? Got the same result with MTOWBA_D in BG1EE 2.6.6.0, the Default script doesn't make it go red but others do. (Tested that CRE in Ulgoth's Beard, where it's not naturally present.) Quote
lynx Posted May 26, 2023 Posted May 26, 2023 I'd try an if true block with some displaystring debug print — just to see if this script slot/level gets disabled as well. Quote
Bubb Posted May 26, 2023 Posted May 26, 2023 6 hours ago, Guest Warren said: I did notice that yes. Damage (12) triggers AttackedBy() and apparently Sleep (39, no waking up on damage) or Pause target (165) too, given Color Spray (SPWI105) doesn't have the hostile flag. Do we have a detailed list of things that trigger AttackedBy() other than weapon attacks (including misses), and (on a failed save) Damage (12) or the hostile flag? The only engine functions that trigger AttackedBy() are: CGameEffect::OnAdd() - Hostile flag CGameEffectDamage::OnAddSpecific() CGameSprite::PickPockets() - PPBEHAVE.2DA->TURN_HOSTILE CGameSprite::Swing() SPWI105 has the hostile flag set in BG2:EE v2.6.6.0. Quote
jmerry Posted May 27, 2023 Posted May 27, 2023 (edited) Oops. I've been misinterpreting things. The ability of the wand of paralyzation is flagged as hostile in unmodded 2.6, which explains that stun causing hostility. Now the part I don't understand is when the save is made and hostility doesn't happen. ... Every effect of that wand has a save to negate, including the cosmetics. If saves fully block all the effects, does that mean the victim doesn't notice it happened? Edited May 27, 2023 by jmerry Quote
kjeron Posted May 27, 2023 Posted May 27, 2023 1 minute ago, jmerry said: The wand of paralyzation's ability is not flagged as hostile. It is though...in all v2.6.6.0 games. 5 hours ago, Guest Warren said: Got the same result with MTOWBA_D in BG1EE 2.6.6.0, the Default script doesn't make it go red but others do. (Tested that CRE in Ulgoth's Beard, where it's not naturally present.) The DEFAULT script slot is cleared upon a Frozen/Stone death, likely related to these deaths forcibly removing the creature from the party, which normally updates a creature's DEFAULT script slot. While the Chunking death also removes a creature from the party, it does not update the DEFAULT script slot, likely because there is no intended recovery from a chunking death. Quote
Bubb Posted May 27, 2023 Posted May 27, 2023 28 minutes ago, jmerry said: If saves fully block all the effects, does that mean the victim doesn't notice it happened? Correct. The engine only checks if the hostile flag was present when an opcode first goes into effect. This also means delayed timing modes do not trigger the hostile response when they are added, but when their delay is over. Quote
Guest Warren Posted May 27, 2023 Posted May 27, 2023 Quote I'd try an if true block with some displaystring debug print — just to see if this script slot/level gets disabled as well. I added the following at the top of the short script shown previously: IF True() THEN RESPONSE #100 DisplayString(Myself,10246) // Left game. Continue() END As expected, the string was displayed every second or so. But once petrified the string spamming stopped and didn't restart after cured. With any of the other 4 script "slots", the spamming doesn't stop. When the test script in the Default "slot", doing CTRL+M before petrification displays: Scripts: , None, , None, MyTestScript Specific Script: During petrification and after cure: Scripts: , None, , None, Specific Script: Now with the test script in the General "slot", CTRL+M displays the following and it never changes: Scripts: , None, , MyTestScript, Specific Script: Why would Flesh to Stone remove the Default script and not the other 4? Is it a bug or is the Default "slot" reliably used for a type of actions that should not survive petrification? (And if so what should really go into Default?) @Bubb Indeed SPWI105 has the flag and so does the Wand of Paralyzation. Thanks for clearing it up! I recognize the Swing function that I had to make sense of from the EXE last year. That function contains the to-hit roll and associated calculations IIRC so that explains why missed attacks do trigger AttackedBy(). Speaking of Assembly, I picked up the game's PDB but it's still quite unproductive so I don't do it often. I use x64dbg, do you have a database of annotations and other comments that you wouldn't mind making public? You've done huge work around making sense of it all over the years, so I assume you got yourself productivity boosts! Quote
Recommended Posts
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.