Jump to content


Zed Nocear's Trigger-Simulations for BG1


55 replies to this topic

#46 grogerson

    Blithering Idiot and BG1 Tweaks Scavanger

  • Members
  • 750 posts
  • Gender:Male
  • Location:Near Salt Lake City, UT

Posted 03 February 2011 - 05:22 PM

View Posterik, on Feb 3 2011, 04:25 PM, said:

I hope so. Hopefully Zed will drop by, check this out and have an answer for you. Considering what he's done for and with BG1, I'd trust his judgment.
It is an outrage that they should be commonly spoken of as Intellectuals. This gives them the chance to say that he who attacks them attacks Intelligence. It is not so. . . . It is not excess of thought but defect of fertile and generous emotion that marks them out. Their heads are no bigger than the ordinary: it is the atrophy of the chest beneath that makes them seem so.

And all the time, such is the tragi-comedy of our situation, we continue to clamour for those very qualities we are rendering impossible. . . . In a sort of ghastly simplicity we remove the organ and demand the function. We make men without chests and expect of them virtue and enterprise. We laugh at honour and are shocked to find traitors in our midst. We castrate and bid the geldings be fruitful.

C.S. Lewis, The Abolition of Man

#47 Zed Nocear

  • Members
  • 30 posts
  • Gender:Male

Posted 06 February 2011 - 11:16 AM

Quote

Re: crash issues, I told my 1G switch to limit bandwidth to 10 and the problem went away. I've seen issues with Delay() causing sync errors in multiplayer before, and I see the ghoul script uses that. I'm going to give a shot at removing the script from ghoul and see if that resolves the matter.

Quote

Sure the Delay() is multiplayer-safe?
http://forums.pocket....html#msg326931

I have read the issue and maybe the safety of Delay() in multiplayer is not absolute sure, but I doubt that Delay() is the reason of crashes in multiplayer. Delay() is used in original scripts about 50x in BG1 and 300x in BG2. Somehow should observe the crashes also in multiplayer in pure game. If slowing down the bandwidth has helped, I think, maybe outdated IPX protocol was not compliant with 1GHz bandwidth.

#48 jastey

    Titleless

  • Gibberlings
  • 4769 posts
  • Gender:Female
  • Location:Germany

Posted 07 February 2011 - 11:41 AM

Update of the tutorial: Changes to z!emulareacheck.baf are integrated as suggested. Thank you!

#49 Zed Nocear

  • Members
  • 30 posts
  • Gender:Male

Posted 09 February 2011 - 05:41 AM

I have refreshed the code of AreaCheck emulation with using new feature of WeiDU: inline and evaluate_buffer. This version makes in principle exactly the same as the previous one, but has compacter, more clear code and is easer to use: only code, no separate BAF files are needed:
<<<<<<<< .../BG1TriggerEmulation-inlined/Z!EmulAreaCheck.BAF
IF
	Delay(2)
	ActionListEmpty()
THEN
	RESPONSE #100
		SetGlobal("Z!EmulAreaCheck","GLOBAL",%Area_Number%)
		SetGlobal("Z!EmulAreaType","GLOBAL",%Area_Flags%)
		SetGlobal("Z!EmulAreaOutdoor","GLOBAL",%Variable_Outdoor%)
		SetGlobal("Z!EmulAreaCity","GLOBAL",%Variable_City%)
		SetGlobal("Z!EmulAreaForest","GLOBAL",%Variable_Forest%)
		SetGlobal("Z!EmulAreaDungeon","GLOBAL",%Variable_Dungeon%)
		SetGlobalTimer("Z!EmulAreaNotMaster","GLOBAL",4)
END
>>>>>>>>

<<<<<<<< .../BG1TriggerEmulation-inlined/Z!EmulAreaCheck1.BAF
IF
	!Global("Z!EmulAreaCheck","GLOBAL",%Area_Number%)
	!GlobalTimerNotExpired("Z!EmulAreaNotMaster","GLOBAL")
	ActionListEmpty()
