Jump to content


Photo

Area question


  • Please log in to reply
25 replies to this topic

#1 ronin

ronin
  • Modder
  • 2114 posts

Posted 10 July 2006 - 11:55 PM

Ok, I have an original area with 17 actors in it and lets say 10 traps. I have an area from a mod with 71 actors in it and 15 traps, what is the best way to patch the area or bcs. I dont want to just overwrite the area, which is what the original mod was doing.

ronin

**edit**

Instead of starting a new thread I thought I would ask one more question. How do you add weapon proficiencies and stars using weidu to a cre file. For example I have ronin.cre and I want to add 2weapon proficiency with 3 stars. What would the code look like?

Edited by ronin69hof, 11 July 2006 - 08:08 AM.


#2 Azkyroth

Azkyroth
  • Modder
  • 3496 posts

Posted 11 July 2006 - 04:30 PM

Instead of starting a new thread I thought I would ask one more question. How do you add weapon proficiencies and stars using weidu to a cre file. For example I have ronin.cre and I want to add 2weapon proficiency with 3 stars. What would the code look like?


I would just include it in the .cre file as an effect, using DLTCEP.

"Tyranny is a quiet thing at first, a prim and proper lady pursing her lips and shaking her head disapprovingly, asking, well what were you doing (wearing that dress, walking home at that hour, expressing those inappropriate thoughts) anyway? It's subtle and insidious, disguised as reasonable precautions which become more and more oppressive over time, until our lives are defined by the things we must avoid. She's easy enough to agree with, after all, she's only trying to help -- and yet she's one of the most dangerous influences we face, because if she prevails, it puts the raping, robbing, axe-wielding madmen of the world in complete control. Eventually they'll barely need to wield a thing, all they'll have to do is leer menacingly and we fall all over ourselves trying to placate them." -godlizard


#3 ronin

ronin
  • Modder
  • 2114 posts

Posted 11 July 2006 - 09:35 PM

Instead of starting a new thread I thought I would ask one more question. How do you add weapon proficiencies and stars using weidu to a cre file. For example I have ronin.cre and I want to add 2weapon proficiency with 3 stars. What would the code look like?


I would just include it in the .cre file as an effect, using DLTCEP.


I am not creating a new creature, I am patching an existing one so I need the code for the .tp2 to just patch an existing cre

ronin

#4 SConrad

SConrad

    I swear to drunk I'm not God

  • Administrator
  • 11149 posts

Posted 12 July 2006 - 12:40 AM

Ok, I have an original area with 17 actors in it and lets say 10 traps. I have an area from a mod with 71 actors in it and 15 traps, what is the best way to patch the area or bcs. I dont want to just overwrite the area, which is what the original mod was doing.

Adding actors and triggers to an area with weidu is a bit tricky, but doable. If you want to add that many creatures, though, I think you're safer with scripting. There are so many things that could go wrong with the area patch in the tp2.

Instead of starting a new thread I thought I would ask one more question. How do you add weapon proficiencies and stars using weidu to a cre file. For example I have ronin.cre and I want to add 2weapon proficiency with 3 stars. What would the code look like?

You'd have to add an effect with weidu, updating offsets and so forth. I can't give you a working example now, because I'm at work and have no BGII here. ;)

I'll look into it when I get home.

Posted Image Khadion NPC mod - Team leader, head designer
Posted Image Hubelpot NPC mod - Team leader, coder
Posted Image NPC Damage - Coder
Posted Image PC Soundsets - Coder, voice actor
Posted Image Brythe NPC mod - Designer
Posted Image DragonLance TC - Glory of Istar - Designer
Posted Image The NPC Interaction Expansion Project - Writer for Cernd, Sarevok
Posted Image The Jerry Zinger Show - Producer

Iron Modder 5 - Winner


#5 ronin

ronin
  • Modder
  • 2114 posts

Posted 12 July 2006 - 01:00 AM

Adding actors and triggers to an area with weidu is a bit tricky, but doable. If you want to add that many creatures, though, I think you're safer with scripting. There are so many things that could go wrong with the area patch in the tp2.


Is it workable with patching the .bcs for the area?

ronin

#6 SConrad

SConrad

    I swear to drunk I'm not God

  • Administrator
  • 11149 posts

Posted 12 July 2006 - 01:09 AM

Should be. Just add an EXTEND_TOP.

Posted Image Khadion NPC mod - Team leader, head designer
Posted Image Hubelpot NPC mod - Team leader, coder
Posted Image NPC Damage - Coder
Posted Image PC Soundsets - Coder, voice actor
Posted Image Brythe NPC mod - Designer
Posted Image DragonLance TC - Glory of Istar - Designer
Posted Image The NPC Interaction Expansion Project - Writer for Cernd, Sarevok
Posted Image The Jerry Zinger Show - Producer

