Jump to content

New to weidu


krevett

Recommended Posts

Hi I'm interesred in learning how to patch files using weidu but I'm a bit lost ^^

I'd like to patch some items with limited charges to make them once/day instead as well as updating sto/cre/are that contains the item and descriptions.

I've seen some macro posted in the corresponding thread but I'm really beginning and I must say that I don't know how to use all this coding...

If someone has some time to lose with me and could explain how to start?

Thanks!

Link to comment

How far along in your learning are you?

I wrote a quick introduction for getting started with WeiDU: the files and folders you'll need, the basic structure of a TP2 file, posted here. If you have yet to get this far, I'd say it's still a worthwhile read.

As for using functions, for a patch function, you would open a buffer, typically with COPY_EXISTING and invoke the function. Function documentation can be found in the WeiDU readme (functions are under the macro listing). The IESDP is also a good resource for documentation of the file structures.

This code changes the Wand of Fire into having 1 recharging charge:

COPY_EXISTING wand05.itm override
  LPF ALTER_ITEM_HEADER
    INT_VAR
      header_type = 3
      charges = 1
      drained = 3
  END
BUT_ONLY

As the name implies, the function ALTER_ITEM_HEADER changes values in an item header, which is where charge behaviour is located. Other functions can be used to do other things. The function selects all headers of type  3 and changes the charge field to have the value 1 and the field for charge-depletion behaviour to have the value 3, which is daily recharge (see the IESDP). BUT_ONLY applies to the COPY_EXISTING action and means that the file will only be copied if the applied patches change the contents of the file. It's good practice to have it on all your COPY_EXISTINGs.

Updating charges in areas, creatures and stores is similar, but off-hand I can't recall if there are ready-made functions for all of it. It also involves finding the areas, etc, that hold references to the item. Updating the item description is most easily done by writing a new one and using the SAY patch to write it to the item and add it to the game. This is left as an exercise for the reader.

I hope that helps and feel free to ask questions.

 

Edited by Wisp
Link to comment

Well it took me a bit of time to get used to the syntax (and still havig a hard time ^^ my only experience in scripting is for personal entertainement a bit of vb and quite a bunch of nwn scripting ^^) but anyway I managed to do what I was looking for. I found some useful macros in another topic and with a bit of research and tweaking (and looking through cdtweaks/stratagems scripting too even if stratagems is using his own libraries it's really interesting to look at). In fact macro were useful as I had more than one item to change and some with more charges than other and I also wanted to change these items in cre/sto and are so I'm using a COPY_EXISTING_REGXP to loop through. I checked with NI and it seems OK, items are there with desc and charges as appropriate as well as creatures and stores edited.

Thanks for the reply!

Edited by krevett
Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...