Jump to content


Photo

PATCH_GAM & ADD_STORE_ITEM


  • Please log in to reply
15 replies to this topic

#1 japheth

japheth

    Codewalker

  • Member
  • 317 posts

Posted 08 September 2003 - 09:44 AM

Well, since I'm in Tennessee and I have absolutely nothing to do outside of work, I've coded up a few features that could be useful.

PATCH_GAM

I coded PATCH_GAM in response to the various threads I've read where people need to get their BG1 NPC's into the game.

Here's the syntax:

COPY ~mymod/mynpc.cre~ ~override/mymod/mynpc.cre~
(Do your SAY/WRITE_BYTE/whatever else here)
PATCH_GAM ~mynpc~ ~ar2600~ #123 #456

Where ~mynpc~ is the name of your cre file *without* the .cre extension, ~ar2600~ is the area name that you want your NPC to start in *without* the .are extension, #123 is the x co-ordinate and #456 is the y co-ordinate.

It will then splice in your cre file into any saved games (in the save and mpsave directories) and it will also add your NPC entry into the default baldur.gam (for starting new games).

Note however, that there is absolutely *no* way of backing this up other than backing up all saves in the save and mpsave directory to a backup folder.

I haven't wrote any code to backup the saves yet since I can't figure what variable Wes uses for the backup folder. (Wes, maybe you could add this?)

PATCH_GAM will only work with BG1 baldur.gam files. If you try it with any other IE game, WeiDU will choke.

ADD_STORE_ITEM

ADD_STORE_ITEM is just something I did out of boredom.

Here's the syntax:

COPY_EXISTING ~ribald.sto~ ~override/ribald.sto~
ADD_STORE_ITEM ~myitem~ #20 #0 #0 #1 #5

Where ~myitem~ is the name of your item file *without* the .itm extension, #20 is the first extension header's # of charges, #0 is the second extension header's # of charges, #0 is the third extension header's # of charges, #1 are the item flags (more on this below) and #5 are the # of items in stock.

The flags work as follows:

#1 Identified
#2 Stealable
#4 Unstealable
#3 Identified & Stealable
#5 Identified & Unstealable

In most cases putting #1 for the flags is fine.


I could code up some more feature like ADD_STORE_ITEM if people think there's a need for them. (e.g. Like ADD_TRIGGER for areas or something.)

I'll post the diffs for this when I get a chance to get on my laptop this afternoon.
Check out BG1Tutu.

#2 -jcompton-

-jcompton-
  • Guest

Posted 08 September 2003 - 09:49 AM

I could code up some more feature like ADD_STORE_ITEM if people think there's a need for them. (e.g. Like ADD_TRIGGER for areas or something.)

Ghrey was just wondering about this for BoB last night.

#3 japheth

japheth

    Codewalker

  • Member
  • 317 posts

Posted 08 September 2003 - 09:58 AM

I could code up some more feature like ADD_STORE_ITEM if people think there's a need for them.  (e.g. Like ADD_TRIGGER for areas or something.)

Ghrey was just wondering about this for BoB last night.

Ah, he needs something like ADD_TRIGGER?

Oh, and I should also note that ADD_STORE_ITEM will work on any .sto version.
Check out BG1Tutu.

#4 -jcompton-

-jcompton-
  • Guest

Posted 08 September 2003 - 10:02 AM

Yes, he was just last night wanting to add triggers to Brynnlaw, wondering how to do it cleanly, I told him to talk to you, etc.

Might want to call it ADD_AREA_TRIGGER or something, since we already have TRANS and STATE trigger adding...

#5 -bt_igi-

-bt_igi-
  • Guest

Posted 08 September 2003 - 10:05 AM

Lo folks,
Nice feature Japh, will be nice to see trigger insertion too :-) And expanded weidu's support of bg1 is always nice to see.

