Jump to content


Photo

Weidu and strings


  • Please log in to reply
43 replies to this topic

#21 Mike1072

Mike1072
  • Modder
  • 539 posts

Posted 18 August 2016 - 06:23 AM

All of the state icons are stored in one file (states.bam), so to insert a new one requires patching it in manually or overwriting the file completely, making it incompatible with other things that want to add new states.  I wrote some code to do manual patching for the map icons file and it wasn't pretty.  There's also a limited number of states available and I believe one of the popular mods replaces the file, filling up almost all of the unused states.

 

In EE they introduced a new BAM file format which is easier to patch and able to support more cycles in the file (which would basically eliminate the state limit), but creating a BAMv2 version of states.bam doesn't work.

 

I've learned that recent EE versions have externalized states by adding a new column to statdesc.2da, allowing the use of icons that are contained in other BAM files (not just states.bam).  Hopefully, this means that the limit on number of states is also essentially gone.

 

So, to add a new state, you can append a row to statdesc.2da containing your new state number (which should be calculated at install time based on existing rows in the file), the string for the state, and the name of the BAM containing the state's icon.



#22 Fiann of the Silver Hand

Fiann of the Silver Hand
  • Member
  • 286 posts

Posted 18 August 2016 - 01:57 PM

This would be small "s" state, and not STATE_, as in the IDS. They should've named it status.

#23 temnix

temnix
  • Member
  • 983 posts

Posted 19 August 2016 - 09:58 AM

I'll keep it simple...

 

So, is there an answer why that line of code from Mike only produced an empty-string effect? Or some other way I can safely add strings with my Weidu installation and obtain their content? Anything to avoid adding them manually. I have this idea to include a faux dialogue, through a .d file, which would only have service strings. Instead of a conversation. But how would I link to those strings after the installation?



#24 Mike1072

Mike1072
  • Modder
  • 539 posts

Posted 19 August 2016 - 02:08 PM

If you execute code like this:
 
COPY_EXISTING ~spwi101.spl~ ~override~
  PATCH_IF (SOURCE_SIZE > 0x71) BEGIN
    LPF ~ADD_SPELL_EFFECT~ INT_VAR opcode = 139 target = 1 timing = 1 parameter1 = RESOLVE_STR_REF (~Greased Lightning~) resist_dispel = 3 END
  END
  BUT_ONLY
 
You should get an effect like this:
 
X1KRvKz.png

#25 temnix

temnix
  • Member
  • 983 posts

Posted 20 August 2016 - 03:44 AM

I'll try this this, thanks. But won't the Grease icon give me the Grease string all by itself? When I call on an icon, I always get its state text as well.



#26 The Imp

The Imp

    Not good, see EVIL is better. You'll LIVE.

  • Member
  • 5155 posts

Posted 20 August 2016 - 04:09 AM

I'll try this this, thanks. But won't the Grease icon give me the Grease string all by itself? When I call on an icon, I always get its state text as well.
You should take into account that, what Mike did was he opened the grease spell after he had weidu edited the vanilla non-EE version of the file. He didn't make a new spell. So the "Effect 3" is there by default. What you need to be looking is just the "Effect 4".

Edited by The Imp, 20 August 2016 - 04:10 AM.

Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit). 
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.


#27 temnix

temnix
  • Member
  • 983 posts

Posted 20 August 2016 - 08:59 AM

Do EE installations have vanilla spells in them?

 