THEN
	RESPONSE #100
		SetGlobal("Z!EmulAreaCheck","GLOBAL",%Area_Number%)
		SetGlobal("Z!LastMasterArea","GLOBAL",%Area_Number%)
		SetGlobal("Z!EmulAreaType","GLOBAL",%Area_Flags%)
		SetGlobal("Z!EmulAreaOutdoor","GLOBAL",%Variable_Outdoor%)
		SetGlobal("Z!EmulAreaCity","GLOBAL",%Variable_City%)
		SetGlobal("Z!EmulAreaForest","GLOBAL",%Variable_Forest%)
		SetGlobal("Z!EmulAreaDungeon","GLOBAL",%Variable_Dungeon%)
END
>>>>>>>>

COPY_EXISTING  ~AR2612.ARE~ ~override~ //two areas in BG1 have wrong flag "Outdoor"
			   ~AR3317.ARE~ ~override~
  WRITE_BYTE 0x48 0
  BUT_ONLY_IF_IT_CHANGES

COPY_EXISTING_REGEXP GLOB ~.*\.ARE~ ~override~ // for all areas in game proper script name and file
  SPRINT area_name ~%SOURCE_RES%~
  READ_ASCII 0x94 ~old_script_name~
  WRITE_EVALUATED_ASCII 0x94 ~%SOURCE_RES%~
  INNER_ACTION BEGIN
	ACTION_IF !(~%old_script_name%~ STRING_EQUAL_CASE ~%area_name%~)
		  AND (FILE_EXISTS_IN_GAME ~%old_script_name%.bcs~)
	  THEN BEGIN COPY_EXISTING ~%old_script_name%.bcs~ ~override/%area_name%.bcs~ END
  END
  BUT_ONLY_IF_IT_CHANGES

COPY_EXISTING_REGEXP GLOB ~.*\.ARE~ ~override~ // adds AreaCheck emulation block to the area script
  READ_ASCII 0x94 ~Script_Name~
  PATCH_IF (~%SOURCE_RES%~ STRING_MATCHES_REGEXP ~AR[0-9][0-9][0-9][0-9]~) = 0
	THEN BEGIN READ_ASCII 0x96 ~Area_Number~ (4) END
	ELSE BEGIN SPRINT ~Area_Number~ ~0~ END
  READ_BYTE 0x48 ~Area_Flags~
  INNER_ACTION BEGIN
	ACTION_IF (NOT FILE_CONTAINS_EVALUATED(~%Script_Name%.BCS~ ~Z!EmulAreaCheck~)) // area script not already patched
	  THEN BEGIN
		OUTER_SET Variable_Outdoor = ((~%Area_Flags%~ BAND 0b1) = 0b1)
		OUTER_SET Variable_City	= ((~%Area_Flags%~ BAND 0b1000) = 0b1000)
		OUTER_SET Variable_Forest  = ((~%Area_Flags%~ BAND 0b10000) = 0b10000)
		OUTER_SET Variable_Dungeon = ((~%Area_Flags%~ BAND 0b100000) = 0b100000)
		ACTION_IF (FILE_CONTAINS_EVALUATED(~MASTAREA.2DA~ ~%Script_Name%~))  //area is "master area" as in mastarea.2DA or not
		  THEN BEGIN EXTEND_BOTTOM ~%Script_Name%.BCS~ ~.../BG1TriggerEmulation-inlined/Z!EmulAreaCheck1.BAF~ EVALUATE_BUFFER END
		  ELSE BEGIN EXTEND_BOTTOM ~%Script_Name%.BCS~ ~.../BG1TriggerEmulation-inlined/Z!EmulAreaCheck.BAF~  EVALUATE_BUFFER END
	END
  END
  BUT_ONLY_IF_IT_CHANGES
Inspired by Grogerson in his BG1 Tweaks, I present emulation of AreaCheck as one library-file TPA BG1areacheck_emulation.TPA.
Now the use of code is very simple, just include on the bottom of your mod TP2 code the line:
INCLUDE ~%PatchInMyMod%/BG1AreaCheck_emulation.tpa~


#50 jastey

    Titleless

  • Gibberlings
  • 4769 posts
  • Gender:Female
  • Location:Germany

Posted 13 February 2011 - 02:53 AM

Very cool! I will update the tutorial soon.

