Jump to content

How to dynamically change an NPC's equipment?


Recommended Posts

Posted

I'm currently building what's effectively a simple Hello World mod for my own personal use and I'm stumbling over the documentation a bit.
From what I can tell the easiest way to change the inventory and equipped items on a NPC would be to just edit the creature file(.CRE) using Near Infinity and then just use a basic COPY command in my TP2 file to bring in the modified creature file.

My query is twofold:
1. Is this actually best practice? (I suspect that it isn't)

2. How would I achieve this in a dynamic fashion so that I don't have conflicts with other mods? I know there's the ability to write bytecode changes directly to the files, but I haven't been able to wrap my head around it and need a dirt simple example or two. 

My current concrete goal is to change the Rune Assassin(TANTHF01.CRE)'s Short Sword +1 out for DAGG03.ITM(Dagger +2: Heart of the Golem). As far as I can figure the code in the TP2 would look something like this:
 

COPY_EXISTING 
	"TANTHF01.cre" override	
		WRITE_Something HowDoIFindThisOffset SomeValueIndicatingTheDagger

But I have no idea how to determine any of the three components on the third line for myself and would like some guidance in learning to do so.

Posted (edited)

@CidBahamut this might help;

https://gibberlings3.github.io/Documentation/readmes/weiducourse/weiducourse.html

It explains a lot and he knows what he's talking about.

I think to do what you wanted above you could do this;

COPY_EXISTING ~TANTHF01.cre~  ~override~
    ADD_CRE_ITEM ~DAGG03~ #0 #0 #0    ~NONE~    ~WEAPON1~ EQUIP
BUT_ONLY_IF_IT_CHANGES

I'm far from an expert though so if thats wrong I'm sure someone will correct me.

Edited by Nathan82
Posted

@Nathan82 that's actually the main document I've been cruising through along with the gigantic Weidu ReadMe. It's been real dense reading, so thank you for pointing me towards the ADD_CRE_ITEM command as I was not aware of it. That helps a bunch with my immediate hurdle and I found a good tutorial in the ReadMe that goes over that command specifically, which has helped with wrapping my head around some of how the parameter structure works. So yeah, good find.

I do still wonder about stuff like WRITE_BYTES and how to comprehend offsets. I'm just anticipating working with spells being an absolute nightmare to parse when I get to it later on. Ah but maybe I should just leave that to be a headache for another day.

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...