So I should I take a ready spell and edit it this way, putting my own string instead? Then add other effects and save the whole thing under a different spl name? The code gives me the string (I think so, I haven't tested it yet), but this is just a way to get a string in my current installation of the game without editing dialog.tlk by hand - which is what I asked for, true. All right, I will end up with a custom string in my custom spell this way. I have to re-build the spell from scratch around that string... But how is this going to work for people who download the mod? They won't have the string. They expect to have a ready spell the installer will plop in their override folder, creating the strings and everything along the way. And that COPY_EXISTING function, doesn't it only work on default spells?



#28 The Imp

The Imp

    Not good, see EVIL is better. You'll LIVE.

  • Member
  • 5155 posts

Posted 20 August 2016 - 10:32 AM

So I should I take a ready spell and edit it this way, putting my own string instead? Then add other effects and save the whole thing under a different spl name? The code gives me the string (I think so, I haven't tested it yet), but this is just a way to get a string in my current installation of the game without editing dialog.tlk by hand - which is what I asked for, true. All right, I will end up with a custom string in my custom spell this way. I have to re-build the spell from scratch around that string... But how is this going to work for people who download the mod? They won't have the string. They expect to have a ready spell the installer will plop in their override folder, creating the strings and everything along the way. And that COPY_EXISTING function, doesn't it only work on default spells?
COPY_EX.. works easily, but if you wish to make a copy of the file and make it your own spell you need to name it in the function, so you use:
COPY_EXISTING ~spwi101.spl~ ~override/newfilename.spl~
  PATCH_IF (SOURCE_SIZE > 0x71) BEGIN
    LPF ~ADD_SPELL_EFFECT~ INT_VAR opcode = 139 target = 1 timing = 1 parameter1 = RESOLVE_STR_REF (~Greased Lightning~) resist_dispel = 3 END
  END
  BUT_ONLY
And the newfilename.spl need to have at most 8 letters in the file name +.spl ... and the source file in that case is the grease spell.
The spell is made during the mods install phase, for you and for everyone else that installs the mod you make with it. I don't see where this comes in:
I have to re-build the spell from scratch around that string... But how is this going to work for people who download the mod?
As the mod builds the spell for you, it will do so for everyone else too.
Now, you can use the COPY, but then you use mod folder name and have the .spl file there already:
COPY ~yourmodsfoldername/whateveryourspellfilesnameis.spl~ ~override/weysfni.spl~
... rest of the previous code
Again there can be only 8 letters possible in the actual end file, so the weysfni.spl is the shorthand of the long name. This is in everyone of the tutorials... you should look them up.

Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit). 
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.


#29 temnix

temnix
  • Member
  • 983 posts

Posted 20 August 2016 - 11:40 AM

Thank you. Tutorials, you see, tend to be long, messy and time-consuming - compared to what I actually need from them. If the only thing in a car you care to use is its radio, you really don't want to learn how to drive, much less how the chassis works, and you completely don't want to go by the hard road of personal experience. I don't want to be a mechanic. So I, too, don't need most of what tutorials describe. I only need a few basic Weidu functions in addition to COPY, which I have been shown a fine example of, and so I now use it. Most of all other things I need for spells - invisible creatures, globals to set that will spawn other creatures, effects - I can do from within the toolset or from scripts. And I know how to write dialogues in the d format. That is probably 80% of what I will ever need from Weidu.

 

I will try to use this string-adding function as you suggest, and I can look into the tutorials for another element I need, or maybe you can just explain it here: appending existing dialogues. I know there are the APPEND and APPEND_EARLY commands, but I'm not sure how to use them to attach something more complicated than a single state to a conversation. In fact, I would rather not start from a state but add a new dialogue line to an existing state, if a condition is met (PartyHasItem). The dialogue to add to is the one of Taerom the smith. He has the regular greeting, the one used unless the party has an ankheg shell and so on, and in that greeting is where I'd like to insert a new dialogue option. I can write up the branch that will open up in d, but how do I append all that to TAEROM.DLG?



#30 temnix

temnix
  • Member
  • 983 posts

Posted 21 August 2016 - 12:06 PM

The code for the string doesn't work. It adds the string, not empty, but it isn't displayed in the game. In fact, the Display String effect doesn't work at all in my installation, even if I put in a string from the main tlk. I tried the Instant/Limited and the Instant/Permanent u.d. durations.


Edited by temnix, 21 August 2016 - 12:14 PM.


#31 The Imp

The Imp

    Not good, see EVIL is better. You'll LIVE.

  • Member
  • 5155 posts

Posted 21 August 2016 - 12:20 PM

Can you please upload your files to somewhere so we can download and see what's off in them ? The forum fails to receive my uploads, so I personally use the mediafire.com, but there's like 1000's of that sort of sites todays, so you can use what ever is to your liking.


Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit). 
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.