#51 Zed Nocear

  • Members
  • 30 posts
  • Gender:Male

Posted 12 April 2011 - 05:37 AM

View PostZed Nocear, on Feb 6 2011, 09:16 PM, said:

Quote

Re: crash issues, I told my 1G switch to limit bandwidth to 10 and the problem went away. I've seen issues with Delay() causing sync errors in multiplayer before, and I see the ghoul script uses that. I'm going to give a shot at removing the script from ghoul and see if that resolves the matter.

Quote

Sure the Delay() is multiplayer-safe?
http://forums.pocket....html#msg326931
I have read the issue and maybe the safety of Delay() in multiplayer is not absolute sure, but I doubt that Delay() is the reason of crashes in multiplayer. Delay() is used in original scripts about 50x in BG1 and 300x in BG2. Somehow should observe the crashes also in multiplayer in pure game. If slowing down the bandwidth has helped, I think, maybe outdated IPX protocol was not compliant with 1GHz bandwidth.

Well, there is something about "Delay", but not Delay() at all. From my experience with "Areacheck Emulation" code, Delay(1) is buggy, works like True(), preventing fallowing script block activation and makes BG1 instable (sometimes CTD by area change and shopping). Delay with other time value like Delay(2) or higher works good.

#52 jastey

    Titleless

  • Gibberlings
  • 4769 posts
  • Gender:Female
  • Location:Germany

Posted 14 January 2012 - 03:12 PM

Tutorial in the first post is updated: New tp2 (tpa) coding of the area check emulation.

#53 plainab

    Sasha al'Therin

  • Members
  • 1717 posts
  • Gender:Male
  • Location:Lost on the Sword Coast

Posted 03 May 2012 - 06:07 PM

So on the rest detection, only dplayer3.bcs is modified. Doesn't this mean that if a player disables party AI that there will never be rest detection? Which is the reason I'm assuming that the combat detection method not only modifies the dplayer2 & dplayer3 scripts but also modifies an override script for each npc in the game. so with that reasoning, do you not think that each npc's override script should have the block for rest detection as well for a backup for when party AI is turned off?

Oh and another thing, may I use the methodology but with completely different file names for a custom container? Leaving only one creature file that is scripted in all cases of the containers the same as used in TWM & BG1 Tweaks (Z!BAG0X.CRE). I don't think there would be a big problem as the container in question is going to be coded to remain with the joinable NPC.
My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altheri...s.com/index.htm

#54 jastey

    Titleless

  • Gibberlings
  • 4769 posts
  • Gender:Female
  • Location:Germany

Posted 04 May 2012 - 12:37 PM

If I remember correctly, dplayer3.bcs also triggers some sort of "Player1 monologue" in the original game. Are you sure it is disabled if party AI is switched off?

Quote

may I use the methodology but with completely different file names for a custom container?
If the file names are different it should be no problem coding wise. In case you were asking for permission, of course, please go ahead.

#55 plainab

    Sasha al'Therin

  • Members
  • 1717 posts
  • Gender:Male
  • Location:Lost on the Sword Coast

Posted 04 May 2012 - 02:40 PM

since dplayer3 & dplayer2 are identical with the exception that one is ran for built in npc joinables and the other is ran for multiplayer joinables & protagonist. And since there is a well documented cheat that you can bypass the 10 day time limit of the poisoning by Marek simply by turning off the party AI and never turning it back on, I'd hazard to guess that yes turning AI off will in fact turn both dplayer3 & dplayer2 off.

I have no clue what this "player 1 monologue" is in the original game. There are kickout and breaking point blocks for multiplayer joinables to give them the multig.dlg file and talk with the protagonist (player 1) for kicking them out or being of a rep too far for their liking. but no 'monologue'. dplayer2 has similar blocks but they don't set any dialog file as the built in npcs already have built in methods of changing dialog.

I think someone merely misunderstood what is going on with these two scripts
My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altheri...s.com/index.htm

#56 jastey

    Titleless

  • Gibberlings
  • 4769 posts
  • Gender:Female
  • Location:Germany

Posted 31 July 2013 - 07:04 AM

Broken links in the first post are fixed.




Reply to this topic



  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users