Iron Modder 5 - Winner


#7 ronin

ronin
  • Modder
  • 2114 posts

Posted 12 July 2006 - 05:04 AM

Ok, I am stuck, what I need to do is this:

Make the original code (shown here)

IF
	Global("ArledHostile","AR0312",0)
	Global("WorkingForBodhi","GLOBAL",1)
THEN
	RESPONSE #100
		SetGlobal("ArledHostile","GLOBAL",1)
		ActionOverride("Arledrian",Enemy())
END

Look like this:

I
F
	Global("ArledHostile","AR0312",0)
	Global("WorkingForBodhi","GLOBAL",1)
THEN
	RESPONSE #100
		SetGlobal("ArledHostile","AR0312",1)
		ActionOverride("Arledrian",Enemy())
END

The second block is what was just copied over from the mod. I would like to patch it incase another mod uses the same block. There is not much of a difference in the code but it makes a difference in the way the mod works. I have tried REPLACE_BCS_BLOCK with no success because it needs an oldfile newfile format.

ronin

#8 SConrad

SConrad

    I swear to drunk I'm not God

  • Administrator
  • 11149 posts

Posted 12 July 2006 - 07:17 AM

I haven't tried this (typing out of my head), so there can be a few syntax errors.

COPY_EXISTING ~script.bcs~ ~override~
  DECOMPILE_BCS_TO_BAF
	REPLACE_TEXTUALLY ~SetGlobal("ArledHostile","GLOBAL",1)~ ~SetGlobal("ArledHostile","AR0312",1)~
  COMPILE_BAF_TO_BCS
  BUT_ONLY_IF_IT_CHANGES
As for the weapon proficiency, here's a code snippet from the BG2Fixpack with does that to Cernd, only it adds one star to single weapon style. It should be easy enough to manipulate the code to your creature and change the number of stars and proficiency type.

// cernd12 missing star in single weapon style
COPY_EXISTING ~cernd12.cre~  ~override~
  READ_LONG 0x2a0 "kspl_off"
  READ_LONG 0x2a8 "minfo_off"
  READ_LONG 0x2b0 "mspl_off"
  READ_LONG 0x2b8 "itmslot_off"
  READ_LONG 0x2bc "itm_off"
  READ_LONG 0x2c4 "fx_off"
  READ_LONG 0x2c8 "fx_num"
  SET "delta" = 1
  INSERT_BYTES  "%fx_off%" 0x108 // inserting new prof effect
	WRITE_LONG  ("%fx_off%" + 0x08) 233	// opcode
	WRITE_LONG  ("%fx_off%" + 0x14) 1	  // stars
	WRITE_LONG  ("%fx_off%" + 0x18) 113	// prof - single weapon style
	WRITE_LONG  ("%fx_off%" + 0x1c) 9	  // timing
	WRITE_SHORT ("%fx_off%" + 0x24) 100	// prob
//	WRITE_ASCII ("%fx_off%" + 0x68) ~None~ // vvc
  WRITE_LONG 0x2c8 ("%fx_num%" + "%delta%")
  SET "offset" = ("%delta%" * 0x108)
  PATCH_IF NOT ("%fx_off%" > "%kspl_off%") BEGIN
	WRITE_LONG 0x2a0 ("%kspl_off%" + "%offset%")
  END
  PATCH_IF NOT ("%fx_off%" > "%minfo_off%") BEGIN
	WRITE_LONG 0x2a8 ("%minfo_off%" + "%offset%")
  END
  PATCH_IF NOT ("%fx_off%" > "%mspl_off%") BEGIN
	WRITE_LONG 0x2b0 ("%mspl_off%" + "%offset%")
  END
  PATCH_IF NOT ("%fx_off%" > "%itmslot_off%") BEGIN
	WRITE_LONG 0x2b8 ("%itmslot_off%" + "%offset%")
  END
  PATCH_IF NOT ("%fx_off%" > "%itm_off%") BEGIN
	WRITE_LONG 0x2bc ("%itm_off%" + "%offset%")
  END
  BUT_ONLY_IF_IT_CHANGES

Posted Image Khadion NPC mod - Team leader, head designer
Posted Image Hubelpot NPC mod - Team leader, coder
Posted Image NPC Damage - Coder
Posted Image PC Soundsets - Coder, voice actor
Posted Image Brythe NPC mod - Designer
Posted Image DragonLance TC - Glory of Istar - Designer
Posted Image The NPC Interaction Expansion Project - Writer for Cernd, Sarevok
Posted Image The Jerry Zinger Show - Producer

Iron Modder 5 - Winner


#9 ronin