#32 temnix

temnix
  • Member
  • 983 posts

Posted 22 August 2016 - 04:33 AM

I will do that. Where does the string supposed to show, by the way? In the bottom screen, next to the creature's name? Or on the portraits? Maybe this is the source of confusion. My Taunt spell, unfortunately, doesn't work on the party if cast by a monster (I'll probably write about that separately elsewhere), so I had to limit it to against-monsters only. And, obviously, I wouldn't see a string on their "portraits." I need the message on the bottom of the screen now (this is different from my original request, I realize that. But now I think bottom-window messages are more useful.)



#33 temnix

temnix
  • Member
  • 983 posts

Posted 24 August 2016 - 04:11 AM

I sorted out why the string was not appearing. Just a syntax error on my part. It works!



#34 temnix

temnix
  • Member
  • 983 posts

Posted 06 September 2016 - 02:37 PM

A few more questions about Weidu. The Documentation really doesn't explain very much.

 

1) I'm making a conversable item. Long story short, I got this code to work:

 

OUTER_SET strref = RESOLVE_STR_REF (~Use~)
APPEND itemdial.2da ~DUSTSC_# %Use% DUSTSC_#~
BUT_ONLY

 

But I get a series of numbers, not even a string reference, for the button name. How do I get Use to appear on the button?

 

2) Any way to prevent the characters from saying "Yes?" "I'm listening" and so on when the talking item talks to them? It looks unnatural.

 

3) This is the code, tucked away behind the slashes for now, to add an NPC to the game. What exactly does this function do, though? It doesn't make the NPC appear where I want him to. Or do I have to append to the area script and create a creature that way? Also... this may or may not be related... I haven't started a new game in BGEE for a while, but some time after I started messing with these Weidu options, with this one in particular, the game started to fail at clicking "New game." I can't even get to the character generation screen, it fails with an error. I tried uninstalling the mod, but whether it's installed or not, something seems to have been corrupted. Candlekeep is still accessible if I load a saved game, I have a fresh character there, but I wonder if this Adding caused the damage?

 

COPY ~Taunt/QEEBIE_#.cre~ ~override~
SAY NAME1 ~Qeebie~
SAY NAME2 ~Qeebie~
// ADD_GAME_NPC "Qeebie" "ar2600" #2900 #920

 

4) I'd like a filter for sorcerers, for a dialogue. Different from wizards. So I used the Class trigger. But when I give the item with that filter to Baeloth, he gets the options for the wizard (for MAGE), even though I wanted him to get the block for SORCERER. Do sorcerers count as mages to that trigger? How do I make them stand out, then? By putting MAGE_ALL and SORCERER together?

 

Thank you.

 

P.S. Unrelated: I made a scroll from a basic letter and it's copyable where I set the Not Copyable flag or remove it. Just stays that way. What gives?

 

Edit: Figured out the filters. Can't figure out why I can't reliably make a sorcerer learn a spell! Dammit, there is some kind of method I worked out that did it, I forgot it, and now I have to discover it all over again...


Edited by temnix, 06 September 2016 - 03:01 PM.


#35 temnix

temnix
  • Member
  • 983 posts

Posted 09 September 2016 - 10:25 AM

An update of what I have solved and what I could still use advice, or better straight information, on:

 

1) Sorted out talking items and the button.

 

2) Either they stopped doing it or they don't do it every time.

 

3) I got rid of ADD_NPC, whatever it is, and just create creatures through the scripts.

 

4) Solved this by putting the SORCERER state on the top, so it's accessed first.

 

The P.S. Yes, the trick is to have them cast a spell on themselves, but Learn Spell must be a Self targeted effect, not a Preset Target one.

 

So, it looks like I cleared up the list of troubles. What I need help, or ideally just a direct example, now is how to work with the journal. I mean the ADD_JOURNAL thing. The Weidu Documentation is mystifying on this like on everything else, and all of the tp2 files from mods I've opened are so streamlined and slick, they use entries in baf files and what-have-you, which makes them completely impenetrable to me. I want to add a quest, a complete quest entry, and erase the first one.

 