On a side note (ok, maybe this is the main note :) I wrote a small tool to insert items into stores (also drinks, and spells), unless they already exist there, and remove them as well (based only on item name, or entire item (ie. name + flags).
Its available at www.teambg.net/~igi along with my other tools (SIIE, iirc). I also plan to develop a .are insertion tool, and a WMP one etc.
Have a browse around, and feel free to drop me comments, queries or questions.
/igi (TeamBG)

#6 japheth

japheth

    Codewalker

  • Member
  • 317 posts

Posted 08 September 2003 - 10:11 AM

Yeah, I plan on adding ADD_MAP_ENTRY later on. I did this the "hard" way a few months back using WeiDU's READ_BYTE/SHORT/LONG and WHILE loops.

Nice point about checking to see if it's already there. I'll write that out today or tonight sometime.
Check out BG1Tutu.

#7 weimer

weimer
  • Member
  • 1569 posts

Posted 08 September 2003 - 11:13 AM

Japh, you are a small god. This is just the sort of creeping featurism we embrace with WeiDU. Send me the diffs at your leisure.

#8 Idobek

Idobek

    Pocket Plane Gibberling

  • Member
  • 429 posts

Posted 08 September 2003 - 11:28 AM

As you are asking; I have some of suggestions:

1) ADD_CREATURE_ITEM ~newitem~ (#flags)
- this would work like ADD_STORE_ITEM and would add the new item into the first available inventory slot.

2) OVERWRITE_CREATURE_ITEM ~itemslot~ ~newitem~ (#flags)
- self explanatory, I think.

3) ADD_CONTAINER_ITEM ~containernumber~ ~newitem~ (#flags)
- as you are playing with area files, I thought I'd throw this in. It can be done with scripting but this would be much more elegant. :D

Also, I wonder if you could look into "this" for me? If I am doing something wrong I'd like to know. Otherwise, make it work. Pretty please.

Have fun, and as Wes says; you are a god.

#9 -Ghreyfain-

-Ghreyfain-
  • Guest

Posted 08 September 2003 - 02:20 PM

As you are asking; I have some of suggestions:

1) ADD_CREATURE_ITEM ~newitem~ (#flags)
- this would work like ADD_STORE_ITEM and would add the new item into the first available inventory slot.


GiveItemCreate() in scripts works fine for this.

2) OVERWRITE_CREATURE_ITEM ~itemslot~ ~newitem~ (#flags)
- self explanatory, I think.


TakeItemReplace() works fine for this, in ToB at any rate.

3) ADD_CONTAINER_ITEM ~containernumber~ ~newitem~ (#flags)
- as you are playing with area files, I thought I'd throw this in. It can be done with scripting but this would be much more elegant.  :D


GiveItemCreate() works for this too, I'm fairly sure.

Oh, and yeah, cool stuff japh. ADD_AREA_TRIGGER would make you both a force for GOOD and for AWESOME.

#10 Loriel

Loriel
  • Member
  • 57 posts

Posted 08 September 2003 - 03:03 PM

I was gone for a few days, pondering this very issue while I didn't have my computer. Let me be the one hundred and eleventh person to say, "Japh, you rock!"

EDIT: Casting my vote for ADD_AREA_TRIGGER

#11 hlidskialf

hlidskialf

    Incarnation of the Eternal Ale Warrior

  • Modder
  • 2510 posts

Posted 08 September 2003 - 04:41 PM

*Ahem...* Bitching Japh!

The great wolf Fenrir gapes ever at the dwelling of the gods.


#12 Gabrielle

Gabrielle

    Do what thou wilt

  • Member
  • 1567 posts

Posted 08 September 2003 - 05:45 PM

This would be great for those of us that are involved in BG 1 mods. B)
For all of your BG modding needs: Chosen of Mystra.

This is The End.

#13 japheth

japheth

    Codewalker

  • Member
  • 317 posts

Posted 09 September 2003 - 06:11 AM

I've revised the syntax for ADD_STORE_ITEM a bit.

It works like this now:

ADD_STORE_ITEM [optional_plus] ~myitem~ #10 #0 #0 ~IDENTIFIED~ #5

The [optional_plus] is for overwriting items already in the store. So... if you're worried that the item might already be in there, just stick the + in there and it will do one of the following:

a) Overwrite the item if it's there .
b) Add the item if it isn't there.

I've made adding the flags a bit easier as well. Here's the list of valid flags you can use:
  • IDENTIFIED
  • UNSTEALABLE
  • STOLEN
  • IDENTIFIED&STOLEN
  • IDENTIFIED&UNSTEALABLE
That's about it.
Check out BG1Tutu.

#14 Idobek

Idobek

    Pocket Plane Gibberling

  • Member
  • 429 posts

Posted 10 September 2003 - 11:19 AM

From Idobek (ie. me):

2) OVERWRITE_CREATURE_ITEM ~itemslot~ ~newitem~ (#flags)
- self explanatory, I think.

From Ghreyfain:

TakeItemReplace() works fine for this, in ToB at any rate.


The problem with doing this by script is that you (or at least I) can't then equip the item. (I have tried a whole host of commands to try and do this.) Hence my suggestion. I would revise my suggestion a little though:

OVERWRITE_CREATURE_ITEM ~itemslot~ ~olditem~ ~newitem~ (#flags)

Another suggestion: READ_ASCII, is detailed "here".

#15 Gabrielle

Gabrielle

    Do what thou wilt

  • Member
  • 1567 posts

Posted 14 October 2003 - 03:47 PM

Looking at this which is the final code for doing this for stores?

Plus I would like to make a request that added things like this would be put up some where or put into the Weidu ReadMe as a tutorial. Looking for something that was added to Weidu in these forums is timeing.
For all of your BG modding needs: Chosen of Mystra.

This is The End.

#16 Idobek

Idobek

    Pocket Plane Gibberling

  • Member
  • 429 posts

Posted 15 October 2003 - 03:55 AM

The final code for ADD_STORE_ITEM is as per Japh's post on Sep 9 2003.

The first 3 #'s are the number of charges of the extended headers. The last # is for the number in stock.