ronin
  • Modder
  • 2114 posts

Posted 12 July 2006 - 07:47 AM

:cheers:

Thanks a million

ronin

#10 SConrad

SConrad

    I swear to drunk I'm not God

  • Administrator
  • 11149 posts

Posted 13 July 2006 - 12:33 AM

You're welcome. :)

I also moved this to the correct forum. ;)

Posted Image Khadion NPC mod - Team leader, head designer
Posted Image Hubelpot NPC mod - Team leader, coder
Posted Image NPC Damage - Coder
Posted Image PC Soundsets - Coder, voice actor
Posted Image Brythe NPC mod - Designer
Posted Image DragonLance TC - Glory of Istar - Designer
Posted Image The NPC Interaction Expansion Project - Writer for Cernd, Sarevok
Posted Image The Jerry Zinger Show - Producer

Iron Modder 5 - Winner


#11 ronin

ronin
  • Modder
  • 2114 posts

Posted 13 July 2006 - 03:23 AM

With the following code I get no errors during the installation but when I check the .dlg with NI I see no changes. Anyone know why?

COPY_EXISTING ~STGUARD1.DLG~ ~override~
  DECOMPILE_DLG_TO_D
	REPLACE_TEXTUALLY ~CreateCreature("DASSIN",[667.1583],0)
CreateCreature("DASSIN",[759.1206],0)
CreateCreature("DASSIN",[500.1246],0)
CreateCreature("DASSIN",[1435.1156],0)
CreateCreature("DASSIN",[1127.1457],0)
SetGlobal("StGuardAttack","AR0300",1)~ ~CreateCreature("STAS01",[667.1583],0)
CreateCreature("STAS01",[759.1206],0)
CreateCreature("STAS01",[500.1246],0)
CreateCreature("STAS01",[1435.1156],0)
CreateCreature("STAS01",[1127.1457],0)
CreateCreature("STAS01",[1276.1080],0)
CreateCreature("STAS01",[1621.890],0)
CreateCreature("STAS01",[1606.760],0)
SetGlobal("StGuardAttack","AR0300",1)~
  COMPILE_D_TO_DLG
 BUT_ONLY_IF_IT_CHANGES

ronin

#12 Grim Squeaker

Grim Squeaker

    Fallen

  • Member
  • 1018 posts

Posted 13 July 2006 - 12:47 PM

No errors doesn't necesarily mean that the REPLACE_TEXTUALLY actually replaced anything. All REPLACE_TEXTUALLY ~A~ ~B~ does is 'if you happen to find any As replace them with Bs'. It isn't 'you will find an A and replace it with a B'.

My suggestion is to actually decompile that dialogue file and compare it with the first argument in your command. Is the block formatted differently? The best way to get around that is to copy the text you want to replace from the decompiled dialogue and paste it into your REPLACE_TEXTUALLY command. That way you know the formatting is exactly the same.

Edited by Grim Squeaker, 13 July 2006 - 12:48 PM.

"You alone can make my song take flight..."

#13 ronin

ronin
  • Modder
  • 2114 posts

Posted 13 July 2006 - 10:36 PM

OK, I typed it all in by hand (see code) and it still wont work, any ideas?

COPY_EXISTING ~STGUARD1.DLG~ ~override~
  DECOMPILE_DLG_TO_D
	REPLACE_TEXTUALLY ~CreateCreature("DASSIN",[667.1583],0)~ ~CreateCreature("STAS01",[667.1583],0)~
  COMPILE_D_TO_DLG
BUT_ONLY_IF_IT_CHANGES


#14 SConrad

SConrad

    I swear to drunk I'm not God

  • Administrator
  • 11149 posts

Posted 13 July 2006 - 11:52 PM

What does the debug file say?

Posted Image Khadion NPC mod - Team leader, head designer
Posted Image Hubelpot NPC mod - Team leader, coder
Posted Image NPC Damage - Coder
Posted Image PC Soundsets - Coder, voice actor
Posted Image Brythe NPC mod - Designer
Posted Image DragonLance TC - Glory of Istar - Designer
Posted Image The NPC Interaction Expansion Project - Writer for Cernd, Sarevok
Posted Image The Jerry Zinger Show - Producer

Iron Modder 5 - Winner


#15 ronin

ronin
  • Modder
  • 2114 posts

Posted 14 July 2006 - 01:06 AM

Not a whole lot

[d:\BGII - SoA\/data/Dialog.bif] 4557664 bytes, 2729 files, 0 tilesets
[STGUARD1.DLG.DLG] loaded
[STGUARD1.DLG] created from [STGUARD1.DLG.DLG]
[STGUARD1.DLG] parsed
Adding STGUARD1.DLG to internal list of available DLGs
[STGUARD1.DLG.DLG] saved	4 states, 4 trans, 4 strig, 0 ttrig, 2 actions
Copied [STGUARD1.DLG] to [override/STGUARD1.DLG]