I know I've asked a lot of questions on this board, but that's the initial learning curve. With the journal and other basics under my belt I'll soon know enough for the simple mods I want to create. I don't see myself ever needing to learn about advanced Weidu or such.


Edited by temnix, 09 September 2016 - 10:26 AM.


#36 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 04 October 2016 - 02:07 PM

all of the tp2 files from mods I've opened are so streamlined and slick

Clearly, you are not talking about any of my mods.

 

This is from a random .d (dialogue) file. You could also do it in a .baf (script). You would not typically put it in a .tp2 unless you were modifying an existing dialogue or script.

IF ~PartyHasItem("t-gear01")~ BEGIN 6.5
  SAY @15 /* Outstanding! You found my replacement grindstone gear! With this new gear, the town won't run out of grain for its supply of beer, er, I mean bread. Here, take this old book. Been in the family for ages, but I can't pretend to make sense of any of it.  You seem clever enough. Maybe you can read it. */
  IF ~~ THEN DO ~SetGlobal("t-eagear","GLOBAL",3)
TakePartyItem("t-gear01")
DestroyItem("t-gear01")
GiveItemCreate("t-book01",LastTalkedToBy(),0,0,0)
%ERASEJOURNALENTRY_502%
AddJournalEntry(@503%QUEST_DONE%)~ EXIT
END

There are some variables here to ensure compatibility with older game versions (e.g. vanilla BG1) but you probably don't have to worry about that. %ERASEJOURNALENTRY_502% for example typically evaluates to "EraseJournalEntry(@502)." @502 is some text in a .tra file. You don't have to traify your files, but it makes it easier for translators. QUEST_DONE is ",QUEST_DONE" for IE games that support this (most of them). Anyway, the syntax there erases an existing journal entry and adds a completed journal entry. I can't tell if you answered your other questions, so repeat them if not.


Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#37 temnix

temnix
  • Member
  • 983 posts

Posted 04 October 2016 - 03:37 PM

I've followed Roxanne's suggestion on the G3 forum. I made a TRA file with the entries, then put this in the D file:

 

IF ~~ THEN DO ~SetGlobal("QEEBIEWAITS","GLOBAL",1) AddJournalEntry(@001,QUEST)~ EXIT

 

And this is the quest-complete line:

 

IF ~~ THEN DO ~AddexperienceParty(50) TakePartyGold(100) GiveItem("DUSTSC_#",LastTalkedToBy()) GiveItem("JUNKSC_#",LastTalkedToBy())  EraseJournalEntry(@001) AddJournalEntry(@002,QUEST_DONE) EscapeAreaDestroy(10)~ EXIT

 

I think that's what I have now, at least. I don't know if it's the same solution as yours or not. This one works, except the entry is not or was not getting erased. It's too difficult to test on my machine, there may be different strings quoted, left-overs from all of the reinstalls and uninstalls I did. Maybe it is erased on a clean install of the mod.

 

What you can better help me with is altering an effect with Weidu, if you know about that. I've asked in one of the topics whether it's possible to make a new line in the conditions for Apply Effects List (opcode 326). That list has conditions for < than a stat value or => than a stat value, but not just =. So if you want to have a condition of, e.g., Charisma = 8, you have to put a check for Charisma < 9, then have that exit to a further Apply effect and put in another check for Charisma => 8. If you have a lot of these checks, you need to make a whole mess of extra files. So I asked if it's possible to put a stat = condition in there. subtledoctor answered with this:

 

He's talking about opcode 326.

That spell effect actually just references lines in SPLPROT.2da. Yes, you can make it look for an exact match of your CHA score (funny, I just added some code to my mod that does exactly that) but it takes a few steps:
1) APPEND a new line to SPLPROT.2da, similar to the existing ones for CHA but with = instead of >= or <
2) Find the entry # of the line you just appended
3) Use ALTER_EFFECT the plug that line # into the 326 effect
4) Profit

 

