Jump to content


Photo

Crash 2 seconds after entering the Bandit Camp


  • Please log in to reply
37 replies to this topic

#21 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 16 October 2009 - 10:01 AM

While I see no problems in adding darts with 0 charges (should just get the item to be depleted as soon as it's loaded I think)

I have reason to believe through some pretty rigourous testing that a *stackable* item with zero charges is equivalent to 65536 instances of it, or at any rate, will "roll over" to 65535 once the creature starts using them. Potential for causing a bug? You better believe it, especially if it's in an invalid slot to begin with. Always, always specify the number of charges with stackables. It is easy to modify the Vault's tp2 if you want to test this - just change the first #0 after the DART03 to #10 and change the QUIVER1 to WEAPON2 while you're at it.

Re: modding with NearInfinity, see here (probably posted by devSin, someone who should know, having been involved with the NI code).

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#22 kthxbye

kthxbye
  • Member
  • 233 posts

Posted 16 October 2009 - 10:51 PM

Yup I didn't mean I didn't believe it, only that I didn't see why it would cause the crash. Now I see why it could be the reason of my CTD. :) Thanks for the info on NI too.

Today I'm going to do a fresh install and check the two areas - had some problems with the new versions of BGT and BGTTweak as it seems the Big World Fixpack couldn't patch them, and Drizz't Saga and Tales of the Deep Garden had some problems probably with the map. Will skip the patches on the updated mods and try again. :)
All of the above must be considered totally IMHO.

Rose NPC and ktweaks for BG:T

#23 kthxbye

kthxbye
  • Member
  • 233 posts

Posted 17 October 2009 - 02:52 AM

Tried the new install without the Vault by jumping to the Ogre's Reach area and agreeing to help the paladin to summon the gibberlings. As soon as gibberlings spawn, the lag appears just like in my old install so it's not fault of the Vault mod. As soon as I find a way to prevent the lag, I'll try to fix Venkt's erroneous number of darts and check if it's the reason of the crash.
All of the above must be considered totally IMHO.

Rose NPC and ktweaks for BG:T

#24 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 17 October 2009 - 03:08 AM

Does the lag happen before or after you get the journal entry added for the gibberling horde? The only thing I know of that affects that battle is SCS - it adds more gibberlings and does something with a variable there in Laurel's dialogue.

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#25 kthxbye

kthxbye
  • Member
  • 233 posts

Posted 17 October 2009 - 03:43 AM

If I remember right the dialog with Laurel sets a variable and the journal entry, then waits for 3 seconds and then spawns the gibberlings. The lag starts as soon as the goblins are spawned - they don't pop-up all at once, but each one appears as soon as the game processes the CreateCreature command. Usually it takes more or less a second to spawn them all, and the more the gibberlings, the more the lag.
I am sure I already cleared both the Bandit Camp and Ogre's Reach with SCS I & II installed, so it may be an issue related only to the last two or so versions. This afternoon I'll check gibberlings' scripts but I don't know how the calls for help are handled. LStest didn't expose any looping script, so if the calls for help are handled in a different way I don't know how to check if those are the real cause of the lag or not. :(
All of the above must be considered totally IMHO.

Rose NPC and ktweaks for BG:T

#26 kthxbye

kthxbye
  • Member
  • 233 posts

Posted 17 October 2009 - 05:01 AM

I've noticed there are a LOT of items with 0 charges - scrolls, potions, ammunitions and the like - on some of the bandit camp area.
I haven't tested this yet, but could it fix the issue for all the .cre files?

BACKUP ~itemschargesfix/backup~
AUTHOR ~kthxbye~
VERSION ~v1~

BEGIN ~Items charges fix~
REQUIRE_PREDICATE (GAME_IS ~bgt~) ~Requires BG:T~
COPY_EXISTING_REGEXP GLOB ".*\.cre$" override
 READ_LONG 0x2c0 numitems
 READ_LONG 0x2bc itemoffset
 FOR(i=0;i<numitems;i+=1) BEGIN
  READ_SHORT (itemoffset + i*0x14 + 0x4) numcharges
  PATCH_IF (numcharges = 0) BEGIN
   WRITE_SHORT (itemoffset + i*0x14 + 0x4) 1
  END
 END
BUT_ONLY_IF_IT_CHANGES

I didn't bore to check if the item is stackable or not since non stackable items usually have a charge num1 of 1 when assigned with weidu, but if this omission could cause troubles I can insert the check.
If the code's right I'll try it out now - haven't tried it yet 'cause if there's even a slim chance of saving my current no-reload run, I don't want to mess with it with unnecessary code.
All of the above must be considered totally IMHO.

Rose NPC and ktweaks for BG:T

#27 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 17 October 2009 - 05:33 AM

I didn't bore to check if the item is stackable or not since non stackable items usually have a charge num1 of 1 when assigned with weidu, but if this omission could cause troubles I can insert the check.

Non-stackables usually have a charge of zero, which is pretty much the same as 1 (or actually zero is more accurate if they don't have "charges"). In other words, it shouldn't matter for those either way - it's the stackables that have the problem. But I wouldn't mess with a regexp glob like that which could have the potential for harm or at any rate lagging your game since it's gonna undo your biffs quite a bit by unbiffing every CRE in your game. Just test the known potential issue on Venkt and if changing that improves the matter, then you can look at other possible problems.

As for the lag with Laurel and the gibberlings - I see that SCS's script for ar3499.bcs could cause some potential issues, because it only checks !Global("DMWWLaurelGibberling","GLOBAL,0) and increments it by -1 at the same time while creating gibberlings offscreen. Another problem on my install at least is that it didn't use an EVALUATE_BUFFER correctly so that the %tutu_var% is null on BGT, though perhaps this has since been corrected (my install is BWP v5). Anyhow, I can see how it might lag you every 3 seconds or so, if that's what's happening. It'd be better if it was something like GlobalGT("DMWWLaurelGibberling","GLOBAL,0) because it's remotely possible it could get incremented below zero, which could cause an endless loop.

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#28 kthxbye

kthxbye
  • Member
  • 233 posts

Posted 17 October 2009 - 05:44 AM

The problem is, not only Venkt has stackable items with 0 charges - but I can change the code so that it will address only .cre files used in Bandit Camps and that I know have some null charged stackable items.
Will do this later today, and will report if this fix the crash issue - in which case I'll report the fix on the Vault boards.

As for the lag.. I don't think it goes on an infinite loop as the block that fires on that condition spawns some gibberlings, and I didn't have endless waves. Don't know what else could be causing that, as I've tried to check the gibberlings' scripts and those looks ok, as far as I can tell.
All of the above must be considered totally IMHO.

Rose NPC and ktweaks for BG:T

#29 kthxbye

kthxbye
  • Member
  • 233 posts

Posted 17 October 2009 - 08:52 AM

Did it, and it worked! The game didn't crash, and I was able to clear the whole bandit camp - it still wasn't lag free, but the stutter was bearable.
The code I used to fix Venkt, Hakt and Taugos:
BACKUP ~banditcampfix/backup~
AUTHOR ~kthxbye~
VERSION ~v1~

BEGIN ~Bandit camp fix~
REQUIRE_PREDICATE (GAME_IS ~bgt~) ~Requires BG:T~
COPY_EXISTING ~taugos.cre~ ~override~
 READ_LONG 0x2c0 numitems
 READ_LONG 0x2bc itemoffset
 PATCH_PRINT "%SOURCE_RES%"^" has "^"%numitems%"^" items."
 FOR(i=0;i<numitems;i+=1) BEGIN
  READ_SHORT (itemoffset + i*0x14 + 0xA) numcharges
  PATCH_PRINT "Item number "^"%i%"^" has "^"%numcharges%"^" charges."
  PATCH_IF (numcharges = 0) BEGIN
   WRITE_SHORT (itemoffset + i*0x14 + 0xA) 1
   PATCH_PRINT "Processing item number "^"%i%"
  END
 END
BUT_ONLY_IF_IT_CHANGES
COPY_EXISTING ~hakt.cre~ ~override~
 READ_LONG 0x2c0 numitems
 READ_LONG 0x2bc itemoffset
 PATCH_PRINT "%SOURCE_RES%"^" has "^"%numitems%"^" items."
 FOR(i=0;i<numitems;i+=1) BEGIN
  READ_SHORT (itemoffset + i*0x14 + 0xA) numcharges
  PATCH_PRINT "Item number "^"%i%"^" has "^"%numcharges%"^" charges."
  PATCH_IF (numcharges = 0) BEGIN
   WRITE_SHORT (itemoffset + i*0x14 + 0xA) 1
   PATCH_PRINT "Processing item number "^"%i%"
  END
 END
BUT_ONLY_IF_IT_CHANGES
COPY_EXISTING ~venkt.cre~ ~override~
 READ_LONG 0x2c0 numitems
 READ_LONG 0x2bc itemoffset
 PATCH_PRINT "%SOURCE_RES%"^" has "^"%numitems%"^" items."
 FOR(i=0;i<numitems;i+=1) BEGIN
  READ_SHORT (itemoffset + i*0x14 + 0xA) numcharges
  PATCH_PRINT "Item number "^"%i%"^" has "^"%numcharges%"^" charges."
  PATCH_IF (numcharges = 0) BEGIN
   WRITE_SHORT (itemoffset + i*0x14 + 0xA) 1
   PATCH_PRINT "Processing item number "^"%i%"
  END
 END
BUT_ONLY_IF_IT_CHANGES

Yes, it's raw and it has 3 separate instances instead of one, but I can't remember (if I ever used it) how to copy different precise resources and modify all of them with the same code. Anyway, it works.
On my way to notify it on the Vault's boards too. :)

Attached Files


All of the above must be considered totally IMHO.

Rose NPC and ktweaks for BG:T

#30 Jarno Mikkola

Jarno Mikkola

    The Imp in his pink raincoat.

  • Member
  • 10911 posts

Posted 17 October 2009 - 09:22 AM

The code I used to fix Venkt, Hakt and Taugos:
...
Yes, it's raw and it has 3 separate instances instead of one, but I can't remember (if I ever used it) how to copy different precise resources and modify all of them with the same code.

Instead of:
COPY_EXISTING ~taugos.cre~ ~override~
 ...
BUT_ONLY_IF_IT_CHANGES
COPY_EXISTING ~hakt.cre~ ~override~
...
BUT_ONLY_IF_IT_CHANGES
COPY_EXISTING ~venkt.cre~ ~override~
...
BUT_ONLY_IF_IT_CHANGES
Just use
COPY_EXISTING ~taugos.cre~ ~override~
			  ~hakt.cre~ ~override~
			  ~venkt.cre~ ~override~
...
BUT_ONLY_IF_IT_CHANGES

Deactivated account. The user today is known as The Imp.


#31 kthxbye

kthxbye
  • Member
  • 233 posts

Posted 17 October 2009 - 09:34 AM

Oohh, silly me! Thanks Jarno, will remember that for the future. :)
All of the above must be considered totally IMHO.

Rose NPC and ktweaks for BG:T

#32 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 17 October 2009 - 11:39 AM

As for the lag.. I don't think it goes on an infinite loop as the block that fires on that condition spawns some gibberlings, and I didn't have endless waves. Don't know what else could be causing that, as I've tried to check the gibberlings' scripts and those looks ok, as far as I can tell.

Can you paste your decompiled ar3499.baf here. Like I said, on my install it wouldn't be creating endless waves, or any waves at all, since it's trying to spawn a bunch of "%tutu_var%GIBBER" instead of "GIBBER".

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#33 kthxbye

kthxbye
  • Member
  • 233 posts

Posted 18 October 2009 - 12:23 AM

Sure, here it is:
IF
	PartyHasItem("SW1H19") // The Vampire's Revenge
	Global("TheVault","GLOBAL",1)
	Global("TheVaultSentry","GLOBAL",0)
THEN
	RESPONSE #100
		CreateCreature("JC_VS1",[2900.1505],0) // Vault Sentry
		SetGlobal("TheVaultSentry","GLOBAL",1)
		Continue()
END

IF
	!GlobalTimerNotExpired("DMWWGibberTimer","GLOBAL")
	!Global("DMWWLaurelGibberling","GLOBAL",0)
THEN
	RESPONSE #100
		SetGlobalTimer("DMWWGibberTimer","GLOBAL",3)
		ActionOverride(Player1,CreateCreatureOffScreen("GIBBER",0)) // Gibberling
		ActionOverride(Player1,CreateCreatureOffScreen("GIBBER",0)) // Gibberling
		ActionOverride(Player1,CreateCreatureOffScreen("GIBBER",0)) // Gibberling
		ActionOverride(Player1,CreateCreatureOffScreen("GIBBER",0)) // Gibberling
		ActionOverride(Player1,CreateCreatureOffScreen("GIBBER",0)) // Gibberling
		ActionOverride(Player1,CreateCreatureOffScreen("GIBBER",0)) // Gibberling
		IncrementGlobal("DMWWLaurelGibberling","GLOBAL",-1)
END

It seems that with newer versions of SCS the %tutu_var% issue has been rectified, and David also added a timer to prevent the block to run indefinitely if for some reasons the counter went below 0.
All of the above must be considered totally IMHO.

Rose NPC and ktweaks for BG:T

#34 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 18 October 2009 - 12:53 AM

That timer was already there... I still think it'd be better with GlobalGT("DMWWLaurelGibberling","GLOBAL,0) instead of !Global("DMWWLaurelGibberling","GLOBAL,0) but I dunno what else could be going wrong. You may as well test it without SCS to make sure it isn't the problem. The Continue() isn't really necessary in the Vault's block either, though it probably isn't lagging you.

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#35 Lollorian

Lollorian

    smiley addict

  • Member
  • 4150 posts

Posted 18 October 2009 - 01:57 AM

About the Ogre's Reach lag. I felt I should mention that I didn't face anything of the laggy kind in the area ... and lookin at my AR3499.bcs, it much bigger than kthxbye's :unsure: (yeah, Laurel's quest completed flawlessly for me ... no lags, and no reloading [unlike my BWP6 install when the quest wouldn't complete for some reason :P explodin gibberling corpses??])

IF
	Global("SharoJumpOn","GLOBAL",1)
	Global("SharoInParty","GLOBAL",1)
	!InActiveArea("sharo")
	!See("sharo")
	!Dead("sharo")
	!StateCheck("Azure",STATE_DEAD)
THEN
	RESPONSE #100
		MoveGlobalObject("sharo","Azure")
END

IF
	Global("SharoJumpOn","GLOBAL",1)
	!InActiveArea("sharo")
	!See("sharo")
	!Dead("sharo")
	!Global("SharoInParty","GLOBAL",1)
	StateCheck("Azure",STATE_DEAD)
THEN
	RESPONSE #100
		MoveGlobalObject("sharo",Protagonist)
END

IF
	PartyHasItem("SW1H19") // Vampiric Sword
	Global("TheVault","GLOBAL",1)
	Global("TheVaultSentry","GLOBAL",0)
THEN
	RESPONSE #100
		CreateCreature("JC_VS1",[2900.1505],0) // Vault Sentry
		SetGlobal("TheVaultSentry","GLOBAL",1)
		Continue()
END

IF
	!GlobalTimerNotExpired("DMWWGibberTimer","GLOBAL")
	!Global("DMWWLaurelGibberling","GLOBAL",0)
THEN
	RESPONSE #100
		SetGlobalTimer("DMWWGibberTimer","GLOBAL",3)
		ActionOverride(Player1,CreateCreatureOffScreen("GIBBER",0)) // Gibberling
		ActionOverride(Player1,CreateCreatureOffScreen("GIBBER",0)) // Gibberling
		ActionOverride(Player1,CreateCreatureOffScreen("GIBBER",0)) // Gibberling
		ActionOverride(Player1,CreateCreatureOffScreen("GIBBER",0)) // Gibberling
		ActionOverride(Player1,CreateCreatureOffScreen("GIBBER",0)) // Gibberling
		ActionOverride(Player1,CreateCreatureOffScreen("GIBBER",0)) // Gibberling
		IncrementGlobal("DMWWLaurelGibberling","GLOBAL",-1)
END

IF
	Global("HaiassJumpOn","GLOBAL",1)
	Global("HaiassSeUne","GLOBAL",1)
	!InActiveArea("haiass")
	!See("haiass")
	!Dead("haiass")
THEN
	RESPONSE #100
		MoveGlobalObject("haiass",Protagonist)
END

The extra blocks that you see in my bcs are from Haiass and the Azure (Expert) mod :P (btw, shouldn't kthxbye have the Haiass block?? :ph34r:

Cheers,
Lol

"I am the smiley addict, yellow and round, this is my grin :D when I'm usually around :P.
When there's trouble brewing, see me post, cuz it's usually a wall o' yellow and your eyes are toast!!!"

BWP GUIDE - BWP FIXES - impFAQ - NPC LIST - KIT LIST - AREA LIST

GitHub Links : BWP Fixpack | Lolfixer | BWP Trimpack | RezMod


#36 kthxbye

kthxbye
  • Member
  • 233 posts

Posted 18 October 2009 - 02:33 AM

@Miloch, I'm pretty sure the lag doesn't come from that script, as LStest shows the blocks run for a while to spawn the gibberlings, then stop but the lag is still there even when the scripts don't fire. Anyway, yeah a GlobalGT would be safer than a !Global check there, just to be extra-sure.

@Lollorian: nope, I don't use Haiass.
All of the above must be considered totally IMHO.

Rose NPC and ktweaks for BG:T

#37 OneEyedPhoenix

OneEyedPhoenix
  • Member
  • 308 posts

Posted 19 October 2009 - 07:58 AM

Strange...
I didn't have any lagging problems in either of these areas, although I had a lot of 0 charge items like you.

#38 kthxbye

kthxbye
  • Member
  • 233 posts

Posted 19 October 2009 - 08:07 AM

Sounds strange to me too.. Anyway, the lag didn't disappear but just lowered to a bearable level. Don't know what else changed that might have affected it.
All of the above must be considered totally IMHO.

Rose NPC and ktweaks for BG:T