ronin

Edited by ronin69hof, 14 July 2006 - 01:08 AM.


#16 ronin

ronin
  • Modder
  • 2114 posts

Posted 14 July 2006 - 02:50 AM

Funny, the following works but it wont do the whole block like what I wanted (see above)

COPY_EXISTING ~STGUARD1.DLG~ ~override~
  DECOMPILE_DLG_TO_D
	REPLACE_TEXTUALLY ~DASSIN~ ~STAS01~
  COMPILE_D_TO_DLG
BUT_ONLY_IF_IT_CHANGES


life would be great with a REPLACE_DLG_BLOCK

ronin

Edited by ronin69hof, 14 July 2006 - 02:53 AM.


#17 Grim Squeaker

Grim Squeaker

    Fallen

  • Member
  • 1018 posts

Posted 14 July 2006 - 04:27 AM

life would be great with a REPLACE_DLG_BLOCK


Oh it really wouldn't. R_T has proven itself to be much more reliable than REPLACE_BCS_BLOCK (a command that nearly always failed due to the tiniest modification to the intended block caused by some other mod).

K, I typed it all in by hand (see code) and it still wont work, any ideas?


By that do you mean 'I typed it all in by hand' or what I suggested, which was copy/pasting from the decompiled dialogue file? Because it's difficult to go wrong with the latter.
"You alone can make my song take flight..."

#18 ronin

ronin
  • Modder
  • 2114 posts

Posted 14 July 2006 - 04:35 AM

I decompiled the stguard1.dlg using weidu from the command line to produce a .d file. I then copied the section out of it (old part) and then decompiled the mod's stguard.dlg to another folder and copied the new section out of it and pasted both in the .tp2 and I still couldnt get it to work.

Old section:

IF ~Global("WorkingForBodhi","GLOBAL",1)
~ THEN BEGIN 1 // from:
  SAY #21325 /* ~Ye've made quite th' mistake, showin' yer face around here!~ */
  IF ~~ THEN DO ~CreateCreature("DASSIN",[667.1583],0)
CreateCreature("DASSIN",[759.1206],0)
CreateCreature("DASSIN",[500.1246],0)
CreateCreature("DASSIN",[1435.1156],0)
CreateCreature("DASSIN",[1127.1457],0)
SetGlobal("StGuardAttack","AR0300",1)~ EXIT
END

New Section:

IF ~Global("WorkingForBodhi","GLOBAL",1)
~ THEN BEGIN 1 // from:
  SAY #21325 /* ~Ye've made quite th' mistake, showin' yer face around here!~ */
  IF ~~ THEN DO ~CreateCreature("STAS01",[667.1583],0)
CreateCreature("STAS01",[759.1206],0)
CreateCreature("STAS01",[500.1246],0)
CreateCreature("STAS01",[1435.1156],0)
CreateCreature("STAS01",[1127.1457],0)
CreateCreature("STAS01",[1276.1080],0)
CreateCreature("STAS01",[1621.890],0)
CreateCreature("STAS01",[1606.760],0)
SetGlobal("StGuardAttack","AR0300",1)~ EXIT
END

I also tried just removing all the other stuff and just leaving the CreateCreature parts from both and I still cant get it to work.

ronin

Edited by ronin69hof, 14 July 2006 - 04:37 AM.


#19 Grim Squeaker

Grim Squeaker

    Fallen

  • Member
  • 1018 posts

Posted 14 July 2006 - 05:19 AM

Fuck, I know exactly what the problem is. The first argument of REPLACE_TEXTUALLY is a regular expression, so it is interpreting the square brackets as a 'character set' and the quote marks as 'interpret the characters inside "" literally'.

Try the following:

COPY_EXISTING ~STGUARD1.DLG~ ~override~
  DECOMPILE_DLG_TO_D
	REPLACE_TEXTUALLY ~CreateCreature(\"DASSIN\",\[667.1583\],0)~ ~CreateCreature("STAS01",[667.1583],0)~
  COMPILE_D_TO_DLG
BUT_ONLY_IF_IT_CHANGES

"You alone can make my song take flight..."

#20 ronin

ronin
  • Modder
  • 2114 posts

Posted 14 July 2006 - 05:26 AM

Thanks I will try it when I get home, was just getting ready to shutoff my laptop and leave work for the day.

ronin

@ Grim,

thanks that worked fine and its alot better than REPLACE_BCS_BLOCK

ronin

Edited by ronin69hof, 14 July 2006 - 10:34 AM.