But then I never got an explanation or example of how to use ALTER_EFFECT. I don't know where to look for one. If you can give me an example, that would be very nice, I could clean up the implementation of my Charisma-dependent spell.



#38 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 04 October 2016 - 05:26 PM

I don't know if it's the same solution as yours or not.
It sure is, with a few rather minor differences:
1) My example does not confer monetary nor experiential rewards, because I'm stingy that way. (Well not really, but every megamod and its brother grants all manner of both, in "yuge" amounts; your rewards are properly conservative in light of this.)

2) You use GiveItem() whereas I used GiveItemCreate(). The difference? In the former case, the rewarder has to have said item and has to be able to give it. This is largely only an issue if you previously pickpocketed said person (you win either way, but it looks odd if you've pinched the item previously).

3) You have no conditions for your dialogue block firing; presumably you might elsewhere though.
This one works, except the entry is not or was not getting erased. [...] there may be different strings quoted
That last bit would be my first guess. It has to be *exactly* the same text.
What you can better help me with is altering an effect with Weidu, if you know about that.
There are specs in the WeiDU doc under the function's description, but no example. It may have changed since I last used it, but the syntax is as simple or complex as whatever you want to change.
COPY_EXISTING ~spwi802.spl~ ~override~
  LPF ALTER_EFFECT INT_VAR check_globals = 0 match_opcode = 174 STR_VAR match_resource = ~EFF_M02~ resource = ~#EFF_M02~ END
BUT_ONLY
That changes a sound effect associated with a spell to another. I guess I would have to know more about what you're trying to do in order to give a better example. You would only use this to change an existing spell's effect(s). Are you trying to do that or change one of your own spells? Are you trying to add an effect that doesn't already exist or change one that does?

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#39 temnix

temnix
  • Member
  • 983 posts

Posted 05 October 2016 - 10:38 AM

I use GiveItem() because there is supposed to be only one copy of that item... If the player has picked the pockets, well, they won't get it the second time. The response may read weirdly, but it's better than having another unique pop up.

 

For the Weidu edit, the easiest way to explain is if you make an opcode 326 effect in a spell and look at the list of conditions there. It's one strange list, clearly drawn up for the designers' usual needs. What I want is to enable a CHA = condition for my mod. But someone who understands adding to 2da files, with hex values and all, would do all modders a service by creating a technical mod that expands that list of conditions. It's not just the stats, there are others that should be added. For example, there is the "if has kit" condition, but not a "if does not have kit" condition. For my charm spell I wanted to add a (bad) side effect that would only occur if the spell were cast by someone other than a specialist, i.e. an enchanter. But I could not set that condition directly, so I had to take a very roundabout way through two more files to represent that situation. Another condition that would spare people, myself included, a lot of extra filtering is what you might call "the living mind," meaning NOT:

 

Undead (from General)

Elemental

Golem

Plant

Mist

 

(these are all from Race)

 

Make one condition that excludes these, and mind-affecting effects will be much easier to create.



#40 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 07 October 2016 - 12:23 PM

I use GiveItem() because there is supposed to be only one copy of that item... If the player has picked the pockets, well, they won't get it the second time. The response may read weirdly, but it's better than having another unique pop up.
It should be unique either way. You wouldn't use GiveItemCreate() with an item in the CRE's inventory, since it explicitly creates the item. If you want to avoid weirdness ("here's your prize... uh, I had it just a second ago...") you can also use GiveItem() and just make the item unpickpocketable (either put it in such an inventory slot or flag it as such).
For the Weidu edit, the easiest way to explain is if you make an opcode 326 effect in a spell and look at the list of conditions there. It's one strange list, clearly drawn up for the designers' usual needs.
Yeah... but I am surprised they didn't externalize these values to an IDS or 2DA rather than hardcoding them in the opcode. Or did they?

If we knew what the values corresponded to, "Not unnatural" or "Not breathing" might meet your needs. This might be something to request in the DLTCEP forum:

http://gibberlings3....p?showforum=137

At least, Avenger should be able to answer what the values represent if he's around. Where are you seeing the "if has kit" condition?

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle